-
Notifications
You must be signed in to change notification settings - Fork 7
413 lines (412 loc) Β· 16.3 KB
/
rworkflows_static.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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
name: rworkflows_static
'on':
push:
branches:
- master
- main
- devel
- RELEASE_**
pull_request:
branches:
- master
- main
- devel
- RELEASE_**
env:
run_bioccheck: ${{ false }}
run_rcmdcheck: ${{ true }}
as_cran: ${{ true }}
run_vignettes: ${{ true }}
has_testthat: ${{ true }}
run_covr: ${{ true }}
run_pkgdown: ${{ true }}
has_runit: ${{ false }}
has_latex: ${{ false }}
tinytex_installer: TinyTeX-1
pandoc_version: '2.19'
run_docker: ${{ false }}
docker_registry: ghcr.io
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
cache_version: cache-v1
miniforge_variant: ${{ false }}
activate_environment: test
jobs:
rworkflows_static:
permissions: write-all
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
container: ${{ matrix.config.cont }}
strategy:
fail-fast: ${{ false }}
matrix:
config:
- os: ubuntu-latest
r: auto
bioc: release
cont: ghcr.io/bioconductor/bioconductor_docker:RELEASE_3_18
rspm: ~
- os: macOS-latest
bioc: release
r: auto
cont: ~
rspm: ~
- os: windows-latest
bioc: release
r: auto
cont: ~
rspm: ~
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: ${{ true }}
RSPM: ${{ matrix.config.rspm }}
TZ: UTC
GITHUB_REPO: ${{ github.repository }}
RGL_USE_NULL: ${{ true }}
steps:
- name: "\U0001F52D Collect Workflow Telemetry"
uses: runforesight/workflow-telemetry-action@v1
continue-on-error: ${{ true }}
with:
github_token: ${{ env.GITHUB_TOKEN }}
- name: "\U0001F4BE Free Disk Space"
if: env.free_diskspace == 'true' && runner.os == 'Linux'
uses: jlumbroso/free-disk-space@main
- name: "\U0001F30E Set environment variables"
run: |
echo "RGL_USE_NULL=TRUE" >> $GITHUB_ENV
echo "R_REMOTES_NO_ERRORS_FROM_WARNINGS=${{ true }}" >> $GITHUB_ENV
echo "RSPM=${{ matrix.config.rspm }}" >> $GITHUB_ENV
echo "TZ=UTC" >> $GITHUB_ENV
echo "NOT_CRAN=${{ !env.as_cran }}" >> $GITHUB_ENV
shell: bash {0}
- name: "\U0001F40D Setup Miniconda"
if: env.miniforge_variant != 'false'
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: ${{ false }}
python-version: ${{ matrix.python-version }}
miniforge-variant: ${{ env.miniforge_variant }}
miniforge-version: ${{ env.miniforge_version }}
activate-environment: ${{ env.activate_environment }}
environment-file: ${{ env.environment_file }}
channels: ${{ env.channels }}
- name: "\U0001F4DA Set R library home on Linux"
if: runner.os == 'Linux'
run: |
mkdir -p /__w/_temp/Library
echo ".libPaths('/__w/_temp/Library')" >> ~/.Rprofile
git config --global --add safe.directory '*'
shell: bash {0}
- name: β¬ Checkout repository
uses: actions/checkout@v4
- name: "\U0001F6E0 Setup R and Bioconductor"
if: runner.os != 'Linux'
uses: grimbough/bioc-actions/setup-bioc@v1
with:
bioc-version: ${{ matrix.config.bioc }}
- name: "\U0001F6E0 Install Pandoc"
if: env.pandoc_version != 'false' && runner.os != 'Linux'
uses: r-lib/actions/setup-pandoc@v2
with:
pandoc-version: ${{ env.pandoc_version }}
- name: β Query dependencies
env:
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
run: |
options(crayon.enabled = TRUE)
install.packages('remotes')
remotes::install_github("r-lib/remotes")
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
shell: Rscript {0}
- name: "\U0001F3E6 Restore R package cache"
if: |
!contains(github.event.head_commit.message, '[nocache]') && runner.os != 'Linux'
uses: actions/cache@v3
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ env.cache_version }}-${{ runner.os }}-biocversion-${{ matrix.config.bioc
}}-r-${{ matrix.config.r }}-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ env.cache_version }}-${{ runner.os }}-biocversion-${{ matrix.config.bioc
}}-r-${{ matrix.config.r }}-
- name: "\U0001F3E6 Cache R packages on Linux"
if: |
!contains(github.event.head_commit.message, '[nocache]') && runner.os == 'Linux'
uses: actions/cache@v3
with:
path: /home/runner/work/_temp/Library
key: ${{ env.cache_version }}-${{ runner.os }}-biocversion-${{ matrix.config.bioc
}}-r-${{ matrix.config.r }}-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ env.cache_version }}-${{ runner.os }}-biocversion-${{ matrix.config.bioc
}}-r-${{ matrix.config.r }}-
- name: "\U0001F6E0 Install Linux system dependencies"
if: runner.os == 'Linux'
run: |
sysreqs=$(Rscript -e 'cat("apt-get update -y && apt-get install -y", paste(gsub("apt-get install -y ", "", remotes::system_requirements("ubuntu", "20.04")), collapse = " "))')
echo $sysreqs
sudo -s eval "$sysreqs"
sudo apt-get install -y qpdf rsync
shell: bash {0}
- name: "\U0001F6E0 Install macOS system dependencies"
if: runner.os == 'macOS'
run: |
#### --- Justifications for each package --- ####
### libxml2 ###
# Enable installing XML from source if needed
### imagemagick@6 ###
# Required to install magick as noted at
# https://github.com/r-lib/usethis/commit/f1f1e0d10c1ebc75fd4c18fa7e2de4551fd9978f#diff-9bfee71065492f63457918efcd912cf2
### harfbuzz fribidi ###
# For textshaping, required by ragg, and required by pkgdown
### libgit2 ###
# For installing usethis's dependency gert
### xquartz --cask ###
# Required for tcltk
### libxfont ###
# Required for some ggplot2 functions
### texlive ###
# Required for rendering Sweave files (even with r-lib/actions/setup-tinytex)
#### --- Install packages --- ####
### Install normally ###
brew install libxml2 imagemagick@6 harfbuzz fribidi libgit2 texlive
### Install via cask ###
brew install xquartz --cask
### Set up xml2 ###
echo "XML_CONFIG=/usr/local/opt/libxml2/bin/xml2-config" >> $GITHUB_ENV
shell: bash {0}
- name: "\U0001F6E0 Install Windows system dependencies"
if: env.has_latex == 'true' && runner.os == 'Windows'
run: |
#### npm ####
npm install curl
shell: pwsh {0}
- name: "\U0001F6E0 Install latex"
if: env.has_latex == 'true'
uses: r-lib/actions/setup-tinytex@v2
env:
TINYTEX_INSTALLER: ${{ env.tinytex_installer }}
TINYTEX_VERSION: ${{ env.tinytex_version }}
- name: "\U0001F6E0 Install latex packages"
if: env.has_latex == 'true'
env:
tinytex_installer: ${{ env.tinytex_installer }}
tinytex_version: ${{ env.tinytex_version }}
run: |
install.packages("tinytex")
extra_packages <- c("bera","nowidow","parnotes","marginfix","etoolbox",
"titlesec","sectsty","framed","enumitem","parskip","soul","placeins",
"footmisc","changepage","xstring","caption","mathtools","fancyhdr",
"preprint","ragged2e","pdfcrop","titling","silence","everysel")
tinytex::tlmgr_install(pkgs = extra_packages)
shell: Rscript {0}
- name: "\U0001F6E0 Install dependencies pass 1"
env:
timeout: ${{ env.timeout }}
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
run: |
options(crayon.enabled = TRUE, timeout=Sys.getenv("timeout"))
## For running the checks
message(paste('****', Sys.time(), 'installing rcmdcheck ****'))
install.packages(c("rmarkdown","BiocManager"), dependencies = TRUE)
message(paste('****', Sys.time(), 'pass number 1 at installing dependencies****'))
repos <- BiocManager::repositories()
remotes::install_local(repos=repos, dependencies=TRUE, build_vignettes=FALSE, upgrade=TRUE, force=TRUE)
continue-on-error: ${{ true }}
shell: Rscript {0}
- name: "\U0001F6E0 Install dependencies pass 2"
env:
timeout: ${{ env.timeout }}
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
run: |
options(crayon.enabled = TRUE, timeout=Sys.getenv("timeout"))
message(paste('****', Sys.time(), 'pass number 2 at installing dependencies****'))
repos <- BiocManager::repositories()
remotes::install_local(repos=repos, dependencies=TRUE, build_vignettes=FALSE, upgrade=TRUE, force=TRUE)
shell: Rscript {0}
- name: "\U0001F6E0 Install RUnit (via BiocGenerics)"
if: env.has_runit == 'true'
run: |
options(crayon.enabled = TRUE)
BiocManager::install("BiocGenerics")
shell: Rscript {0}
- name: "\U0001F6E0 Install covr"
if: env.run_covr == 'true' && runner.os == 'Linux'
run: |
options(crayon.enabled = TRUE)
install.packages("covr")
shell: Rscript {0}
- name: "\U0001F6E0 Install pkgdown"
if: env.run_pkgdown == 'true' && runner.os == 'Linux'
run: |
options(crayon.enabled = TRUE)
install.packages("pkgdown")
shell: Rscript {0}
- name: βΉοΈ Session info οΈ
run: |
options(width = 100, crayon.enabled = TRUE)
pkgs <- installed.packages()[,"Package"]
if(!require("sessioninfo", quietly=TRUE)) install.packages("sessioninfo")
tryCatch({
sessioninfo::session_info(pkgs, include_base = TRUE)
}, error = function(x){utils::sessionInfo()})
shell: Rscript {0}
- name: β
Run CMD check
if: env.run_rcmdcheck == 'true'
env:
_R_CHECK_CRAN_INCOMING_: ${{ false }}
RGL_USE_NULL: ${{ env.RGL_USE_NULL }}
DISPLAY: 99.0
AS_CRAN: ${{ env.as_cran }}
run_vignettes: ${{ env.run_vignettes }}
timeout: ${{ env.timeout }}
run: |
options(crayon.enabled = TRUE, timeout=Sys.getenv("timeout"))
if(!require("rcmdcheck", quietly=TRUE)) install.packages("rcmdcheck")
as_cran <- if(Sys.getenv("AS_CRAN")=='true') "--as-cran" else NULL
run_build_vignettes <- if(Sys.getenv("run_vignettes")=='true') NULL else "--no-build-vignettes"
run_vignettes <- if(Sys.getenv("run_vignettes")=='true') NULL else "--ignore-vignettes"
rcmdcheck::rcmdcheck(
args = c("--no-manual", "--timings", as_cran, run_vignettes),
build_args = c("--no-manual", "--keep-empty-dirs", "--no-resave-data", run_build_vignettes),
error_on = "warning",
check_dir = "check")
shell: Rscript {0}
- name: "\U0001F4CB Reveal testthat details"
if: env.has_testthat == 'true'
run: |
find . -name testthat.Rout -exec cat '{}' ';'
shell: bash {0}
- name: "\U0001F4CB Run RUnit tests (via BiocGenerics)"
if: env.has_runit == 'true'
env:
timeout: ${{ env.timeout }}
run: |
options(crayon.enabled = TRUE, timeout=Sys.getenv("timeout"))
BiocGenerics:::testPackage()
shell: Rscript {0}
- name: β
Run BiocCheck
if: env.run_bioccheck == 'true'
env:
DISPLAY: 99.0
RGL_USE_NULL: ${{ env.RGL_USE_NULL }}
run_vignettes: ${{ env.run_vignettes }}
as_cran: ${{ env.as_cran }}
timeout: ${{ env.timeout }}
run: |
options(crayon.enabled = TRUE, timeout=Sys.getenv("timeout"))
#### Install deps ####
if(!require("BiocManager", quietly=TRUE)) install.packages("BiocManager")
if(!require("BiocCheck", quietly=TRUE)) BiocManager::install("BiocCheck")
#### Allow for packages on CRAN ####
no_check_vignettes <- Sys.getenv("run_vignettes")=='true'
as_cran <- Sys.getenv("as_cran")=='true'
#### Run checks ####
BiocCheck::BiocCheck(
dir('check', 'tar.gz$', full.names = TRUE),
`quit-with-status` = TRUE,
`no-check-R-ver` = TRUE,
`no-check-vignettes` = no_check_vignettes,
`no-check-CRAN` = as_cran,
`no-check-bioc-help` = as_cran)
shell: Rscript {0}
- name: "\U0001F4CB Test coverage"
if: env.run_covr == 'true' && runner.os == 'Linux'
run: |
covr::codecov()
shell: Rscript {0}
- name: "\U0001F6E0 Install package οΈ"
if: env.run_pkgdown == 'true' && runner.os == 'Linux'
run: R CMD INSTALL .
shell: bash {0}
- name: βΉοΈ Get R package info
if: runner.os == 'Linux'
run: |
#### DockerHub repos must be lowercase (,,) ####
name=$(grep '^Package:' DESCRIPTION | cut -d\ -f2)
echo "packageName=${name,,}" >> $GITHUB_ENV
echo "packageNameOrig=${name}" >> $GITHUB_ENV
echo $name
version=$(grep Version DESCRIPTION | grep -o "[0-9.]\+")
echo "packageVersion=${version}" >> $GITHUB_ENV
echo $version
echo "BASE_IMAGE=${{ matrix.config.cont }}" >> $GITHUB_ENV
shell: bash {0}
- name: "\U0001F4E6 Render README"
if: env.run_pkgdown == 'true' && runner.os == 'Linux'
env:
DISPLAY: 99.0
run: |
if(file.exists("README.Rmd")){
options(crayon.enabled = TRUE)
if(!require("rmarkdown", quietly=TRUE)) install.packages("rmarkdown");
rmarkdown::render("README.Rmd", output_format = rmarkdown::github_document(html_preview = FALSE));
}
shell: Rscript {0}
- name: "\U0001F4E6 Build pkgdown site"
if: env.run_pkgdown == 'true' && runner.os == 'Linux'
run: |
options(crayon.enabled = TRUE)
pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}
- name: "\U0001F4E6\U0001F680 Deploy pkgdown site to GitHub pages"
if: env.run_pkgdown == 'true' && runner.os == 'Linux'
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
clean: ${{ false }}
branch: gh-pages
folder: docs
token: ${{ env.GITHUB_TOKEN }}
- name: β« Upload check results
if: failure()
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-biocversion-${{ matrix.config.bioc }}-r-${{ matrix.config.r
}}-results
path: check
- name: "\U0001F433βοΈ Create Docker file"
if: |
(!contains(github.event.head_commit.message, '/nodocker')) && env.run_docker == 'true' && runner.os == 'Linux'
env:
BASE_IMAGE: ${{ matrix.config.cont }}
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
run: |
options(crayon.enabled = TRUE)
if(!require("rworkflows", quietly=TRUE)) remotes::install_github("neurogenomics/rworkflows")
path <- rworkflows::use_dockerfile(base_image=Sys.getenv("BASE_IMAGE"))
shell: Rscript {0}
- name: "\U0001F433\U0001F680 Build and push to GHCR"
if: |
(!contains(github.event.head_commit.message, '/nodocker')) && env.run_docker == 'true' && runner.os == 'Linux' && env.docker_registry == 'ghcr.io'
uses: docker/build-push-action@v1
env:
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
with:
username: ${{ github.repository_owner }}
password: ${{ env.GITHUB_TOKEN }}
registry: ${{ env.docker_registry }}
repository: ${{ github.repository }}
tag_with_ref: ${{ true }}
tag_with_sha: ${{ false }}
tags: |
${{ env.packageVersion }},
latest
build_args: |
PKG=${{ env.packageNameOrig }},
BASE_IMAGE=${{ matrix.config.cont }}
- name: "\U0001F433\U0001F680 Build and push to DockerHub"
if: |
(!contains(github.event.head_commit.message, '/nodocker')) && env.run_docker == 'true' && runner.os == 'Linux' && env.docker_registry == 'docker.io'
uses: docker/build-push-action@v1
env:
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
with:
username: ${{ env.docker_user }}
password: ${{ env.DOCKER_TOKEN }}
repository: ${{ env.docker_org }}/${{ env.packageName }}
tag_with_ref: ${{ true }}
tag_with_sha: ${{ false }}
tags: |
${{ env.packageVersion }},
latest
build_args: |-
PKG=${{ env.packageNameOrig }},
BASE_IMAGE=${{ env.BASE_IMAGE }}