-
Notifications
You must be signed in to change notification settings - Fork 1
214 lines (186 loc) · 6.34 KB
/
R.yml
File metadata and controls
214 lines (186 loc) · 6.34 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
name: R
on:
push:
branches-ignore: [gh-pages]
paths:
- ".github/workflows/R.yml"
- "r/**"
pull_request:
branches-ignore: [gh-pages]
paths:
- ".github/workflows/R.yml"
- "r/**"
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:
# Use latest ubuntu to make it easier to install dependencies
- { os: ubuntu-latest, r: 'devel', http-user-agent: 'release' }
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Disable autocrlf
if: runner.os == 'Windows'
run: git config --global core.autocrlf false
- uses: actions/checkout@v4
- name: Checkout moocore
uses: actions/checkout@v4
with:
repository: multi-objective/moocore
path: moocore
- 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: moocore=local::../moocore/r, any::rcmdcheck, any::spelling, any::remotes
needs: check
working-directory: r
- name: Check (as CRAN)
env:
NOT_CRAN: false
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check", timeout = 360)
shell: Rscript {0}
working-directory: r
- name: Check (NOT CRAN)
if: success()
env:
NOT_CRAN: true
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--run-donttest", "--run-dontrun", "--timings"), error_on = "warning", check_dir = "check", timeout = 360)
shell: Rscript {0}
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
- name: Upload check results
if: failure()
uses: actions/upload-artifact@v4
with:
name: results-${{ runner.os }}-r${{ matrix.r }}
path: r/check
coverage:
needs: R-CMD-check
name: Coverage ${{ matrix.os }} (${{ matrix.r }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
r: [release]
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
steps:
- uses: actions/checkout@v4
- name: Checkout moocore
uses: actions/checkout@v4
with:
repository: multi-objective/moocore
path: moocore
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
r-version: ${{ matrix.r }}
- uses: r-lib/actions/setup-r-dependencies@v2
with:
install-pandoc: true
extra-packages: moocore=local::../moocore/r, any::covr any::xml2
needs: coverage
working-directory: r
- name: Test coverage
env:
NOT_CRAN: false
run: |
coverage <- covr::package_coverage(type="all", quiet=FALSE, clean = FALSE,
commentDonttest = FALSE, commentDontrun = FALSE, flags="R",
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@v4
with:
fail_ci_if_error: true
file: ./r/cobertura.xml
verbose: true
flags: R
plugin: noop
disable_search: true
token: ${{secrets.CODECOV_TOKEN}}
pkgdown:
needs: R-CMD-check
if: contains('
refs/heads/master
refs/heads/main
', github.ref) && github.event_name == 'push'
name: pkgdown ${{ matrix.os }} (${{ matrix.r }})
permissions:
contents: write # github-pages-deploy-action
concurrency: web # Recommended if you intend to make multiple deployments in quick succession.
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
r: [release]
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Checkout moocore
uses: actions/checkout@v4
with:
repository: multi-objective/moocore
path: moocore
- 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: moocore=local::../moocore/r, 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() && runner.os == 'Linux' && 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