-
Notifications
You must be signed in to change notification settings - Fork 4
145 lines (122 loc) · 4.49 KB
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
workflow_call:
name: Main CI workflow
jobs:
deploy:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- {os: windows-2022, r: 'release'}
- {os: macOS-12, r: 'release'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout pharmr
uses: actions/checkout@v3
with:
path: pharmr_repo
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
- uses: r-lib/actions/setup-pandoc@v2
- name: Query dependencies
working-directory: pharmr_repo
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Restore R package cache
if: runner.os != 'Windows'
uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
- name: Install system dependencies
working-directory: pharmr_repo
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
- name: Install png (temporary)
working-directory: pharmr_repo
if: runner.os == 'Windows'
run: |
install.packages('png', repos='https://mran.microsoft.com/snapshot/2022-11-27')
shell: Rscript {0}
- name: Install R dependencies
working-directory: pharmr_repo
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
install.packages('reticulate')
shell: Rscript {0}
- name: Install pharmr
working-directory: pharmr_repo
run: |
remotes::install_local(force=TRUE)
shell: Rscript {0}
- name: Checkout Pharmpy
uses: actions/checkout@v3
with:
repository: pharmpy/pharmpy
path: pharmpy_repo
fetch-depth: 0
- name: Install Pharmpy in venv
working-directory: pharmpy_repo
run: |
python3.11 -m venv pharmpy_venv
source pharmpy_venv/bin/activate
pip install .
- name: Test Pharmpy
working-directory: pharmr_repo
run: |
reticulate::py_discover_config()
reticulate::use_python('../pharmpy_repo/pharmpy_venv/bin')
pharmr::print_pharmpy_version()
shell: Rscript {0}
- name: Install deploy dependencies
run: |
install.packages("devtools")
shell: Rscript {0}
- name: Update DESCRIPTION and documentation
working-directory: pharmr_repo/deploy
run: |
reticulate::use_python('../../pharmpy_repo/pharmpy_venv/bin')
reticulate::py_run_file('build_functions.py')
devtools::document()
shell: Rscript {0}
- name: Check
working-directory: pharmr_repo
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: |
reticulate::py_discover_config()
reticulate::use_python('../pharmpy_repo/pharmpy_venv/bin')
pharmr::print_pharmpy_version()
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
rcmdcheck::rcmdcheck(args = c("--no-manual"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: results-cran
path: check