Skip to content

Commit a85947b

Browse files
committed
ci: upgrade to biocthis::use_bioc_github_action('devel')
1 parent 5f02afa commit a85947b

File tree

1 file changed

+92
-65
lines changed

1 file changed

+92
-65
lines changed

.github/workflows/check-bioc.yml

Lines changed: 92 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
## https://lcolladotor.github.io/biocthis/articles/biocthis_dev_notes.html
66
##
77
## You can add this workflow to other packages using:
8-
## > biocthis::use_bioc_github_action()
8+
## > biocthis::use_bioc_github_action("devel", testthat = TRUE, pkgdown = TRUE)
99
##
1010
## Using GitHub Actions exposes you to many details about how R packages are
1111
## compiled and installed in several operating system.s
@@ -52,10 +52,10 @@ jobs:
5252
fail-fast: false
5353
matrix:
5454
config:
55-
- { os: ubuntu-latest, r: '4.2', bioc: '3.16', cont: "bioconductor/bioconductor_docker:devel", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" }
56-
- { os: macOS-latest, r: '4.2', bioc: '3.16'}
57-
- { os: windows-latest, r: '4.2', bioc: '3.16'}
58-
## Check https://github.com/r-lib/actions/tree/v2/examples
55+
- { os: ubuntu-latest, r: 'devel', bioc: '3.19', cont: "bioconductor/bioconductor_docker:devel", rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest" }
56+
- { os: macOS-latest, r: 'devel', bioc: '3.19'}
57+
- { os: windows-latest, r: 'devel', bioc: '3.19'}
58+
## Check https://github.com/r-lib/actions/tree/master/examples
5959
## for examples using the http-user-agent
6060
env:
6161
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
@@ -76,10 +76,10 @@ jobs:
7676
echo ".libPaths('/__w/_temp/Library')" > ~/.Rprofile
7777
7878
## Most of these steps are the same as the ones in
79-
## https://github.com/r-lib/actions/blob/v2/examples/check-standard.yaml
79+
## https://github.com/r-lib/actions/blob/master/examples/check-standard.yaml
8080
## If they update their steps, we will also need to update ours.
8181
- name: Checkout Repository
82-
uses: actions/checkout@v2
82+
uses: actions/checkout@v3
8383

8484
## R is already included in the Bioconductor docker images
8585
- name: Setup R from r-lib
@@ -102,26 +102,26 @@ jobs:
102102

103103
- name: Restore R package cache
104104
if: "!contains(github.event.head_commit.message, '/nocache') && runner.os != 'Linux'"
105-
uses: actions/cache@v2
105+
uses: actions/cache@v3
106106
with:
107107
path: ${{ env.R_LIBS_USER }}
108-
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-4.2-${{ hashFiles('.github/depends.Rds') }}
109-
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-4.2-
108+
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-devel-${{ hashFiles('.github/depends.Rds') }}
109+
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-devel-
110110

111111
- name: Cache R packages on Linux
112112
if: "!contains(github.event.head_commit.message, '/nocache') && runner.os == 'Linux' "
113-
uses: actions/cache@v2
113+
uses: actions/cache@v3
114114
with:
115115
path: /home/runner/work/_temp/Library
116-
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-4.2-${{ hashFiles('.github/depends.Rds') }}
117-
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-4.2-
116+
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-devel-${{ hashFiles('.github/depends.Rds') }}
117+
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-devel-
118118

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"
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"
125125

126126
- name: Install macOS system dependencies
127127
if: matrix.config.os == 'macOS-latest'
@@ -169,35 +169,19 @@ jobs:
169169
## https://github.com/r-lib/remotes/issues/296
170170
## Ideally, all dependencies should get installed in the first pass.
171171
172-
## Set the repos source depending on the OS
173-
## Alternatively use https://storage.googleapis.com/bioconductor_docker/packages/
174-
## though based on https://bit.ly/bioc2021-package-binaries
175-
## the Azure link will be the main one going forward.
176-
gha_repos <- if(
177-
.Platform$OS.type == "unix" && Sys.info()["sysname"] != "Darwin"
178-
) c(
179-
"AnVIL" = "https://bioconductordocker.blob.core.windows.net/packages/3.16/bioc",
180-
BiocManager::repositories()
181-
) else BiocManager::repositories()
182-
183172
## For running the checks
184173
message(paste('****', Sys.time(), 'installing rcmdcheck and BiocCheck ****'))
185-
install.packages(c("rcmdcheck", "BiocCheck"), repos = gha_repos)
174+
install.packages(c("rcmdcheck", "BiocCheck"), repos = BiocManager::repositories())
186175
187176
## Pass #1 at installing dependencies
188-
## This pass uses AnVIL-powered fast binaries
189-
## details at https://github.com/nturaga/bioc2021-bioconductor-binaries
190-
## The speed gains only apply to the docker builds.
191177
message(paste('****', Sys.time(), 'pass number 1 at installing dependencies: local dependencies ****'))
192-
remotes::install_local(dependencies = TRUE, repos = gha_repos, build_vignettes = FALSE, upgrade = TRUE)
178+
remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = FALSE, upgrade = TRUE)
193179
continue-on-error: true
194180
shell: Rscript {0}
195181

196182
- name: Install dependencies pass 2
197183
run: |
198184
## Pass #2 at installing dependencies
199-
## This pass does not use AnVIL and will thus update any packages
200-
## that have seen been updated in Bioconductor
201185
message(paste('****', Sys.time(), 'pass number 2 at installing dependencies: any remaining dependencies ****'))
202186
remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = TRUE, upgrade = TRUE, force = TRUE)
203187
shell: Rscript {0}
@@ -210,15 +194,15 @@ jobs:
210194
shell: Rscript {0}
211195

212196
- name: Install covr
213-
if: github.ref == 'refs/heads/master' && env.run_covr == 'true' && runner.os == 'Linux'
197+
if: github.ref == 'refs/heads/devel' && env.run_covr == 'true' && runner.os == 'Linux'
214198
run: |
215199
remotes::install_cran("covr")
216200
shell: Rscript {0}
217201

218202
- name: Install pkgdown
219-
if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux'
203+
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux'
220204
run: |
221-
remotes::install_cran("pkgdown")
205+
remotes::install_github("r-lib/pkgdown")
222206
shell: Rscript {0}
223207

224208
- name: Session info
@@ -266,46 +250,89 @@ jobs:
266250
shell: Rscript {0}
267251

268252
- name: Test coverage
269-
if: github.ref == 'refs/heads/master' && env.run_covr == 'true' && runner.os == 'Linux'
253+
if: github.ref == 'refs/heads/devel' && env.run_covr == 'true' && runner.os == 'Linux'
270254
run: |
271-
covr::codecov()
255+
covr::codecov(coverage = covr::package_coverage(type = "all"))
272256
shell: Rscript {0}
273257

274258
- name: Install package
275-
if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux'
259+
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux'
276260
run: R CMD INSTALL .
277261

278-
- name: Build and deploy pkgdown site
279-
if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux'
280-
run: |
281-
git config --local user.name "$GITHUB_ACTOR"
282-
git config --local user.email "[email protected]"
283-
Rscript -e "pkgdown::deploy_to_branch(new_process = FALSE)"
284-
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}
285266
## Note that you need to run pkgdown::deploy_to_branch(new_process = FALSE)
286267
## at least one locally before this will work. This creates the gh-pages
287268
## branch (erasing anything you haven't version controlled!) and
288269
## makes the git history recognizable by pkgdown.
289270

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+
290284
- name: Upload check results
291285
if: failure()
292286
uses: actions/upload-artifact@master
293287
with:
294-
name: ${{ runner.os }}-biocversion-devel-r-4.2-results
288+
name: ${{ runner.os }}-biocversion-devel-r-devel-results
295289
path: check
296290

297-
## Note that DOCKER_PASSWORD is really a token for your dockerhub
298-
## account, not your actual dockerhub account password.
299-
## This comes from
300-
## https://seandavi.github.io/BuildABiocWorkshop/articles/HOWTO_BUILD_WORKSHOP.html#6-add-secrets-to-github-repo
301-
## Check https://github.com/docker/build-push-action/tree/releases/v1
302-
## for more details.
303-
- uses: docker/build-push-action@v1
304-
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
305333
with:
306-
username: ${{ secrets.DOCKER_USERNAME }}
307-
password: ${{ secrets.DOCKER_PASSWORD }}
308-
repository: sgibb/cleaver
309-
tag_with_ref: true
310-
tag_with_sha: true
311-
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)