-
Notifications
You must be signed in to change notification settings - Fork 0
245 lines (222 loc) · 10.5 KB
/
selfTest.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
## Read more about GitHub actions the features of this GitHub Actions workflow
## at https://lcolladotor.github.io/biocthis/articles/biocthis.html#use_bioc_github_action
##
## For more details, check the biocthis developer notes vignette at
## https://lcolladotor.github.io/biocthis/articles/biocthis_dev_notes.html
##
## You can add this workflow to other packages using:
## > biocthis::use_bioc_github_action()
## or
## > usethis::use_github_action("check-bioc", "https://bit.ly/biocthis_gha", "check-bioc.yml")
## without having to install biocthis.
##
## Using GitHub Actions exposes you to many details about how R packages are
## compiled and installed in several operating system.s
### If you need help, please follow the steps listed at
## https://github.com/r-lib/actions#where-to-find-help
##
## If you found an issue specific to biocthis's GHA workflow, please report it
## with the information that will make it easier for others to help you.
## Thank you!
## Acronyms:
## * GHA: GitHub Action
## * OS: operating system
## Specify which branches you want this GHA to run on.
## Bioconductor uses branches such as master (bioc-devel) and RELEASE_* like
## RELEASE_3_10. For more details check
## http://bioconductor.org/developers/how-to/git/
on:
push:
branches:
- master
- 'RELEASE_*'
pull_request:
branches:
- master
- 'RELEASE_*'
name: R-CMD-check-bioc
## These environment variables control whether to run GHA code later on that is
## specific to testthat, covr, and pkgdown.
##
## If you need to clear the cache of packages, update the number inside
## cache-version as discussed at https://github.com/r-lib/actions/issues/86.
## Note that you can always run a GHA test without the cache by using the word
## "/nocache" in the commit message.
env:
has_testthat: 'true'
run_covr: 'true'
run_pkgdown: 'true'
cache-version: 'cache-v1'
jobs:
## This first job uses the GitHub repository branch name to infer what
## version of Bioconductor we will be working on.
define-docker-info:
runs-on: ubuntu-latest
outputs:
imagename: ${{ steps.findinfo.outputs.imagename }}
biocversion: ${{ steps.findinfo.outputs.biocversion }}
steps:
- id: findinfo
run: |
## Find what Bioconductor RELEASE branch we are working on
## otherwise, assume we are working on bioc-devel.
if echo "$GITHUB_REF" | grep -q "RELEASE_"; then
biocversion="$(basename -- $GITHUB_REF | tr '[:upper:]' '[:lower:]')"
else
biocversion="RELEASE_3_11"
fi
## Define the image name and print the information
imagename="bioconductor/bioconductor_docker:${biocversion}"
echo $imagename
echo $biocversion
## Save the information for the next job
echo "::set-output name=imagename::${imagename}"
echo "::set-output name=biocversion::${biocversion}"
R-CMD-check-bioc:
## This job then checks the R package using the Bioconductor docker that
## was defined by the previous job. This job will determine what version of
## R to use for the macOS and Windows builds on the next job.
runs-on: ubuntu-latest
needs: define-docker-info
## Name shown on the GHA log
name: ubuntu-latest (r-biocdocker bioc-${{ needs.define-docker-info.outputs.biocversion }})
## Information used by the next job that will run on macOS and Windows
outputs:
rversion: ${{ steps.findrversion.outputs.rversion }}
biocversionnum: ${{ steps.findrversion.outputs.biocversionnum }}
## Environment variables unique to this job.
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
TZ: UTC
NOT_CRAN: true
GITHUB_TOKEN: ${{ secrets.GHTOKEN2 }}
GITHUB_PAT: ${{ secrets.GHTOKEN2 }}
## The docker container to use. Note that we link a directory on the GHA
## runner to a docker directory, such that we can then cache the linked
## directory. This directory will contain the R packages used.
container:
image: ${{ needs.define-docker-info.outputs.imagename }}
volumes:
- /home/runner/work/_temp/Library:/usr/local/lib/R/host-site-library
steps:
- name: Install Git
run: |
sudo apt-get update -y
sudo apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip -y
wget https://github.com/git/git/archive/v2.26.2.zip -O git.zip
unzip git.zip
cd git-*
make prefix=/usr all
sudo make prefix=/usr install
cd -
git --version
shell: bash {0}
- name: Install GLPK
run: |
sudo apt-get update -y
sudo apt-get install -y glpk-utils
shell: bash {0}
## Related to https://github.com/actions/checkout/issues/238
## https://www.digitalocean.com/community/tutorials/how-to-install-git-on-ubuntu-18-04
## Most of these steps are the same as the ones in
## https://github.com/r-lib/actions/blob/master/examples/check-standard.yaml
## If they update their steps, we will also need to update ours.
- uses: actions/checkout@v2
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps("MyCoursePackage/",dependencies = TRUE), ".github/depends.Rds", version = 2)
message(paste('****', Sys.time(), 'installing BiocManager ****'))
remotes::install_cran("BiocManager")
shell: Rscript {0}
## Find the corresponding R version based on the Bioconductor version
## to use for the macOS and Windows checks by the next GHA job
- id: findrversion
name: Find Bioc and R versions
run: |
## Find what branch we are working on
if echo "$GITHUB_REF" | grep -q "master"; then
biocversion="devel"
elif echo "$GITHUB_REF" | grep -q "RELEASE_"; then
biocversion="release"
fi
## Define the R and Bioconductor version numbers
biocversionnum=$(Rscript -e "info <- BiocManager:::.version_map_get_online('https://bioconductor.org/config.yaml'); res <- subset(info, BiocStatus == '${biocversion}')[, 'Bioc']; cat(as.character(res))")
rversion=$(Rscript -e "info <- BiocManager:::.version_map_get_online('https://bioconductor.org/config.yaml'); res <- subset(info, BiocStatus == '${biocversion}')[, 'R']; cat(as.character(res))")
## Print the results
echo $biocversion
echo $biocversionnum
echo $rversion
## Save the info for the next job
echo "::set-output name=rversion::${rversion}"
echo "::set-output name=biocversionnum::${biocversionnum}"
shell:
bash {0}
- name: Cache R packages
if: "!contains(github.event.head_commit.message, '/nocache')"
uses: actions/cache@v1
with:
path: /home/runner/work/_temp/Library
key: ${{ env.cache-version }}-${{ runner.os }}-biocdocker-biocbranch-${{ needs.define-docker-info.outputs.biocversion }}-r-${{ steps.findrversion.outputs.rversion }}-bioc-${{ steps.findrversion.outputs.biocversionnum }}-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocdocker-biocbranch-${{ needs.define-docker-info.outputs.biocversion }}-r-${{ steps.findrversion.outputs.rversion }}-bioc-${{ steps.findrversion.outputs.biocversionnum }}-
- name: Install dependencies
run: |
## Try installing the package dependencies in steps. First the local
## dependencies, then any remaining dependencies to avoid the
## issues described at
## https://stat.ethz.ch/pipermail/bioc-devel/2020-April/016675.html
## https://github.com/r-lib/remotes/issues/296
## Ideally, all dependencies should get installed in the first pass.
## Pass #1 at installing dependencies
message(paste('****', Sys.time(), 'pass number 1 at installing dependencies: local dependencies ****'))
local_deps <- remotes::local_package_deps("MyCoursePackage/",dependencies = TRUE)
deps <- remotes::dev_package_deps("MyCoursePackage/",dependencies = TRUE, repos = BiocManager::repositories())
BiocManager::install(local_deps[local_deps %in% deps$package[deps$diff != 0]])
## Pass #2 at installing dependencies
message(paste('****', Sys.time(), 'pass number 2 at installing dependencies: any remaining dependencies ****'))
deps <- remotes::dev_package_deps("MyCoursePackage/",dependencies = TRUE, repos = BiocManager::repositories())
BiocManager::install(deps$package[deps$diff != 0])
## For running the checks
message(paste('****', Sys.time(), 'installing rcmdcheck and BiocCheck ****'))
remotes::install_cran("rcmdcheck")
BiocManager::install("BiocCheck")
BiocManager::install("rmarkdown")
BiocManager::install("RockefellerUniversity/compileCourses",subdir="compileCourses")
BiocManager::install("RockefellerUniversity/Herper")
BiocManager::install("BSgenome")
BiocManager::install("BSgenome.Mmusculus.UCSC.mm10")
shell: Rscript {0}
- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}
- name: Install package
if: github.ref == 'refs/heads/master'
run: R CMD INSTALL ./MyCoursePackage/
- name: Session info
run: |
require(compileCourses)
compileCourses::compileSingleCourseMaterial(repo="RockefellerUniversity",subdir="MyCoursePackage",branch="master")
shell: Rscript {0}
- name: Move to docs
run: |
mkdir -p docs
rm -r r_course/*/*/*_cache
cp -r r_course/* docs/
echo "Copied to docs"
shell:
bash {0}
- name: commit
run: |
git config --global user.email "[email protected]"
git add docs/\* r_course/\*
git commit -m 'Autobuild'
git push origin HEAD:refs/heads/master
- name: Upload check results
if: failure()
uses: actions/upload-artifact@master
with:
name: ${{ runner.os }}-biocdocker-biocbranch-${{ needs.define-docker-info.outputs.biocversion }}-r-${{ steps.findrversion.outputs.rversion }}-bioc-${{ steps.findrversion.outputs.biocversionnum }}-results
path: check