Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Commit 89ebf71

Browse files
committed
add github actions
1 parent a0fc130 commit 89ebf71

File tree

3 files changed

+299
-0
lines changed

3 files changed

+299
-0
lines changed

.github/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.html
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
Thanks for submitting an issue.
11+
12+
Please add the following information to the issue
13+
14+
1. Describe the issue/bug
15+
2. Print out the input dataset immediately before the bug occurs
16+
3. Paste the code immediately leading to the bug
17+
4. Print out of the output, if any
18+
5. Print out of the complete error/warning message, if any
19+
6. sessionInfo()
20+
21+
Thanks!

.github/workflows/check-bioc.yml

Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
## Read more about GitHub actions the features of this GitHub Actions workflow
2+
## at https://lcolladotor.github.io/biocthis/articles/biocthis.html#use_bioc_github_action
3+
##
4+
## For more details, check the biocthis developer notes vignette at
5+
## https://lcolladotor.github.io/biocthis/articles/biocthis_dev_notes.html
6+
##
7+
## You can add this workflow to other packages using:
8+
## > biocthis::use_bioc_github_action()
9+
##
10+
## Using GitHub Actions exposes you to many details about how R packages are
11+
## compiled and installed in several operating system.s
12+
### If you need help, please follow the steps listed at
13+
## https://github.com/r-lib/actions#where-to-find-help
14+
##
15+
## If you found an issue specific to biocthis's GHA workflow, please report it
16+
## with the information that will make it easier for others to help you.
17+
## Thank you!
18+
19+
## Acronyms:
20+
## * GHA: GitHub Action
21+
## * OS: operating system
22+
23+
on:
24+
push:
25+
pull_request:
26+
27+
name: R-CMD-check-bioc
28+
29+
## These environment variables control whether to run GHA code later on that is
30+
## specific to testthat, covr, and pkgdown.
31+
##
32+
## If you need to clear the cache of packages, update the number inside
33+
## cache-version as discussed at https://github.com/r-lib/actions/issues/86.
34+
## Note that you can always run a GHA test without the cache by using the word
35+
## "/nocache" in the commit message.
36+
env:
37+
has_testthat: 'false'
38+
run_covr: 'false'
39+
run_pkgdown: 'true'
40+
has_RUnit: 'false'
41+
cache-version: 'cache-v1'
42+
43+
jobs:
44+
build-check:
45+
runs-on: ${{ matrix.config.os }}
46+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
47+
container: ${{ matrix.config.cont }}
48+
## Environment variables unique to this job.
49+
50+
strategy:
51+
fail-fast: false
52+
matrix:
53+
config:
54+
- { os: ubuntu-latest, r: '4.2', bioc: '3.15', cont: "bioconductor/bioconductor_docker:RELEASE_3_15", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" }
55+
- { os: macOS-latest, r: '4.2', bioc: '3.15'}
56+
- { os: windows-latest, r: '4.2', bioc: '3.15'}
57+
env:
58+
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
59+
RSPM: ${{ matrix.config.rspm }}
60+
NOT_CRAN: true
61+
TZ: UTC
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
64+
65+
steps:
66+
67+
## Set the R library to the directory matching the
68+
## R packages cache step further below when running on Docker (Linux).
69+
- name: Set R Library home on Linux
70+
if: runner.os == 'Linux'
71+
run: |
72+
mkdir /__w/_temp/Library
73+
echo ".libPaths('/__w/_temp/Library')" > ~/.Rprofile
74+
75+
## Most of these steps are the same as the ones in
76+
## https://github.com/r-lib/actions/blob/master/examples/check-standard.yaml
77+
## If they update their steps, we will also need to update ours.
78+
- name: Checkout Repository
79+
uses: actions/checkout@v2
80+
81+
## R is already included in the Bioconductor docker images
82+
- name: Setup R from r-lib
83+
if: runner.os != 'Linux'
84+
uses: r-lib/actions/setup-r@master
85+
with:
86+
r-version: ${{ matrix.config.r }}
87+
88+
## pandoc is already included in the Bioconductor docker images
89+
- name: Setup pandoc from r-lib
90+
if: runner.os != 'Linux'
91+
uses: r-lib/actions/setup-pandoc@master
92+
93+
- name: Query dependencies
94+
run: |
95+
install.packages('remotes')
96+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
97+
shell: Rscript {0}
98+
99+
- name: Cache R packages
100+
if: "!contains(github.event.head_commit.message, '/nocache') && runner.os != 'Linux'"
101+
uses: actions/cache@v2
102+
with:
103+
path: ${{ env.R_LIBS_USER }}
104+
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_15-r-4.2-${{ hashFiles('.github/depends.Rds') }}
105+
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_15-r-4.2-
106+
107+
- name: Cache R packages on Linux
108+
if: "!contains(github.event.head_commit.message, '/nocache') && runner.os == 'Linux' "
109+
uses: actions/cache@v2
110+
with:
111+
path: /home/runner/work/_temp/Library
112+
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_15-r-4.2-${{ hashFiles('.github/depends.Rds') }}
113+
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_15-r-4.2-
114+
115+
- name: Install Linux system dependencies
116+
if: runner.os == 'Linux'
117+
run: |
118+
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 = " "))')
119+
echo $sysreqs
120+
sudo -s eval "$sysreqs"
121+
122+
- name: Install macOS system dependencies
123+
if: matrix.config.os == 'macOS-latest'
124+
run: |
125+
## Enable installing XML from source if needed
126+
brew install libxml2
127+
echo "XML_CONFIG=/usr/local/opt/libxml2/bin/xml2-config" >> $GITHUB_ENV
128+
129+
## Required to install magick as noted at
130+
## https://github.com/r-lib/usethis/commit/f1f1e0d10c1ebc75fd4c18fa7e2de4551fd9978f#diff-9bfee71065492f63457918efcd912cf2
131+
brew install imagemagick@6
132+
133+
## For textshaping, required by ragg, and required by pkgdown
134+
brew install harfbuzz fribidi
135+
136+
## For installing usethis's dependency gert
137+
brew install libgit2
138+
139+
## To fix x11/cairo error with tidyHeatmap/Complexheatmap here https://github.com/stemangiola/tidybulk/runs/1388237421?check_suite_focus=true#step:14:2134
140+
## Suggested here https://stackoverflow.com/questions/63648591/how-to-install-x11-before-testing-with-github-actions-for-macos
141+
brew install --cask xquartz
142+
143+
- name: Install Windows system dependencies
144+
if: runner.os == 'Windows'
145+
run: |
146+
## Edit below if you have any Windows system dependencies
147+
shell: Rscript {0}
148+
149+
- name: Install BiocManager
150+
run: |
151+
message(paste('****', Sys.time(), 'installing BiocManager ****'))
152+
remotes::install_cran("BiocManager")
153+
shell: Rscript {0}
154+
155+
- name: Set BiocVersion
156+
run: |
157+
BiocManager::install(version = "${{ matrix.config.bioc }}", ask = FALSE)
158+
shell: Rscript {0}
159+
160+
- name: Install dependencies pass 1
161+
run: |
162+
## Try installing the package dependencies in steps. First the local
163+
## dependencies, then any remaining dependencies to avoid the
164+
## issues described at
165+
## https://stat.ethz.ch/pipermail/bioc-devel/2020-April/016675.html
166+
## https://github.com/r-lib/remotes/issues/296
167+
## Ideally, all dependencies should get installed in the first pass.
168+
169+
## Pass #1 at installing dependencies
170+
message(paste('****', Sys.time(), 'pass number 1 at installing dependencies: local dependencies ****'))
171+
remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = TRUE, upgrade = TRUE)
172+
continue-on-error: true
173+
shell: Rscript {0}
174+
175+
- name: Install dependencies pass 2
176+
run: |
177+
## Pass #2 at installing dependencies
178+
message(paste('****', Sys.time(), 'pass number 2 at installing dependencies: any remaining dependencies ****'))
179+
remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = TRUE, upgrade = TRUE)
180+
181+
## For running the checks
182+
message(paste('****', Sys.time(), 'installing rcmdcheck and BiocCheck ****'))
183+
remotes::install_cran("rcmdcheck")
184+
BiocManager::install("BiocCheck")
185+
shell: Rscript {0}
186+
187+
- name: Install BiocGenerics
188+
if: env.has_RUnit == 'true'
189+
run: |
190+
## Install BiocGenerics
191+
BiocManager::install("BiocGenerics")
192+
shell: Rscript {0}
193+
194+
- name: Install covr
195+
if: github.ref == 'refs/heads/master' && env.run_covr == 'true' && runner.os == 'Linux'
196+
run: |
197+
remotes::install_cran("covr")
198+
shell: Rscript {0}
199+
200+
- name: Install pkgdown
201+
if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux'
202+
run: |
203+
remotes::install_cran("pkgdown")
204+
shell: Rscript {0}
205+
206+
- name: Session info
207+
run: |
208+
options(width = 100)
209+
pkgs <- installed.packages()[, "Package"]
210+
sessioninfo::session_info(pkgs, include_base = TRUE)
211+
shell: Rscript {0}
212+
213+
- name: Run CMD check
214+
env:
215+
_R_CHECK_CRAN_INCOMING_: false
216+
run: |
217+
rcmdcheck::rcmdcheck(
218+
args = c("--no-build-vignettes", "--no-manual", "--timings"),
219+
build_args = c("--no-manual", "--no-resave-data"),
220+
error_on = "warning",
221+
check_dir = "check"
222+
)
223+
shell: Rscript {0}
224+
225+
## Might need an to add this to the if: && runner.os == 'Linux'
226+
- name: Reveal testthat details
227+
if: env.has_testthat == 'true'
228+
run: find . -name testthat.Rout -exec cat '{}' ';'
229+
230+
- name: Run RUnit tests
231+
if: env.has_RUnit == 'true'
232+
run: |
233+
BiocGenerics:::testPackage()
234+
shell: Rscript {0}
235+
236+
- name: Run BiocCheck
237+
run: |
238+
BiocCheck::BiocCheck(
239+
dir('check', 'tar.gz$', full.names = TRUE),
240+
`quit-with-status` = TRUE,
241+
`no-check-R-ver` = TRUE,
242+
`no-check-bioc-help` = TRUE
243+
)
244+
shell: Rscript {0}
245+
246+
- name: Test coverage
247+
if: github.ref == 'refs/heads/master' && env.run_covr == 'true' && runner.os == 'Linux'
248+
run: |
249+
covr::codecov()
250+
shell: Rscript {0}
251+
252+
- name: Install package
253+
if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux'
254+
run: R CMD INSTALL .
255+
256+
- name: Deploy package
257+
if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux'
258+
run: |
259+
## Temporary workaround for https://github.com/actions/checkout/issues/766
260+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
261+
262+
git config --local user.email "[email protected]"
263+
git config --local user.name "GitHub Actions"
264+
Rscript -e "pkgdown::deploy_to_branch(new_process = FALSE)"
265+
shell: bash {0}
266+
## Note that you need to run pkgdown::deploy_to_branch(new_process = FALSE)
267+
## at least one locally before this will work. This creates the gh-pages
268+
## branch (erasing anything you haven't version controlled!) and
269+
## makes the git history recognizable by pkgdown.
270+
271+
- name: Upload check results
272+
if: failure()
273+
uses: actions/upload-artifact@master
274+
with:
275+
name: ${{ runner.os }}-biocversion-RELEASE_3_15-r-4.2-results
276+
path: check
277+

0 commit comments

Comments
 (0)