-
Notifications
You must be signed in to change notification settings - Fork 27
292 lines (259 loc) · 10.1 KB
/
check-bioc.yml
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
## This is a simplified action for building and testing a Bioconductor package
## based on:
## * https://github.com/lcolladotor/biocthis/blob/master/actions/check-bioc.yml
## * https://github.com/r-lib/actions/blob/master/examples/check-standard.yaml
## * https://github.com/seandavi/BuildABiocWorkshop2020/blob/master/.github/workflows/basic_checks.yaml
name: R-CMD-check-bioc
## Specify which branches to run on
## The "devel" branch corresponds to Bioc-devel and "RELEASE_X" branches are
## Bioconductor releases. See http://bioconductor.org/developers/how-to/git/.
on:
push:
branches:
- devel
- 'RELEASE_*'
- actions
pull_request:
branches:
- devel
- 'RELEASE_*'
- actions
jobs:
get-bioc-release:
# Identify the Bioconductor release from the git branch. Also specifies a
# Bioconductor Docker image to use.
runs-on: ubuntu-latest
outputs:
biocimage: ${{ steps.get-release.outputs.biocimage }}
biocrelease: ${{ steps.get-release.outputs.biocrelease }}
steps:
- id: get-release
name: Get Bioconductor release
run: |
if echo "$GITHUB_REF" | grep -q "RELEASE_"; then
biocrelease="$(basename -- $GITHUB_REF | tr '[:upper:]' '[:lower:]')"
else
biocrelease="devel"
fi
biocimage="bioconductor/bioconductor_docker:${biocrelease}"
echo "Bioc release: ${biocrelease}"
echo "Bioc docker image: {$biocimage}"
## Store the information
echo "biocimage=${biocimage}" >> $GITHUB_OUTPUT
echo "biocrelease=${biocrelease}" >> $GITHUB_OUTPUT
get-bioc-version:
# Identify the Bioconductor version number and R version to use. This is
# done by checking the versions in the Bioconductor Docker container
# selected by get-bioc-release.
runs-on: ubuntu-latest
needs: get-bioc-release
container:
image: ${{ needs.get-bioc-release.outputs.biocimage }}
outputs:
Rversion: ${{ steps.set-versions.outputs.rversion }}
biocversion: ${{ steps.set-versions.outputs.biocversion }}
steps:
- id: get-versions
name: Get Bioconductor/R versions
run: |
biocconfig <- "https://bioconductor.org/config.yaml"
biocrelease <- "${{ needs.get-bioc-release.outputs.biocrelease }}"
cat("Bioc release RAW:", biocrelease, "\n")
biocrelease <- ifelse(
grepl(biocrelease, "release"),
"release", "devel"
)
biocmap <- BiocManager:::.version_map_get_online(biocconfig)
biocversion <- subset(biocmap, BiocStatus == biocrelease)[, 'Bioc']
biocversion_str <- as.character(biocversion)
rversion <- subset(biocmap, BiocStatus == biocrelease)[, 'R']
rversion_str <- as.character(rversion)
# Use R devel for BioC devel between November and May
if (biocrelease == "devel") {
current_month <- as.numeric(format(Sys.Date(), "%m"))
if (current_month >= 11 || current_month <= 5) {
cat("Setting R version to devel")
rversion <- "devel"
rversion_str <- "devel"
}
}
writeLines(c(biocversion_str, rversion_str), "versions.txt")
cat("GET VERSIONS", "\n")
cat("Bioc release: ", biocrelease, "\n")
cat("Bioc version: ", biocversion_str, "\n")
cat("R version: ", rversion_str, "\n")
shell: Rscript {0}
- id: set-versions
name: Set Bioconductor/R versions
run: |
biocversion=$(head -n 1 versions.txt)
rversion=$(tail -n 1 versions.txt)
echo "SET VERSIONS"
echo "Bioc version: ${biocversion}"
echo "R version: ${rversion}"
## Store the information
echo "biocversion=${biocversion}" >> $GITHUB_OUTPUT
echo "rversion=${rversion}" >> $GITHUB_OUTPUT
R-CMD-check-docker:
## Run checks in the Bioconductor Docker container
name: ubuntu-latest (r-biocdocker bioc-${{ needs.get-bioc-version.outputs.biocversion }})
needs: [get-bioc-release, get-bioc-version]
runs-on: ubuntu-latest
container:
image: ${{ needs.get-bioc-release.outputs.biocimage }}
volumes:
- /home/runner/work/_temp/Library:/usr/local/lib/R/host-site-library
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_BIOC_VERSION: ${{ needs.get-bioc-version.outputs.biocversion }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install extra linux dependencies
run: sudo apt-get update -y && sudo apt-get install -y libcurl4-openssl-dev devscripts qpdf
- name: Setup R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: 3
extra-packages: any::rcmdcheck
needs: check
- name: Show session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}
- name: Check R package
uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
upload-results: true
- name: BiocCheck
run: |
BiocManager::install("BiocCheck")
BiocCheck::BiocCheck(
dir('check', 'tar.gz$', full.names = TRUE),
`no-check-R-ver` = TRUE,
`no-check-bioc-help` = TRUE
)
shell: Rscript {0}
R-CMD-check:
## Run checks on other platforms.
name: ${{ matrix.config.os }} (r-${{ needs.get-bioc-version.outputs.rversion }} bioc-${{ needs.get-bioc-version.outputs.biocversion }})
needs: [get-bioc-release, get-bioc-version]
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
experimental: [true]
config:
- {os: windows-latest}
- {os: macOS-latest}
- {os: ubuntu-20.04, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
R_BIOC_VERSION: ${{ needs.get-bioc-version.outputs.biocversion }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Linux system dependencies
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt-get update
sudo apt-get upgrade libstdc++6
- name: Setup Pandoc
uses: r-lib/actions/setup-pandoc@v2
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ needs.get-bioc-version.outputs.rversion }}
use-public-rspm: true
- name: Setup R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: 3
extra-packages: any::rcmdcheck
needs: check
- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}
- name: Check R package
uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
upload-results: true
test-coverage:
## Calculate package test coverage. Only runs if R-CMD-check-docker has
## completed successfully. Uses the Bioconductor Docker image.
if: github.ref == 'refs/heads/devel'
needs: [get-bioc-release, get-bioc-version, R-CMD-check-docker]
runs-on: ubuntu-latest
container:
image: ${{ needs.get-bioc-release.outputs.biocimage }}
volumes:
- /home/runner/work/_temp/Library:/usr/local/lib/R/host-site-library
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_BIOC_VERSION: ${{ needs.get-bioc-version.outputs.biocversion }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install extra linux dependencies
run: sudo apt-get update -y && sudo apt-get install -y libcurl4-openssl-dev devscripts qpdf
- name: Setup R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: 3
extra-packages: any::covr
needs: coverage
- name: Test coverage
run: covr::codecov(quiet = FALSE)
shell: Rscript {0}
pkgdown:
## Build pkgdown site and push to gh-pages branch. Only runs if on the
## devel branch and R-CMD-check-docker has completed successfully. Uses
## the Bioconductor Docker image.
if: github.ref == 'refs/heads/devel'
needs: [get-bioc-release, get-bioc-version, R-CMD-check-docker]
runs-on: ubuntu-latest
container:
image: ${{ needs.get-bioc-release.outputs.biocimage }}
volumes:
- /home/runner/work/_temp/Library:/usr/local/lib/R/host-site-library
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_BIOC_VERSION: ${{ needs.get-bioc-version.outputs.biocversion }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set git credentials
## Assign commits to the GitHub Action user. This should happen
## automatically but doesn't (maybe because of Docker).
- run: |
git config user.name github-actions
git config user.email [email protected]
- name: Install extra linux dependencies
run: sudo apt-get update -y && sudo apt-get install -y libcurl4-openssl-dev devscripts qpdf
- name: Setup R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: 3
extra-packages: any::pkgdown, local::.
needs: website
- name: Build pkgdown site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}
- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
clean: false
branch: gh-pages
folder: docs