Skip to content

Commit ad1217d

Browse files
committed
update workflow
1 parent 2528c95 commit ad1217d

File tree

1 file changed

+112
-52
lines changed

1 file changed

+112
-52
lines changed

.github/workflows/check-bioc.yml

Lines changed: 112 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
## * GHA: GitHub Action
2121
## * OS: operating system
2222

23-
on: push
23+
on:
24+
push:
25+
pull_request:
2426

2527
name: R-CMD-check-bioc
2628

@@ -50,9 +52,11 @@ jobs:
5052
fail-fast: false
5153
matrix:
5254
config:
53-
- { os: ubuntu-latest, r: 'release', bioc: 'devel', cont: "bioconductor/bioconductor_docker:devel", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" }
54-
- { os: macOS-latest, r: 'release', bioc: 'devel'}
55-
- { os: windows-latest, r: 'release', bioc: 'devel'}
55+
- { os: ubuntu-latest, r: '4.5', bioc: '3.22', cont: "bioconductor/bioconductor_docker:devel", rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest" }
56+
- { os: macOS-latest, r: '4.5', bioc: '3.22'}
57+
- { os: windows-latest, r: '4.5', bioc: '3.22'}
58+
## Check https://github.com/r-lib/actions/tree/master/examples
59+
## for examples using the http-user-agent
5660
env:
5761
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
5862
RSPM: ${{ matrix.config.rspm }}
@@ -75,48 +79,49 @@ jobs:
7579
## https://github.com/r-lib/actions/blob/master/examples/check-standard.yaml
7680
## If they update their steps, we will also need to update ours.
7781
- name: Checkout Repository
78-
uses: actions/checkout@v2
82+
uses: actions/checkout@v3
7983

8084
## R is already included in the Bioconductor docker images
8185
- name: Setup R from r-lib
8286
if: runner.os != 'Linux'
83-
uses: r-lib/actions/setup-r@master
87+
uses: r-lib/actions/setup-r@v2
8488
with:
8589
r-version: ${{ matrix.config.r }}
90+
http-user-agent: ${{ matrix.config.http-user-agent }}
8691

8792
## pandoc is already included in the Bioconductor docker images
8893
- name: Setup pandoc from r-lib
8994
if: runner.os != 'Linux'
90-
uses: r-lib/actions/setup-pandoc@master
95+
uses: r-lib/actions/setup-pandoc@v2
9196

9297
- name: Query dependencies
9398
run: |
9499
install.packages('remotes')
95100
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
96101
shell: Rscript {0}
97102

98-
- name: Cache R packages
103+
- name: Restore R package cache
99104
if: "!contains(github.event.head_commit.message, '/nocache') && runner.os != 'Linux'"
100-
uses: actions/cache@v2
105+
uses: actions/cache@v3
101106
with:
102107
path: ${{ env.R_LIBS_USER }}
103-
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-4.1-${{ hashFiles('.github/depends.Rds') }}
104-
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-4.1-
108+
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-4.5-${{ hashFiles('.github/depends.Rds') }}
109+
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-4.5-
105110

106111
- name: Cache R packages on Linux
107112
if: "!contains(github.event.head_commit.message, '/nocache') && runner.os == 'Linux' "
108-
uses: actions/cache@v2
113+
uses: actions/cache@v3
109114
with:
110115
path: /home/runner/work/_temp/Library
111-
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-4.1-${{ hashFiles('.github/depends.Rds') }}
112-
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-4.1-
116+
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-4.5-${{ hashFiles('.github/depends.Rds') }}
117+
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-4.5-
113118

114-
- name: Install Linux system dependencies
115-
if: runner.os == 'Linux'
116-
run: |
117-
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 = " "))')
118-
echo $sysreqs
119-
sudo -s eval "$sysreqs"
119+
# - name: Install Linux system dependencies
120+
# if: runner.os == 'Linux'
121+
# run: |
122+
# 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 = " "))')
123+
# echo $sysreqs
124+
# sudo -s eval "$sysreqs"
120125

121126
- name: Install macOS system dependencies
122127
if: matrix.config.os == 'macOS-latest'
@@ -135,6 +140,9 @@ jobs:
135140
## For installing usethis's dependency gert
136141
brew install libgit2
137142
143+
## Required for tcltk
144+
brew install xquartz --cask
145+
138146
- name: Install Windows system dependencies
139147
if: runner.os == 'Windows'
140148
run: |
@@ -149,7 +157,7 @@ jobs:
149157

150158
- name: Set BiocVersion
151159
run: |
152-
BiocManager::install(version = "${{ matrix.config.bioc }}", ask = FALSE)
160+
BiocManager::install(version = "${{ matrix.config.bioc }}", ask = FALSE, force = TRUE)
153161
shell: Rscript {0}
154162

155163
- name: Install dependencies pass 1
@@ -161,9 +169,13 @@ jobs:
161169
## https://github.com/r-lib/remotes/issues/296
162170
## Ideally, all dependencies should get installed in the first pass.
163171
172+
## For running the checks
173+
message(paste('****', Sys.time(), 'installing rcmdcheck and BiocCheck ****'))
174+
install.packages(c("rcmdcheck", "BiocCheck"), repos = BiocManager::repositories())
175+
164176
## Pass #1 at installing dependencies
165177
message(paste('****', Sys.time(), 'pass number 1 at installing dependencies: local dependencies ****'))
166-
remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = TRUE, upgrade = TRUE, force = TRUE)
178+
remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = FALSE, upgrade = TRUE)
167179
continue-on-error: true
168180
shell: Rscript {0}
169181

@@ -172,11 +184,6 @@ jobs:
172184
## Pass #2 at installing dependencies
173185
message(paste('****', Sys.time(), 'pass number 2 at installing dependencies: any remaining dependencies ****'))
174186
remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = TRUE, upgrade = TRUE, force = TRUE)
175-
176-
## For running the checks
177-
message(paste('****', Sys.time(), 'installing rcmdcheck and BiocCheck ****'))
178-
remotes::install_cran("rcmdcheck")
179-
BiocManager::install("BiocCheck")
180187
shell: Rscript {0}
181188

182189
- name: Install BiocGenerics
@@ -187,15 +194,15 @@ jobs:
187194
shell: Rscript {0}
188195

189196
- name: Install covr
190-
if: github.ref == 'refs/heads/bioc-check' && env.run_covr == 'true' && runner.os == 'Linux'
197+
if: github.ref == 'refs/heads/devel' && env.run_covr == 'true' && runner.os == 'Linux'
191198
run: |
192199
remotes::install_cran("covr")
193200
shell: Rscript {0}
194201

195202
- name: Install pkgdown
196-
if: github.ref == 'refs/heads/bioc-check' && env.run_pkgdown == 'true' && runner.os == 'Linux'
203+
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux'
197204
run: |
198-
remotes::install_cran("pkgdown")
205+
remotes::install_github("r-lib/pkgdown")
199206
shell: Rscript {0}
200207

201208
- name: Session info
@@ -208,10 +215,12 @@ jobs:
208215
- name: Run CMD check
209216
env:
210217
_R_CHECK_CRAN_INCOMING_: false
218+
DISPLAY: 99.0
211219
run: |
220+
options(crayon.enabled = TRUE)
212221
rcmdcheck::rcmdcheck(
213-
args = c("--no-build-vignettes", "--no-manual", "--timings"),
214-
build_args = c("--no-manual", "--no-resave-data"),
222+
args = c("--no-manual", "--no-vignettes", "--timings"),
223+
build_args = c("--no-manual", "--keep-empty-dirs", "--no-resave-data"),
215224
error_on = "warning",
216225
check_dir = "check"
217226
)
@@ -229,6 +238,8 @@ jobs:
229238
shell: Rscript {0}
230239

231240
- name: Run BiocCheck
241+
env:
242+
DISPLAY: 99.0
232243
run: |
233244
BiocCheck::BiocCheck(
234245
dir('check', 'tar.gz$', full.names = TRUE),
@@ -239,40 +250,89 @@ jobs:
239250
shell: Rscript {0}
240251

241252
- name: Test coverage
242-
if: github.ref == 'refs/heads/bioc-check' && env.run_covr == 'true' && runner.os == 'Linux'
253+
if: github.ref == 'refs/heads/devel' && env.run_covr == 'true' && runner.os == 'Linux'
243254
run: |
244-
covr::codecov()
255+
covr::codecov(coverage = covr::package_coverage(type = "all"))
245256
shell: Rscript {0}
246257

247258
- name: Install package
248-
if: github.ref == 'refs/heads/bioc-check' && env.run_pkgdown == 'true' && runner.os == 'Linux'
259+
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux'
249260
run: R CMD INSTALL .
250261

251-
- name: Deploy package
252-
if: github.ref == 'refs/heads/bioc-check' && env.run_pkgdown == 'true' && runner.os == 'Linux'
253-
run: |
254-
git config --local user.email "[email protected]"
255-
git config --local user.name "GitHub Actions"
256-
Rscript -e "pkgdown::deploy_to_branch(new_process = FALSE)"
257-
shell: bash {0}
262+
- name: Build pkgdown site
263+
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux'
264+
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
265+
shell: Rscript {0}
258266
## Note that you need to run pkgdown::deploy_to_branch(new_process = FALSE)
259267
## at least one locally before this will work. This creates the gh-pages
260268
## branch (erasing anything you haven't version controlled!) and
261269
## makes the git history recognizable by pkgdown.
262270

271+
- name: Install deploy dependencies
272+
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux'
273+
run: |
274+
apt-get update && apt-get -y install rsync
275+
276+
- name: Deploy pkgdown site to GitHub pages 🚀
277+
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux'
278+
uses: JamesIves/github-pages-deploy-action@releases/v4
279+
with:
280+
clean: false
281+
branch: gh-pages
282+
folder: docs
283+
263284
- name: Upload check results
264285
if: failure()
265-
uses: actions/upload-artifact@v2
286+
uses: actions/upload-artifact@master
266287
with:
267-
name: ${{ runner.os }}-biocversion-devel-r-4.1-results
288+
name: ${{ runner.os }}-biocversion-devel-r-4.5-results
268289
path: check
269290

270-
- uses: docker/build-push-action@v1
271-
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && runner.os == 'Linux' "
291+
292+
## Code adapted from
293+
## https://github.com/waldronlab/cBioPortalData/blob/e0440a4445f0cc731e426363a76faa22ee5e0f9d/.github/workflows/devel_check_dock.yml#L65-L92
294+
docker-build-and-push:
295+
runs-on: ubuntu-latest
296+
needs: build-check
297+
steps:
298+
- name: Checkout Repository
299+
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel'"
300+
uses: actions/checkout@v3
301+
302+
- name: Register repo name
303+
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel'"
304+
id: reg_repo_name
305+
run: |
306+
echo CONT_IMG_NAME=$(echo ${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
307+
308+
- name: Set up QEMU
309+
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel'"
310+
uses: docker/setup-qemu-action@v2
311+
312+
- name: Set up Docker Buildx
313+
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel'"
314+
uses: docker/setup-buildx-action@v2
315+
316+
- name: Login to Docker Hub
317+
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel'"
318+
uses: docker/login-action@v2
319+
with:
320+
username: ${{ secrets.DOCKERHUB_USERNAME }}
321+
password: ${{ secrets.DOCKERHUB_TOKEN }}
322+
## Note that DOCKERHUB_TOKEN is really a token for your dockerhub
323+
## account, not your actual dockerhub account password. You can get it
324+
## from https://hub.docker.com/settings/security.
325+
## Check https://github.com/docker/build-push-action/tree/v4.0.0
326+
## for more details.
327+
## Alternatively, try checking
328+
## https://seandavi.github.io/BuildABiocWorkshop/articles/HOWTO_BUILD_WORKSHOP.html.
329+
330+
- name: Build and Push Docker
331+
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel' && success()"
332+
uses: docker/build-push-action@v4
272333
with:
273-
username: ${{ secrets.DOCKER_USERNAME }}
274-
password: ${{ secrets.DOCKER_PASSWORD }}
275-
repository: mfansler/txcutr
276-
tag_with_ref: true
277-
tag_with_sha: true
278-
tags: latest
334+
context: .
335+
push: true
336+
tags: >
337+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CONT_IMG_NAME }}:latest,
338+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CONT_IMG_NAME }}:devel

0 commit comments

Comments
 (0)