-
Notifications
You must be signed in to change notification settings - Fork 49
422 lines (325 loc) · 13.1 KB
/
R-CMD-check.yaml
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
#
# NOTE: This workflow is overkill for most R packages and
# check-standard.yaml is likely a better choice.
# usethis::use_github_action("check-standard") will install it.
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
merge_group:
schedule:
- cron: "10 0 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.sha }}-${{ github.base_ref || '' }}
cancel-in-progress: true
name: rcc
jobs:
rcc-smoke:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.commit.outputs.sha }}
name: "Smoke test: stock R"
# Begin custom: services
# End custom: services
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/rate-limit
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/workflows/git-identity
- uses: ./.github/workflows/custom/before-install
if: hashFiles('.github/workflows/custom/before-install/action.yml') != ''
- uses: ./.github/workflows/install
with:
token: ${{ secrets.GITHUB_TOKEN }}
install-r: false
cache-version: rcc-smoke-2
needs: check
extra-packages: any::rcmdcheck any::roxygen2 r-lib/styler
- uses: ./.github/workflows/custom/after-install
if: hashFiles('.github/workflows/custom/after-install/action.yml') != ''
- uses: ./.github/workflows/update-snapshots
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
- uses: ./.github/workflows/style
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
- uses: ./.github/workflows/roxygenize
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
- id: commit
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
uses: ./.github/workflows/commit
- uses: ./.github/workflows/check
with:
results: ${{ runner.os }}-smoke-test
# Runs in a separate workflow, because it's using dev pkgdown
# which might bring in other dev dependencies
pkgdown:
needs: rcc-smoke
runs-on: ubuntu-latest
name: "pkgdown"
# Begin custom: services
# End custom: services
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.rcc-smoke.outputs.sha }}
- uses: ./.github/workflows/rate-limit
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/workflows/git-identity
if: github.event_name == 'push'
- uses: ./.github/workflows/custom/before-install
if: hashFiles('.github/workflows/custom/before-install/action.yml') != ''
- uses: ./.github/workflows/install
with:
token: ${{ secrets.GITHUB_TOKEN }}
install-r: false
cache-version: pkgdown-1
needs: website
extra-packages: r-lib/pkgdown local::.
- uses: ./.github/workflows/custom/after-install
if: hashFiles('.github/workflows/custom/after-install/action.yml') != ''
- uses: ./.github/workflows/pkgdown-build
if: github.event_name != 'push'
- uses: ./.github/workflows/pkgdown-deploy
if: github.event_name == 'push'
# Windows checks can be run in parallel and independently
# when they alone take as long as the smoke and full tests combined.
# To achieve this, remove the "needs:" element below.
rcc-windows:
# Begin custom: early run
needs: rcc-smoke
# End custom: early run
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) ${{ matrix.config.desc }}
# Begin custom: services
# End custom: services
strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
# Use 3.6 to trigger usage of RTools35
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.rcc-smoke.outputs.sha }}
- uses: ./.github/workflows/custom/before-install
if: hashFiles('.github/workflows/custom/before-install/action.yml') != ''
- uses: ./.github/workflows/install
with:
r-version: ${{ matrix.config.r }}
cache-version: rcc-windows-1
token: ${{ secrets.GITHUB_TOKEN }}
needs: check
- uses: ./.github/workflows/custom/after-install
if: hashFiles('.github/workflows/custom/after-install/action.yml') != ''
- uses: ./.github/workflows/update-snapshots
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
- uses: ./.github/workflows/check
with:
results: ${{ runner.os }}-r${{ matrix.config.r }}
rcc-full:
needs: rcc-smoke
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) ${{ matrix.config.desc }}
# Begin custom: services
# End custom: services
strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: ubuntu-20.04, r: 'release'}
# Use older ubuntu to maximise backward compatibility
- {os: ubuntu-22.04, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-22.04, r: 'release', covr: true, desc: 'with covr'}
- {os: ubuntu-22.04, r: 'oldrel-1'}
# Begin custom: R 3.6
- {os: ubuntu-22.04, r: 'oldrel-2'}
# End custom: R 3.6
# Begin custom: R 3.5
- {os: ubuntu-22.04, r: 'oldrel-3'}
# End custom: R 3.5
# Begin custom: R 3.4
# End custom: R 3.4
# Begin custom: matrix elements
- {os: ubuntu-20.04, r: 'release', test-src: 'test-mssql', covr: false, desc: 'SQL Server without covr' }
- {os: ubuntu-22.04, r: 'release', test-src: 'test-postgres', covr: true, desc: 'Postgres with covr' }
- {os: ubuntu-22.04, r: 'release', test-src: 'test-maria', covr: true, desc: 'MariaDB with covr' }
- {os: ubuntu-22.04, r: 'release', test-src: 'test-mysql-maria', covr: true, desc: 'MySQL with covr' }
- {os: ubuntu-22.04, r: 'release', test-src: 'test-duckdb', covr: true, desc: 'DuckDB with covr' }
- {os: ubuntu-22.04, r: 'release', test-src: 'test-sqlite', covr: true, desc: 'SQLite with covr' }
# End custom: matrix elements
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.rcc-smoke.outputs.sha }}
- uses: ./.github/workflows/custom/before-install
if: hashFiles('.github/workflows/custom/before-install/action.yml') != ''
- uses: ./.github/workflows/install
with:
r-version: ${{ matrix.config.r }}
cache-version: rcc-full-1
token: ${{ secrets.GITHUB_TOKEN }}
needs: check
- uses: ./.github/workflows/custom/after-install
if: hashFiles('.github/workflows/custom/after-install/action.yml') != ''
- uses: ./.github/workflows/update-snapshots
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
- uses: ./.github/workflows/check
with:
results: ${{ runner.os }}-r${{ matrix.config.r }}
suggests-matrix:
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
name: Collect suggests deps
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/workflows/rate-limit
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: r-lib/actions/setup-r@v2
with:
install-r: false
use-public-rspm: true
- id: set-matrix
uses: ./.github/workflows/dep-matrix-suggests
check-matrix:
runs-on: ubuntu-22.04
needs: suggests-matrix
name: Check deps
if: ${{ needs.matrix.outputs.matrix != '' }}
steps:
- name: Install json2yaml
run: |
sudo npm install -g json2yaml
- name: Check matrix definition
run: |
matrix='${{ needs.matrix.outputs.matrix }}'
echo $matrix
echo $matrix | jq .
echo $matrix | json2yaml
rcc-suggests:
needs:
- suggests-matrix
- rcc-smoke
runs-on: ubuntu-22.04
name: Without ${{ matrix.package }}
if: ${{ needs.suggests-matrix.outputs.matrix != '' }}
# Begin custom: services
# End custom: services
strategy:
fail-fast: false
matrix: ${{fromJson(needs.suggests-matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/custom/before-install
if: hashFiles('.github/workflows/custom/before-install/action.yml') != ''
- uses: ./.github/workflows/install
with:
install-r: false
cache-version: rcc-dev-${{ matrix.package }}-1
needs: check
extra-packages: "any::rcmdcheck any::remotes ."
token: ${{ secrets.GITHUB_TOKEN }}
- name: Remove ${{ matrix.package }} and all strong dependencies
run: |
pkg <- "${{ matrix.package }}"
pkgs <- tools::package_dependencies(pkg, reverse = TRUE)[[1]]
installed <- rownames(utils::installed.packages())
to_remove <- c(pkg, intersect(pkgs, installed))
print(to_remove)
remove.packages(to_remove)
shell: Rscript {0}
- name: Session info
run: |
options(width = 100)
if (!requireNamespace("sessioninfo", quietly = TRUE)) install.packages("sessioninfo")
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}
- uses: ./.github/workflows/custom/after-install
if: hashFiles('.github/workflows/custom/after-install/action.yml') != ''
- name: Define _R_CHECK_FORCE_SUGGESTS_
run: |
cat('_R_CHECK_FORCE_SUGGESTS_=false\n', file = Sys.getenv("GITHUB_ENV"), append = TRUE)
shell: Rscript {0}
- name: Must allow NOTEs, even with _R_CHECK_FORCE_SUGGESTS_
run: |
if (Sys.getenv("RCMDCHECK_ERROR_ON") %in% c("", "note")) {
cat('RCMDCHECK_ERROR_ON="warning"\n', file = Sys.getenv("GITHUB_ENV"), append = TRUE)
}
shell: Rscript {0}
- name: Check env vars
run: |
print(Sys.getenv('_R_CHECK_FORCE_SUGGESTS_'))
print(Sys.getenv('RCMDCHECK_ERROR_ON'))
shell: Rscript {0}
- uses: ./.github/workflows/check
with:
results: ${{ matrix.package }}
# FIXME: integrate with dynamic matrix creation
validate:
needs:
- rcc-smoke
runs-on: ${{ matrix.config.os }}${{ matrix.config.os-version }}
name: ${{ matrix.config.os }}${{ matrix.config.os-version }} (${{ matrix.config.r }}) ${{ matrix.config.desc }}
# Begin custom: services
# End custom: services
strategy:
fail-fast: false
matrix:
config:
- { os: ubuntu-, os-version: 22.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest" }
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
# prevent rgl issues because no X11 display is available
RGL_USE_NULL: true
# Begin custom: env vars
# End custom: env vars
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/custom/before-install
if: hashFiles('.github/workflows/custom/before-install/action.yml') != ''
- uses: ./.github/workflows/install
with:
token: ${{ secrets.GITHUB_TOKEN }}
install-r: false
cache-version: rcc-smoke-1
needs: check
extra-packages: any::rcmdcheck any::roxygen2 r-lib/styler
- uses: ./.github/workflows/custom/after-install
if: hashFiles('.github/workflows/custom/after-install/action.yml') != ''
- name: Instrument R code for validation
run: |
if [ $(git status --porcelain | wc -l) -gt 0 ]; then
echo "Fatal: git working copy not clean"
fi
sed -i -r '/INSTRUMENT: validate/ s/^( +)# /\1/g' R/*
if [ $(git status --porcelain | wc -l) -eq 0 ]; then
echo "Fatal: substitution did not change anything"
fi
- name: Run tests
run: |
testthat::test_local(reporter = testthat::ProgressReporter$new(max_failures = Inf, update_interval = Inf))
shell: Rscript {0}
- name: Show test output
if: always()
run: |
find check -name '*.Rout*' -exec head -n 1000000 '{}' \; || true
shell: bash
- name: Test coverage
run: covr::codecov()
shell: Rscript {0}