-
-
Notifications
You must be signed in to change notification settings - Fork 1
226 lines (192 loc) · 6.1 KB
/
ci.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
on:
push:
branches:
- main
pull_request:
branches:
- '**'
name: CI
jobs:
audit:
name: Audit
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/audit@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
licenses:
name: Licenses
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
- name: cargo-about cache
id: cargo-about-cache
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-about
key: cargo-about-${{ runner.os }}
- name: cargo-about install
if: steps.cargo-about-cache.outputs.cache-hit != 'true'
run: cargo install --locked cargo-about
- name: cargo-about generate licenses
run: cargo about generate --workspace --all-features about.hbs > doc/src/licenses.html
fmt:
name: Rustfmt
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt
- run: cargo fmt --all -- --check
docs_and_spell_check:
name: Docs and Spell Check
runs-on: ubuntu-latest
timeout-minutes: 20
env:
RUSTDOCFLAGS: "-Dwarnings"
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Check spelling
uses: crate-ci/typos@master
- run: cargo doc --no-deps
clippy:
name: Clippy
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: clippy
- name: 'Run clippy'
# we cannot use `--all-features` because `envman` has features that are mutually exclusive.
run: |
cargo clippy_cli
# Ideally we'd also run it for WASM, but:
#
# * `workspace_tests` is only coded for native targets.
# * There is little benefit running it for everything again.
#
# The command that we *would* use is:
#
# ```bash
# cargo clippy \
# --workspace \
# --target wasm32-unknown-unknown \
# --no-default-features \
# --features "error_reporting" \
# --fix \
# --exclude peace_rt_model_native \
# --exclude peace_item_spec_sh_cmd \
# --exclude peace_item_spec_sh_sync_cmd \
# --exclude peace_item_spec_tar_x \
# --exclude peace_item_specs \
# --exclude workspace_tests \
# --exclude app_cycle \
# --exclude download \
# -- -D warnings
# ```
coverage:
name: Coverage
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: llvm-tools-preview
- uses: taiki-e/install-action@cargo-llvm-cov
- uses: taiki-e/install-action@nextest
- name: 'Configure build to remove debuginfo'
run: echo $'\n[profile.dev]\ndebug = false' >> Cargo.toml
- name: 'Collect coverage'
run: ./coverage.sh
- name: 'Print directory sizes'
run: du -sh target/coverage target/llvm-cov-target
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
files: ./target/coverage/lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
build_and_test_linux:
name: Build and Test (Linux)
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@nextest
- name: 'Build and test'
run: |
for j in {0..4}; do cargo test_$j || break; done
build_and_test_windows:
name: Build and Test (Windows)
runs-on: windows-latest
timeout-minutes: 20
steps:
- name: Prepare symlink configuration
run: git config --global core.symlinks true
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@nextest
- name: 'Build and test'
run: cargo nextest run --workspace --all-features
build_examples_native:
name: Build examples (Native)
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: 'Example: download (native)'
run: cargo build --package download --all-features
- name: 'Example: envman (native)'
run: cargo build --package envman --features cli
build_examples_web:
name: Build examples (WASM, Leptos)
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: wasm32-unknown-unknown
- name: 'Install `wasm-pack`'
uses: jetli/[email protected]
with:
version: 'latest'
- name: cargo-leptos cache
id: cargo-leptos-cache
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-leptos
key: cargo-leptos-${{ runner.os }}
- name: cargo-leptos install
if: steps.cargo-leptos-cache.outputs.cache-hit != 'true'
run: cargo install --git https://github.com/leptos-rs/cargo-leptos.git --locked cargo-leptos
- name: 'Example: envman (leptos)'
run: cargo envman_build_debug
# When updating this, also update book.yml
- name: 'Example: download (WASM)'
# The following no longer works, because the AWS SDK uses tokio with UDP features enabled:
# for example in $(ls examples)
run: |
for example in download
do wasm-pack build \
--target web \
--out-dir "../../doc/src/examples/pkg" \
--release \
"examples/${example}" \
--features 'error_reporting'
done