Browse code

Update check-bioc.yml

Gavin Rhys Lloyd authored on 06/02/2023 14:05:47
Showing 1 changed files

... ...
@@ -38,8 +38,8 @@ env:
38 38
   run_covr: 'true'
39 39
   run_pkgdown: 'false'
40 40
   has_RUnit: 'false'
41
-  cache-version: 'cache-v5'
42
-
41
+  cache-version: 'cache-v1'
42
+  run_docker: 'false'
43 43
 
44 44
 jobs:
45 45
   build-check:
... ...
@@ -52,9 +52,11 @@ jobs:
52 52
       fail-fast: false
53 53
       matrix:
54 54
         config:
55
-          - { os: ubuntu-latest, r: 'devel', bioc: '3.15', cont: "bioconductor/bioconductor_docker:devel", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" }
56
-          - { os: macOS-latest, r: 'devel', bioc: 'devel'}
57
-          - { os: windows-latest, r: 'devel', bioc: 'devel'}
55
+          - { os: ubuntu-latest, r: '4.2', bioc: '3.16', cont: "bioconductor/bioconductor_docker:RELEASE_3_16", 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/master/examples
59
+          ## for examples using the http-user-agent
58 60
     env:
59 61
       R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
60 62
       RSPM: ${{ matrix.config.rspm }}
... ...
@@ -77,19 +79,20 @@ jobs:
77 79
       ## https://github.com/r-lib/actions/blob/master/examples/check-standard.yaml
78 80
       ## If they update their steps, we will also need to update ours.
79 81
       - name: Checkout Repository
80
-        uses: actions/checkout@v2
82
+        uses: actions/checkout@v3
81 83
 
82 84
       ## R is already included in the Bioconductor docker images
83 85
       - name: Setup R from r-lib
84 86
         if: runner.os != 'Linux'
85
-        uses: r-lib/actions/setup-r@master
87
+        uses: r-lib/actions/setup-r@v2
86 88
         with:
87 89
           r-version: ${{ matrix.config.r }}
90
+          http-user-agent: ${{ matrix.config.http-user-agent }}
88 91
 
89 92
       ## pandoc is already included in the Bioconductor docker images
90 93
       - name: Setup pandoc from r-lib
91 94
         if: runner.os != 'Linux'
92
-        uses: r-lib/actions/setup-pandoc@master
95
+        uses: r-lib/actions/setup-pandoc@v2
93 96
 
94 97
       - name: Query dependencies
95 98
         run: |
... ...
@@ -97,21 +100,21 @@ jobs:
97 100
           saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
98 101
         shell: Rscript {0}
99 102
 
100
-      - name: Cache R packages
103
+      - name: Restore R package cache
101 104
         if: "!contains(github.event.head_commit.message, '/nocache') && runner.os != 'Linux'"
102
-        uses: actions/cache@v2
105
+        uses: actions/cache@v3
103 106
         with:
104 107
           path: ${{ env.R_LIBS_USER }}
105
-          key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-devel-${{ hashFiles('.github/depends.Rds') }}
106
-          restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-devel-
108
+          key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_16-r-4.2-${{ hashFiles('.github/depends.Rds') }}
109
+          restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_16-r-4.2-
107 110
 
108 111
       - name: Cache R packages on Linux
109 112
         if: "!contains(github.event.head_commit.message, '/nocache') && runner.os == 'Linux' "
110
-        uses: actions/cache@v2
113
+        uses: actions/cache@v3
111 114
         with:
112 115
           path: /home/runner/work/_temp/Library
113
-          key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-devel-${{ hashFiles('.github/depends.Rds') }}
114
-          restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-devel-r-devel-
116
+          key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_16-r-4.2-${{ hashFiles('.github/depends.Rds') }}
117
+          restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_16-r-4.2-
115 118
 
116 119
       - name: Install Linux system dependencies
117 120
         if: runner.os == 'Linux'
... ...
@@ -137,6 +140,9 @@ jobs:
137 140
           ## For installing usethis's dependency gert
138 141
           brew install libgit2
139 142
 
143
+          ## Required for tcltk
144
+          brew install xquartz --cask
145
+
140 146
       - name: Install Windows system dependencies
141 147
         if: runner.os == 'Windows'
142 148
         run: |
... ...
@@ -151,7 +157,7 @@ jobs:
151 157
 
152 158
       - name: Set BiocVersion
153 159
         run: |
154
-          BiocManager::install(version = "${{ matrix.config.bioc }}", ask = FALSE)
160
+          BiocManager::install(version = "${{ matrix.config.bioc }}", ask = FALSE, force = TRUE)
155 161
         shell: Rscript {0}
156 162
 
157 163
       - name: Install dependencies pass 1
... ...
@@ -163,22 +169,37 @@ jobs:
163 169
           ## https://github.com/r-lib/remotes/issues/296
164 170
           ## Ideally, all dependencies should get installed in the first pass.
165 171
 
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
+
183
+          ## For running the checks
184
+          message(paste('****', Sys.time(), 'installing rcmdcheck and BiocCheck ****'))
185
+          install.packages(c("rcmdcheck", "BiocCheck"), repos = gha_repos)
186
+
166 187
           ## 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.
167 191
           message(paste('****', Sys.time(), 'pass number 1 at installing dependencies: local dependencies ****'))
168
-          remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = TRUE, upgrade = TRUE)
192
+          remotes::install_local(dependencies = TRUE, repos = gha_repos, build_vignettes = FALSE, upgrade = TRUE)
169 193
         continue-on-error: true
170 194
         shell: Rscript {0}
171 195
 
172 196
       - name: Install dependencies pass 2
173 197
         run: |
174 198
           ## 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
175 201
           message(paste('****', Sys.time(), 'pass number 2 at installing dependencies: any remaining dependencies ****'))
176
-          remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = TRUE, upgrade = TRUE)
177
-
178
-          ## For running the checks
179
-          message(paste('****', Sys.time(), 'installing rcmdcheck and BiocCheck ****'))
180
-          remotes::install_cran("rcmdcheck")
181
-          BiocManager::install("BiocCheck")
202
+          remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = TRUE, upgrade = TRUE, force = TRUE)
182 203
         shell: Rscript {0}
183 204
 
184 205
       - name: Install BiocGenerics
... ...
@@ -197,7 +218,7 @@ jobs:
197 218
       - name: Install pkgdown
198 219
         if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux'
199 220
         run: |
200
-          remotes::install_github("r-lib/pkgdown")
221
+          remotes::install_cran("pkgdown")
201 222
         shell: Rscript {0}
202 223
 
203 224
       - name: Session info
... ...
@@ -210,10 +231,12 @@ jobs:
210 231
       - name: Run CMD check
211 232
         env:
212 233
           _R_CHECK_CRAN_INCOMING_: false
234
+          DISPLAY: 99.0
213 235
         run: |
236
+          options(crayon.enabled = TRUE)
214 237
           rcmdcheck::rcmdcheck(
215
-              args = c("--no-build-vignettes", "--no-manual", "--timings"),
216
-              build_args = c("--no-manual", "--no-resave-data"),
238
+              args = c("--no-manual", "--no-vignettes", "--timings"),
239
+              build_args = c("--no-manual", "--keep-empty-dirs", "--no-resave-data"),
217 240
               error_on = "warning",
218 241
               check_dir = "check"
219 242
           )
... ...
@@ -231,14 +254,14 @@ jobs:
231 254
         shell: Rscript {0}
232 255
 
233 256
       - name: Run BiocCheck
257
+        env:
258
+          DISPLAY: 99.0
234 259
         run: |
235 260
           BiocCheck::BiocCheck(
236 261
               dir('check', 'tar.gz$', full.names = TRUE),
237 262
               `quit-with-status` = TRUE,
238 263
               `no-check-R-ver` = TRUE,
239
-              `no-check-bioc-help` = TRUE,
240
-              `no-check-pkg-size` = TRUE,
241
-              `no-check-file-size` = TRUE
264
+              `no-check-bioc-help` = TRUE
242 265
           )
243 266
         shell: Rscript {0}
244 267
 
... ...
@@ -252,21 +275,47 @@ jobs:
252 275
         if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux'
253 276
         run: R CMD INSTALL .
254 277
 
255
-      - name: Deploy package
278
+      - name: Build pkgdown site
256 279
         if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux'
257
-        run: |
258
-          git config --local user.email "[email protected]"
259
-          git config --local user.name "GitHub Actions"
260
-          Rscript -e "pkgdown::deploy_to_branch(new_process = FALSE)"
261
-        shell: bash {0}
280
+        run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
281
+        shell: Rscript {0}
262 282
         ## Note that you need to run pkgdown::deploy_to_branch(new_process = FALSE)
263 283
         ## at least one locally before this will work. This creates the gh-pages
264 284
         ## branch (erasing anything you haven't version controlled!) and
265 285
         ## makes the git history recognizable by pkgdown.
266 286
 
287
+      - name: Install deploy dependencies
288
+        if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux'
289
+        run: |
290
+          apt-get update && apt-get -y install rsync
291
+
292
+      - name: Deploy pkgdown site to GitHub pages 🚀
293
+        if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux'
294
+        uses: JamesIves/github-pages-deploy-action@releases/v4
295
+        with:
296
+          clean: false
297
+          branch: gh-pages
298
+          folder: docs
299
+
267 300
       - name: Upload check results
268 301
         if: failure()
269 302
         uses: actions/upload-artifact@master
270 303
         with:
271
-          name: ${{ runner.os }}-biocversion-devel-r-devel-results
304
+          name: ${{ runner.os }}-biocversion-RELEASE_3_16-r-4.2-results
272 305
           path: check
306
+
307
+        ## Note that DOCKER_PASSWORD is really a token for your dockerhub
308
+        ## account, not your actual dockerhub account password.
309
+        ## This comes from
310
+        ## https://seandavi.github.io/BuildABiocWorkshop/articles/HOWTO_BUILD_WORKSHOP.html#6-add-secrets-to-github-repo
311
+        ## Check https://github.com/docker/build-push-action/tree/releases/v1
312
+        ## for more details.
313
+      - uses: docker/build-push-action@v1
314
+        if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && runner.os == 'Linux' "
315
+        with:
316
+          username: ${{ secrets.DOCKER_USERNAME }}
317
+          password: ${{ secrets.DOCKER_PASSWORD }}
318
+          repository: computational-metabolomics/structtoolbox
319
+          tag_with_ref: true
320
+          tag_with_sha: true
321
+          tags: latest