Skip to content

Commit e280ae3

Browse files
committed
adding Macos pak setup
1 parent e3a7294 commit e280ae3

1 file changed

Lines changed: 107 additions & 0 deletions

File tree

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Workflow is triggered on label and check installation on various operating systems
2+
# This action is adapted from https://github.com/t4d-gmbh/stubbed_versioning
3+
name: Macos Install
4+
5+
on:
6+
push:
7+
branches:
8+
- "main"
9+
- "117-elaborate-if-inla-jags-and-gsl-can-be-installed-via-systemrequirements"
10+
11+
env:
12+
BUILD_LOC: "./build"
13+
BRANCH: ${{ github.head_ref || github.ref_name }}
14+
15+
permissions:
16+
packages: read
17+
contents: write
18+
pull-requests: write
19+
repository-projects: write
20+
21+
jobs:
22+
setup-and-install:
23+
name: macos-latest R release
24+
runs-on: macos-latest
25+
env:
26+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
27+
R_KEEP_PKG_SOURCE: yes
28+
steps:
29+
- name: prepare macos
30+
run: |
31+
brew install R
32+
brew install pkg-config
33+
brew install automake # needed to run autoconf
34+
35+
- name: install GSL
36+
run: |
37+
brew install gsl
38+
39+
- name: install JAGS
40+
run: |
41+
brew install jags
42+
43+
# - name: install rjags
44+
# run: |
45+
# install.packages("rjags", type="source", repos=c(CRAN="https://cran.r-project.org"))
46+
# library("rjags")
47+
# shell: Rscript {0}
48+
49+
- name: install INLA dependencies
50+
run: |
51+
brew install udunits
52+
brew install openssl@1.1 # s2 package
53+
brew install gdal # installs geos as dependency
54+
# for s2 fmesher terra)
55+
brew install proj # sf package
56+
57+
- name: install INLA
58+
run: |
59+
install.packages("INLA", repos = c(CRAN = "https://cran.r-project.org", INLA = "https://inla.r-inla-download.org/R/stable"), dep = TRUE)
60+
shell: Rscript {0}
61+
62+
- name: install pak
63+
run: |
64+
install.packages('pak', repos=c(CRAN="https://cran.r-project.org"))
65+
shell: Rscript {0}
66+
67+
# - name: install from CRAN with pak
68+
# run: |
69+
# pak::pkg_install('abn', dependencies=TRUE)
70+
# library('abn')
71+
# shell: Rscript {0}
72+
73+
- name: pak install from GitHub
74+
run: |
75+
pak::repo_add(INLA = "https://inla.r-inla-download.org/R/stable/")
76+
pak::pkg_install("furrer-lab/abn@${{ env.BRANCH }}", dependencies=TRUE)
77+
library('abn')
78+
shell: Rscript {0}
79+
80+
- name: fetch the repository from GitHub
81+
uses: actions/checkout@v4
82+
83+
- name: deactivate the renv
84+
run: |
85+
renv::deactivate()
86+
shell: Rscript {0}
87+
88+
- name: install from source
89+
run: |
90+
pak::local_install(dependencies=TRUE)
91+
shell: Rscript {0}
92+
93+
- name: run the tests
94+
run: |
95+
pak::pak('r-lib/testthat')
96+
library("abn")
97+
testthat::test_local(path='tests', load_package='none')
98+
shell: Rscript {0}
99+
100+
- name: Show checks outcome
101+
if: always()
102+
needs: setup-and-install
103+
run: |
104+
echo ::group::Show testthat output
105+
find check -name 'testthat.Rout*' -exec cat '{}' \; || true
106+
echo ::endgroup::
107+
shell: bash --noprofile --norc -e -o pipefail {0}

0 commit comments

Comments
 (0)