Repository navigation
257 lines (240 loc) · 7.62 KB
/
Copy pathci.yml
File metadata and controls
257 lines (240 loc) · 7.62 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
name: Continuous integration
# Based on and adapted from https://github.com/bevyengine/bevy/blob/main/.github/workflows/ci.yml
on:
pull_request:
merge_group:
permissions:
actions: none
attestations: none
checks: none
contents: none
deployments: none
id-token: none
issues: none
discussions: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none
env:
CARGO_TERM_COLOR: always
# If nightly is breaking CI, modify this variable to target a specific nightly version.
NIGHTLY_TOOLCHAIN: nightly
STABLE_TOOLCHAIN: "1.99.1"
MIRIFLAGS: "-Zmiri-disable-isolation"
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: ${{github.event_name == 'pull_request'}}
jobs:
build:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
with:
submodules: "true"
- uses: actions/cache@v6
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-build-stable-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.STABLE_TOOLCHAIN }}
- name: Build & run tests
run: cargo test --workspace --lib --bins --tests --benches
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 -D warnings"
lint:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
with:
submodules: "true"
- uses: actions/cache@v6
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-ci-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.STABLE_TOOLCHAIN }}
components: rustfmt, clippy
- name: Check formatting
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --workspace --all-targets -- -Dwarnings
- name: Clippy (all features)
run: cargo clippy --workspace --all-targets --all-features -- -Dwarnings
# COMBAK: we disable miri for now because it hangs indefinitely. issue #73
# miri:
# # Explicitly use macOS 14 to take advantage of M1 chip.
# runs-on: macos-14
# timeout-minutes: 10
# steps:
# - uses: actions/checkout@v7
# with:
# submodules: "true"
# - uses: actions/cache@v6
# with:
# path: |
# ~/.cargo/bin/
# ~/.cargo/registry/index/
# ~/.cargo/registry/cache/
# ~/.cargo/git/db/
# target/
# key: ${{ runner.os }}-cargo-miri-${{ hashFiles('**/Cargo.toml') }}
# - uses: dtolnay/rust-toolchain@master
# with:
# toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
# components: miri
# - name: CI job
# run: cargo miri test
# env:
# RUSTFLAGS: -Zrandomize-layout
grammar:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
with:
submodules: "true"
- uses: actions/cache@v6
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-grammar-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.STABLE_TOOLCHAIN }}
- name: Regenerate grammar
run: cargo xtask update_grammar
- name: Check that the grammar is up-to-date
run: git diff --exit-code -- crates/wgsl-parse/src/grammar.rs
- name: Grammar info
if: failure()
run: |
echo 'The generated grammar is out of date.'
echo 'Please run `cargo xtask update_grammar` and commit the result.'
markdownlint:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- uses: DavidAnson/markdownlint-cli2-action@v25
with:
config: ".markdownlint.jsonc"
globs: "**/*.md"
toml:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
with:
submodules: "true"
- uses: tombi-toml/setup-tombi@v1.9.7
- name: Lint TOML files
run: tombi lint
- name: Check formatting of TOML files
run: tombi format --check
- name: Tombi info
if: failure()
run: |
echo 'To fix toml fmt, please run `tombi fmt`.'
echo 'You can find tombi here: http://tombi-toml.github.io/tombi/.'
echo 'Also use the `Tombi` extension.'
echo 'You can find the extension here: https://marketplace.visualstudio.com/items?itemName=tombi-toml.tombi'
typos:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- name: Check for typos
uses: crate-ci/typos@v1.51.1
- name: Typos info
if: failure()
run: |
echo 'To fix typos, please run `typos -w`'
echo 'To check for a diff, run `typos`'
echo 'You can find typos here: https://crates.io/crates/typos'
echo 'if you use VS Code, you can also install `Typos Spell Checker'
echo 'You can find the extension here: https://marketplace.visualstudio.com/items?itemName=tekumara.typos-vscode'
check-doc:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- uses: actions/cache@v6
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-check-doc-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
- name: Build doc
run: cargo doc --workspace --all-features --no-deps --document-private-items --keep-going
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 --cfg docsrs_dep"
- name: Check doc
run: cargo test --workspace --doc
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 --cfg docsrs_dep"
- name: Install cargo-deadlinks
run: cargo install --force cargo-deadlinks
- name: Checks dead links
run: cargo deadlinks
continue-on-error: true
check-unused-dependencies:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v7
with:
submodules: "true"
- name: Cache
uses: actions/cache@v6
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
# cargo-udeps requires this toolchain at runtime
- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
- name: Install cargo-udeps
uses: taiki-e/install-action@cargo-udeps
- name: Run cargo-udeps
run: cargo udeps