-
Notifications
You must be signed in to change notification settings - Fork 2
/
Taskfile.yml
160 lines (143 loc) · 3.8 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
version: "3"
env:
NOT_CRAN: "true"
LIBR_POLARS_BUILD: "true"
DEBUG: "true"
vars:
REQUIRED_R_PKGS_FOR_S3_METHODS: tibble
MANIFEST: src/rust/Cargo.toml
CARGO_LOCK: src/rust/Cargo.lock
R_SOURCE: R/*
VIGNETTES: vignettes/**/*.Rmd
RUST_SOURCE: src/rust/src/**/*.rs
R_FUNC_LOAD_REQUIRED_PKGS:
strsplit("{{.REQUIRED_R_PKGS_FOR_S3_METHODS}}", ",") |>
unlist() |>
lapply(require, character.only = TRUE) |>
invisible()
# TODO: setup tools
# TODO: lint, auto format
tasks:
setup-dev:
desc: Install tools for development.
deps:
- setup-r-tools
- setup-rust-tools
setup-r-tools:
env:
PKG_SYSREQS: FALSE
desc: Install R packages for development.
cmds:
- Rscript -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch))'
- Rscript -e
'pak::repo_add("https://cloud.r-project.org/");
pak::local_install_deps(dependencies = c("all", "Config/Needs/dev", "Config/Needs/website"))'
setup-rust-tools:
desc: Install Rust tools for development.
cmds:
# TODO: check the savvy version
- cargo install savvy-cli
build-rust:
desc: Build the Rust library wrappers.
sources:
- src/Makevars*
- configure*
- "{{.MANIFEST}}"
- "{{.CARGO_LOCK}}"
- "{{.RUST_SOURCE}}"
generates:
- R/000-wrappers.R
cmds:
- savvy-cli update .
- Rscript -e 'pkgbuild::compile_dll()'
build-standalone-files:
desc: Update "standalone" R files by `usethis::use_standalone()`
ignore_error: true # GitHub API rate limit
generates:
- R/import-standalone-*.R
vars:
RLANG_STANDALONE_FILES:
- lifecycle
- s3-register
- types-check
cmds:
- for:
var: RLANG_STANDALONE_FILES
cmd: Rscript -e 'usethis::use_standalone("r-lib/rlang", "{{.ITEM}}")'
build-documents:
desc: Build the R package and generate documents.
sources:
- DESCRIPTION
- "{{.R_SOURCE}}"
generates:
- man/*.Rd
status:
- Rscript -e 'if (desc::desc_get("RoxygenNote") < packageVersion("roxygen2")) quit(status = 1)'
deps:
- build-rust
- build-standalone-files
cmds:
- Rscript -e
'{{.R_FUNC_LOAD_REQUIRED_PKGS}};
devtools::document()'
build-all:
desc: Build the R package, generate documents, run all tests, and update files.
deps:
- build-documents
cmds:
- task: test-all
- task: build-readme
test-all:
desc: Run all tests.
cmds:
- task: test-source
test-source:
desc: Run all tests for source.
internal: true
sources:
- tests/**/*
- "{{.R_SOURCE}}"
- src/Makevars*
- configure*
- "{{.MANIFEST}}"
- "{{.CARGO_LOCK}}"
- "{{.RUST_SOURCE}}"
cmds:
- Rscript -e 'devtools::test()'
build-readme:
internal: true
desc: Build README.md
sources:
- README.Rmd
- "{{.R_SOURCE}}"
- src/Makevars*
- configure*
- "{{.MANIFEST}}"
- "{{.CARGO_LOCK}}"
- "{{.RUST_SOURCE}}"
generates:
- README.md
deps:
- build-rust
cmds:
- Rscript -e
'devtools::load_all();
rmarkdown::render(input = "README.Rmd", output_file = "README.md")'
install-package:
desc: Install the R package.
sources:
- DESCRIPTION
- "{{.R_SOURCE}}"
- src/Makevars*
- configure*
- "{{.MANIFEST}}"
- "{{.CARGO_LOCK}}"
- "{{.RUST_SOURCE}}"
deps:
- build-documents
cmds:
- R CMD INSTALL --no-multiarch --with-keep.source .
test-snapshot-accept:
desc: Accept all test snapshots. (Shortcut to accept snapshots after running tests)
cmds:
- Rscript -e 'testthat::snapshot_accept()'