-
Notifications
You must be signed in to change notification settings - Fork 2
/
Taskfile.yml
232 lines (212 loc) · 5.27 KB
/
Taskfile.yml
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
version: "3"
env:
NOT_CRAN: "true"
LIBPRQLR_BUILD: "true"
PKG_SYSREQS: "false"
vars:
MANIFEST: src/rust/Cargo.toml
CARGO_LOCK: src/rust/Cargo.lock
R_SOURCE: R/*
VIGNETTES: vignettes/**/*.Rmd
RUST_SOURCE: src/rust/src/**/*.rs
tasks:
setup-dev:
desc: Install tools for development.
deps:
- install-r-tools
- install-rust-tools
install-r-tools:
internal: true
env:
PKG_SYSREQS: FALSE
desc: Install R packages for development.
cmds:
- Rscript -e
'pak::repo_add("https://cloud.r-project.org/");
pak::local_install_deps(dependencies = c("all", "Config/Needs/dev", "Config/Needs/website"))'
install-rust-tools:
internal: true
desc: Install Rust packages for development.
cmds:
- cargo install cargo-license savvy-cli
build-vendor-sources:
desc: Vendor Rust sources.
sources:
- "{{.CARGO_LOCK}}"
- dev/vendoring.R
generates:
- src/rust/vendor.tar.xz
cmds:
- Rscript dev/vendoring.R
build-lib-sums:
desc: Build lib-sums.tsv.
sources:
- dev/generate-lib-sums.R
- tools/prep-lib.R
- DESCRIPTION
- "{{.CARGO_LOCK}}"
generates:
- tools/lib-sums.tsv
cmds:
- Rscript dev/generate-lib-sums.R
build-all:
desc: Build the R package, generate documents, run all tests, and update files.
deps:
- build-lib-sums
- build-documents
cmds:
- task: lint-and-format-r
- task: test-all
- task: build-license-note
- task: build-authors
- task: build-readme
test-all:
desc: Run all tests.
cmds:
- task: test-source
- task: test-examples
- task: test-vignettes
test-source:
desc: Run all tests for source.
internal: true
sources:
- tests/**/*
- "{{.R_SOURCE}}"
- src/Makevars*
- configure*
- "{{.MANIFEST}}"
- "{{.CARGO_LOCK}}"
- "{{.RUST_SOURCE}}"
deps:
- build-wrappers
cmds:
- Rscript -e 'devtools::test()'
test-examples:
desc: Check if examples can be run.
internal: true
sources:
- "{{.R_SOURCE}}"
- src/Makevars*
- configure*
- "{{.MANIFEST}}"
- "{{.CARGO_LOCK}}"
- "{{.RUST_SOURCE}}"
deps:
- build-wrappers
cmds:
- Rscript -e 'devtools::run_examples(document = FALSE)'
test-vignettes:
desc: Check if vignettes can be rendered.
internal: true
sources:
- "{{.VIGNETTES}}"
- "{{.R_SOURCE}}"
- src/Makevars*
- configure*
- "{{.MANIFEST}}"
- "{{.CARGO_LOCK}}"
- "{{.RUST_SOURCE}}"
deps:
- build-wrappers
cmds:
- Rscript -e
'devtools::load_all();
list.files("vignettes/", pattern = r"(\.Rmd$)", recursive = TRUE, full.names = TRUE) |>
purrr::walk(\(x) rmarkdown::render(x, output_dir = tempdir()))'
build-documents:
desc: Build the R package and generate documents.
internal: true
sources:
- "{{.R_SOURCE}}"
generates:
- man/*.Rd
status:
- Rscript -e 'if (desc::desc_get("RoxygenNote") < packageVersion("roxygen2")) quit(status = 1)'
deps:
- build-wrappers
cmds:
- Rscript -e 'devtools::load_all(); devtools::document()'
build-wrappers:
internal: true
desc: Build the Rust wrappers.
sources:
- src/Makevars*
- configure*
- "{{.MANIFEST}}"
- "{{.CARGO_LOCK}}"
- "{{.RUST_SOURCE}}"
deps:
- lint-and-format-rust
- build-vendor-sources
generates:
- R/000-wrappers.R
cmds:
- savvy-cli update .
- Rscript -e 'pkgbuild::compile_dll()'
build-license-note:
internal: true
desc: Build LICENSE.note
sources:
- "{{.CARGO_LOCK}}"
- dev/generate-license-note.R
generates:
- LICENSE.note
cmds:
- Rscript dev/generate-license-note.R
build-authors:
internal: true
desc: Build inst/AUTHORS
sources:
- "{{.CARGO_LOCK}}"
- dev/generate-authors.R
generates:
- inst/AUTHORS
cmds:
- Rscript dev/generate-authors.R
build-readme:
internal: true
desc: Build README.md
sources:
- README.Rmd
- "{{.R_SOURCE}}"
- src/Makevars*
- configure*
- "{{.MANIFEST}}"
- "{{.CARGO_LOCK}}"
- "{{.RUST_SOURCE}}"
- tools/lib-sums.tsv
generates:
- README.md
deps:
- build-wrappers
cmds:
- Rscript -e
'devtools::load_all();
rmarkdown::render(input = "README.Rmd", output_file = "README.md")'
test-snapshot-accept:
desc: Accept all test snapshots. (Shortcut to accept snapshots after running tests)
cmds:
- Rscript -e 'testthat::snapshot_accept()'
lint-and-format-r:
internal: true
desc: Lint and auto-format R code.
sources:
- "{{.R_SOURCE}}"
- "{{.VIGNETTES}}"
deps:
- build-wrappers
cmds:
- Rscript -e
'devtools::load_all();
lintr::lint_package();
styler::style_pkg(exclude_files = "R/000-wrappers.R")'
lint-and-format-rust:
internal: true
desc: Lint and auto-format Rust code.
sources:
- "{{.MANIFEST}}"
- "{{.CARGO_LOCK}}"
- "{{.RUST_SOURCE}}"
cmds:
- cargo clippy --manifest-path {{.MANIFEST}}
- cargo fmt --manifest-path {{.MANIFEST}}