-
Notifications
You must be signed in to change notification settings - Fork 8
238 lines (209 loc) · 7.24 KB
/
R.yml
File metadata and controls
238 lines (209 loc) · 7.24 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
name: R
on:
push:
branches: [main]
tags-ignore: ["**"]
paths:
- ".github/workflows/rchk.yml"
- ".github/workflows/R.yml"
- "r/**"
- "!r/README.md"
- 'c/Make*'
- 'c/*.mk'
- 'c/**/*.[ch]p?p?'
pull_request:
branches-ignore: [gh-pages]
paths:
- ".github/workflows/rchk.yml"
- ".github/workflows/R.yml"
- "r/**"
- "!r/README.md"
- 'c/Make*'
- 'c/*.mk'
- 'c/**/*.[ch]p?p?'
# Manual run
workflow_dispatch:
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
_R_CHECK_FORCE_SUGGESTS_: false
_R_CHECK_CRAN_INCOMING_REMOTE_: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
R-CMD-check:
if: "! contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ${{ matrix.os }}
name: Check ${{ matrix.os }} (${{ matrix.r }})
strategy:
# When set to true, GitHub cancels all in-progress jobs if any matrix job fails.
fail-fast: true
matrix:
# macos-15-intel is an intel runner, macos-14 is apple silicon
os: [ ubuntu-22.04, windows-latest, macos-15-intel, macos-14 ]
r: [ release ]
include:
- { os: windows-latest, r: '4.1' }
# Use latest ubuntu to make it easier to install dependencies
- { os: ubuntu-24.04, r: 'devel', http-user-agent: 'release' }
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
MAKEFLAGS: "-j 2"
steps:
- name: Disable autocrlf
if: runner.os == 'Windows'
run: git config --global core.autocrlf false
- uses: actions/checkout@v6
- name: Fix permissions
if: runner.os == 'Windows'
run: chmod +x r/cleanup
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r }}
http-user-agent: ${{ matrix.http-user-agent }}
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
install-pandoc: true
extra-packages: any::purrr@1.0.4, any::remotes, any::rcmdcheck, any::spelling
needs: check
working-directory: r
- name: Check (NOT CRAN)
env:
NOT_CRAN: true
uses: r-lib/actions/check-r-package@v2
with:
args: 'c("--no-manual", "--run-donttest", "--run-dontrun", "--timings")'
working-directory: r
- name: Check (as CRAN)
if: matrix.os != 'ubuntu-24.04'
env:
NOT_CRAN: false
uses: r-lib/actions/check-r-package@v2
with:
args: 'c("--no-manual", "--as-cran")'
working-directory: r
- name: Stricter CFLAGS
if: matrix.os == 'ubuntu-24.04'
run: |
mkdir -p ~/.R
echo 'CFLAGS=-g -O2 -Wall -Wstrict-prototypes -pedantic -fstack-protector-strong -DUSE_TYPE_CHECKING_STRICT -D_FORTIFY_SOURCE=3 -DSTRICT_R_HEADERS=1 -Werror' > ~/.R/Makevars
shell: bash
working-directory: r
- name: Check (as CRAN) with stricter CFLAGS and GCC 14
if: matrix.os == 'ubuntu-24.04'
env:
NOT_CRAN: false
CC: gcc-14
uses: r-lib/actions/check-r-package@v2
with:
args: 'c("--no-manual", "--as-cran")'
working-directory: r
- name: Show testthat output
if: failure()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
working-directory: r
- name: Install package
run: |
remotes::install_local(".", force = TRUE, upgrade = "never", build_manual = TRUE, build_vignettes = TRUE)
shell: Rscript {0}
working-directory: r
coverage:
needs: R-CMD-check
name: Coverage ${{ matrix.os }} (${{ matrix.r }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
r: [release]
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v6
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r }}
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
install-pandoc: true
extra-packages: any::covr any::xml2 any::rex
needs: coverage
working-directory: r
- name: Test coverage
env:
NOT_CRAN: true
run: |
exclude_pattern = rex::rex(or(group(or("#", "//"), any_spaces, "nocov"),
group(or("ASSUME", "unreachable", "assert"), maybe(" "), "("),
group(or("DEBUG1", "DEBUG2", "DEBUG3"), maybe("_PRINT")),
group(or("GCOV", "GCOVR", "LCOV"), "_EXCL_LINE")))
options(covr.gcov_additional_paths="c",
covr.filter_non_package=FALSE,
covr.exclude_pattern=exclude_pattern)
coverage <- withr::with_makevars(c(MOOCORE_DEBUG="1", LTO_OPT="-fno-lto"),
covr::package_coverage(type="all", quiet=FALSE, clean=FALSE,
commentDonttest = FALSE, commentDontrun = FALSE, flags="R",
relative_path=normalizePath(file.path(getwd(), "..")),
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
))
print(coverage)
covr::to_cobertura(coverage)
list.files("../", pattern="*.xml", recursive=TRUE)
shell: Rscript {0}
working-directory: r
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6
with:
fail_ci_if_error: true
files: ./r/cobertura.xml
verbose: true
flags: R
plugins: noop
disable_search: true
token: ${{secrets.CODECOV_TOKEN}}
pkgdown:
name: pkgdown ${{ matrix.os }} (${{ matrix.r }})
needs: R-CMD-check
permissions:
contents: write # github-pages-deploy-action
concurrency: # Recommended if you intend to make multiple deployments in quick succession.
group: web-${{ github.workflow }}-${{ github.ref }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
r: [release]
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v6
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r }}
use-public-rspm: true
- name: Install optipng
run: sudo apt-get install -y optipng
- uses: r-lib/actions/setup-r-dependencies@v2
with:
install-pandoc: true
extra-packages: any::pkgdown, local::.
needs: website
working-directory: r
- name: Build website
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE, run_dont_run = TRUE)
shell: Rscript {0}
working-directory: r
- name: Deploy 🚀
if: success() && github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: r/docs # The folder the action should deploy.
target-folder: r
single-commit: true
clean: true
rchk:
needs: pkgdown
uses: multi-objective/moocore/.github/workflows/rchk.yml@main