-
Notifications
You must be signed in to change notification settings - Fork 2
/
Taskfile.yml
174 lines (156 loc) · 4.17 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
version: "3"
env:
NOT_CRAN: true
vars:
MANIFEST: src/rust/Cargo.toml
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
desc: Install R packages for development.
cmds:
- Rscript -e
'pak::repo_add(extendr = "https://extendr.r-universe.dev");
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
build-all:
desc: Build the R package, generate documents, run all tests, and update files.
deps:
- build-documents
cmds:
- task: test-all
- task: build-license-note
- task: build-readme
test-all:
desc: Run all tests.
cmds:
- task: test-source
- task: test-vignettes
test-source:
desc: Run all tests for source.
internal: true
sources:
- tests/**/*
- "{{.R_SOURCE}}"
- src/Makevars*
- "{{.MANIFEST}}"
- "{{.RUST_SOURCE}}"
cmds:
- Rscript -e 'devtools::load_all(); devtools::test()'
test-vignettes:
desc: Check if vignettes can be rendered.
internal: true
sources:
- "{{.VIGNETTES}}"
- "{{.R_SOURCE}}"
- src/Makevars*
- "{{.MANIFEST}}"
- "{{.RUST_SOURCE}}"
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-extendr-wrappers
cmds:
- Rscript -e 'devtools::document()'
build-extendr-wrappers:
internal: true
desc: Build the extendr wrappers.
sources:
- src/Makevars*
- "{{.MANIFEST}}"
- "{{.RUST_SOURCE}}"
generates:
- R/extendr-wrappers.R
status:
- Rscript -e 'if (desc::desc_get("Config/rextendr/version") < packageVersion("rextendr")) quit(status = 1)'
cmds:
- Rscript -e 'rextendr::document()'
build-license-note:
internal: true
desc: Build LICENSE.note
sources:
- src/rust/Cargo.lock
- dev/generate-license-note.R
generates:
- LICENSE.note
cmds:
- Rscript dev/generate-license-note.R
build-readme:
internal: true
desc: Build README.md
sources:
- README.Rmd
- "{{.R_SOURCE}}"
- src/Makevars*
- "{{.MANIFEST}}"
- "{{.RUST_SOURCE}}"
generates:
- README.md
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:
desc: Lint and auto-format R and Rust code.
deps:
- lint-and-format-r
- lint-and-format-rust
lint-and-format-r:
internal: true
desc: Lint and auto-format R code.
sources:
- "{{.R_SOURCE}}"
- "{{.VIGNETTES}}"
deps:
- build-extendr-wrappers
cmds:
- Rscript -e
'devtools::load_all();
lintr::lint_package();
styler::style_pkg()'
lint-and-format-rust:
internal: true
desc: Lint and auto-format Rust code.
sources:
- "{{.MANIFEST}}"
- src/rust/Cargo.lock
- "{{.RUST_SOURCE}}"
cmds:
- cargo clippy --manifest-path {{.MANIFEST}}
- cargo fmt --manifest-path {{.MANIFEST}}
release-prep:
desc: "Prepare for a release. args: VERSION: major, minor, or patch"
deps:
- build-all
- lint-and-format
cmds:
- Rscript -e '
usethis::use_version(which = "{{.VERSION}}");
usethis::use_cran_comments()'