-
Notifications
You must be signed in to change notification settings - Fork 6
355 lines (309 loc) · 11.2 KB
/
R-CMD-check.yml
File metadata and controls
355 lines (309 loc) · 11.2 KB
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
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
on:
schedule:
- cron: "24 06 * * 1"
workflow_dispatch:
push:
branches: ["*"]
paths-ignore:
- "Meta**"
- "memcheck**"
- "docs**"
- "**.git"
- "**.json"
- "**.md"
- "**.yaml"
- "**.yml"
- "!**R-CMD-check.yml"
- "**.R[dD]ata"
- "**.Rpro*"
pull_request:
branches: ["*"]
paths-ignore:
- "Meta**"
- "memcheck**"
- "docs**"
- "**.git"
- "**.json"
- "**.md"
- "**.yaml"
- "**.yml"
- "!**R-CMD-check.yml"
- "**.R[dD]ata"
- "**.Rpro*"
name: R-CMD-check
jobs:
check-release:
runs-on: ubuntu-24.04
name: ubuntu-24.04 (release)
env:
_R_CHECK_CRAN_INCOMING_: true # Seemingly not set by --as-cran
_R_CHECK_FORCE_SUGGESTS_: false # CRAN settings
R_COMPILE_AND_INSTALL_PACKAGES: 'never'
_R_CHECK_THINGS_IN_CHECK_DIR_: false
R_REMOTES_STANDALONE: true
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: "https://packagemanager.posit.co/cran/__linux__/noble/latest"
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout git repo
uses: actions/checkout@v6
- name: Temporarily bump package version
run: |
old_version=$(grep "Version:" DESCRIPTION | awk '{print $2}')
if [[ $(echo "$old_version" | tr -cd '.' | wc -c) -eq 2 ]]; then
new_version="${old_version}.8888"
if [[ "$RUNNER_OS" == "macOS" ]]; then
sed -i "" "s/Version: .*/Version: ${new_version}/" DESCRIPTION
else
sed -i "s/Version: .*/Version: ${new_version}/" DESCRIPTION
fi
fi
shell: bash
- name: Set up R
uses: r-lib/actions/setup-r@v2
- name: Set up R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: 2-${{ runner.arch }}
extra-packages: |
ms609/TreeDistData
needs: |
check
- name: Check package
uses: r-lib/actions/check-r-package@v2
check-all:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: "release"}
- {os: macos-15-intel, r: "release"} # Until Intel architecture retired 2027-11
- {os: macOS-latest, r: "release"}
- {os: ubuntu-22.04, r: '4.1', rspm: "https://packagemanager.posit.co/cran/__linux__/jammy/latest"}
- {os: ubuntu-24.04-arm, r: "release", rspm: "https://packagemanager.posit.co/cran/__linux__/noble/latest"}
- {os: ubuntu-24.04, r: "devel", rspm: "https://packagemanager.posit.co/cran/__linux__/noble/latest"}
env:
_R_CHECK_CRAN_INCOMING_: ${{ github.event_name == 'pull_request' }}
_R_CHECK_FORCE_SUGGESTS_: false # CRAN settings
R_COMPILE_AND_INSTALL_PACKAGES: 'never'
_R_CHECK_THINGS_IN_CHECK_DIR_: false
R_REMOTES_STANDALONE: true
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
R_REALLY_FORCE_SYMBOLS: true # Until R4.3
RSPM: ${{ matrix.config.rspm }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout git repo
uses: actions/checkout@v6
- name: Temporarily bump package version
run: |
old_version=$(grep "Version:" DESCRIPTION | awk '{print $2}')
if [[ $(echo "$old_version" | tr -cd '.' | wc -c) -eq 2 ]]; then
new_version="${old_version}.8888"
if [[ "$RUNNER_OS" == "macOS" ]]; then
sed -i "" "s/Version: .*/Version: ${new_version}/" DESCRIPTION
else
sed -i "s/Version: .*/Version: ${new_version}/" DESCRIPTION
fi
fi
shell: bash
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
extra-repositories: https://ms609.github.io/packages/
- name: Set up R dependencies (Windows)
if: runner.os == 'Windows'
uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: 2-${{ runner.arch }}
extra-packages: |
ms609/TreeDistData
needs: |
check
coverage
- name: Set up R dependencies (Non-Windows)
if: runner.os != 'Windows'
uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: 2-${{ runner.arch }}
extra-packages: |
ms609/TreeDistData
phangorn=?ignore-before-r=4.4.0
ggplot2=?ignore-before-r=4.4.0
hypervolume=?ignore-before-r=4.4.0
kdensity=?ignore-before-r=4.4.0
Rogue=?ignore-before-r=4.4.0
TreeSearch=?ignore-before-r=4.4.0
Umatrix=?ignore-before-r=4.4.0
uwot=?ignore-before-r=4.4.0
needs: |
check
- name: Check package
uses: r-lib/actions/check-r-package@v2
- name: Code coverage
if: runner.os == 'Windows'
run: covr::codecov()
shell: Rscript {0}
- name: Notify on failure
if: failure() && github.event_name == 'schedule'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue_number = 164;
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
per_page: 3
});
const oneHourAgo = new Date(Date.now() - 60 * 60 * 1000);
const recentFailureNotified = comments.some(comment =>
new Date(comment.created_at) > oneHourAgo &&
comment.body.includes('Scheduled workflow has failed')
);
if (recentFailureNotified) {
console.log("Recently notified; don't bombard");
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: 'Scheduled workflow has failed: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
});
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
state: 'open'
});
}
rev-dep-check:
runs-on: ubuntu-latest
needs: check-release
name: revdepcheck
env:
R_COMPILE_AND_INSTALL_PACKAGES: 'never'
R_REMOTES_STANDALONE: true
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: ms609/actions/revdepcheck@main
with:
deps: ${{ matrix.config.deps }}
extra-packages: ms609/TreeDistData
benchmark:
runs-on: ubuntu-latest
needs: check-release
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
name: benchmark
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
RSPM: "https://packagemanager.posit.co/cran/__linux__/noble/latest"
_R_CHECK_BUILD_VIGNETTES_: false
_R_CHECK_CRAN_INCOMING_: false
_R_CHECK_FORCE_SUGGESTS_: false
R_REMOTES_STANDALONE: true
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
R_REALLY_FORCE_SYMBOLS: true
PKG_CXXFLAGS: "-O3"
steps:
- name: Checkout PR branch
uses: actions/checkout@v6
with:
path: pr
- name: Checkout target branch
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.base.ref || 'main' }}
path: main
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
extra-repositories: https://ms609.github.io/packages/
- name: Install R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
dependencies: '"hard"'
extra-packages: |
github::ms609/TreeTools
needs: benchmark
- name: Benchmark PR
uses: ms609/actions/benchmark-step@main
with:
path: pr
output: pr
- name: Benchmark target
uses: ms609/actions/benchmark-step@main
with:
path: main
output: main
- name: Benchmark PR again
uses: ms609/actions/benchmark-step@main
with:
path: pr
output: pr2
- run: dir pr-benchmark-results
working-directory: pr
- run: dir main-benchmark-results
working-directory: pr
- name: Compare benchmarks
id: compare_results
working-directory: pr
run: |
Rscript benchmark/_compare_results.R
shell: bash
- name: Upload PR benchmark results
if: failure()
uses: actions/upload-artifact@v6
with:
name: pr-benchmark-results
path: pr/pr-benchmark-results/*.bench.Rds
- name: Upload main benchmark results
if: failure()
uses: actions/upload-artifact@v6
with:
name: main-benchmark-results
path: pr/main-benchmark-results/*.bench.Rds
- name: Comment on PR
if: always() && github.event_name == 'pull_request' && steps.compare_results.outputs.report != ''
uses: actions/github-script@v7
env:
BENCHMARK_MESSAGE: ${{ steps.compare_results.outputs.report }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const benchmarkIdentifier = '<!-- benchmark-comment -->';
const outdatedPrefix = '> **⚠️ This benchmark result is outdated. See the latest comment below.**\n\n';
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});
const previousBenchmarkComments = comments.data.filter(comment =>
comment.user.type === 'Bot' &&
comment.body.includes(benchmarkIdentifier) &&
!comment.body.startsWith('> **⚠️ This benchmark result is outdated.')
);
for (const comment of previousBenchmarkComments) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id,
body: outdatedPrefix + comment.body
});
}
const newCommentBody = benchmarkIdentifier + '\n' + process.env.BENCHMARK_MESSAGE;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: newCommentBody
});