Skip to content

Commit 4bebad7

Browse files
authored
Improve CI (#3453)
1 parent 49cfc88 commit 4bebad7

File tree

4 files changed

+72
-111
lines changed

4 files changed

+72
-111
lines changed

.github/workflows/ci.yml

Lines changed: 30 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ on:
88
merge_group:
99

1010
env:
11-
RUST_BACKTRACE: 1
12-
RUST_VERSION: 1.64
11+
CARGO_INCREMENTAL: false
12+
CARGO_TERM_COLOR: always
13+
RUST_BACKTRACE: full
14+
MSRV: 1.64
1315
PKG_CONFIG_ALLOW_CROSS: 1 # allow android to work
1416
RUSTFLAGS: --cfg=web_sys_unstable_apis -D warnings
1517
RUSTDOCFLAGS: -Dwarnings
@@ -92,22 +94,17 @@ jobs:
9294
- name: checkout repo
9395
uses: actions/checkout@v3
9496

95-
- name: install rust ${{ env.RUST_VERSION }}
96-
uses: actions-rs/toolchain@v1
97-
with:
98-
toolchain: ${{ env.RUST_VERSION }}
99-
target: ${{ matrix.target }}
100-
profile: minimal
101-
override: true
102-
components: clippy
97+
- name: Install MSRV toolchain
98+
run: |
99+
rustup toolchain install ${{ env.MSRV }} --no-self-update --profile=minimal --component clippy --target ${{ matrix.target }}
100+
rustup default ${{ env.MSRV }}
103101
104102
- name: disable debug
105103
shell: bash
106104
run: |
107105
mkdir -p .cargo
108106
echo """
109107
[profile.dev]
110-
incremental = false
111108
debug = false" >> .cargo/config.toml
112109
113110
- name: caching
@@ -142,8 +139,7 @@ jobs:
142139
set -e
143140
144141
# build for Emscripten/WebGL
145-
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal \
146-
--no-default-features --features webgl,emscripten
142+
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal --no-default-features --features webgl,emscripten
147143
148144
# build cube example
149145
cargo clippy --target ${{ matrix.target }} --example cube --features webgl,emscripten
@@ -164,8 +160,7 @@ jobs:
164160
# (But watch out for backend-selection features in wgpu-core; some of
165161
# those only build on the right platforms.)
166162
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-info -p player --tests --all-features
167-
cargo clippy --target ${{ matrix.target }} -p wgpu-core --tests \
168-
--features="portable_features"
163+
cargo clippy --target ${{ matrix.target }} -p wgpu-core --tests --features="portable_features"
169164
170165
# build docs
171166
# (Watch out for backend-selection features in wgpu-core; some of
@@ -180,19 +175,14 @@ jobs:
180175
- name: checkout repo
181176
uses: actions/checkout@v3
182177

183-
- name: install rust stable
184-
uses: actions-rs/toolchain@v1
185-
with:
186-
toolchain: stable
187-
profile: minimal
188-
override: true
189-
190-
- name: install wasm-pack # install from fork until this is merged: https://github.com/rustwasm/wasm-pack/pull/1185
191-
run: |
192-
# replace with "install wasm-pack action", which doesn't work for this project because of https://github.com/rustwasm/wasm-pack/issues/1180
193-
# - name: install wasm-pack
194-
# uses: jetli/[email protected]
195-
cargo install --git https://github.com/haraldreingruber/wasm-pack wasm-pack
178+
# TODO: replace with this once there is a release containing this PR:
179+
# https://github.com/rustwasm/wasm-pack/pull/1185
180+
# - name: Install wasm-pack
181+
# uses: taiki-e/install-action@v2
182+
# with:
183+
# tool: wasm-pack
184+
- name: install wasm-pack
185+
run: cargo install --git https://github.com/rustwasm/wasm-pack --rev e1010233b0ce304f42cda59962254bf30ae97c3e wasm-pack
196186

197187
- name: execute tests
198188
run: |
@@ -221,18 +211,10 @@ jobs:
221211
- name: checkout repo
222212
uses: actions/checkout@v3
223213

224-
- name: install rust stable
225-
uses: actions-rs/toolchain@v1
214+
- name: Install cargo-nextest and cargo-llvm-cov
215+
uses: taiki-e/install-action@v2
226216
with:
227-
toolchain: nightly
228-
profile: minimal
229-
override: true
230-
components: llvm-tools-preview
231-
232-
- name: latest cargo-nextest
233-
uses: taiki-e/install-action@nextest
234-
- name: install cargo-llvm-cov
235-
uses: taiki-e/install-action@cargo-llvm-cov
217+
tool: cargo-nextest,cargo-llvm-cov
236218

237219
- name: install swiftshader
238220
if: matrix.os == 'ubuntu-22.04'
@@ -266,7 +248,6 @@ jobs:
266248
mkdir -p .cargo
267249
echo """
268250
[profile.dev]
269-
incremental = false
270251
debug = 1" >> .cargo/config.toml
271252
272253
- name: caching
@@ -279,7 +260,7 @@ jobs:
279260
run: |
280261
set -e
281262
282-
cargo llvm-cov run --bin wgpu-info --no-report
263+
cargo llvm-cov --no-cfg-coverage run --bin wgpu-info --no-report
283264
284265
- name: run tests
285266
shell: bash
@@ -288,7 +269,7 @@ jobs:
288269
289270
for backend in ${{ matrix.backends }}; do
290271
echo "======= NATIVE TESTS $backend ======";
291-
WGPU_BACKEND=$backend cargo llvm-cov nextest -p wgpu -p wgpu-types -p wgpu-hal -p wgpu-core -p player --no-fail-fast --no-report
272+
WGPU_BACKEND=$backend cargo llvm-cov --no-cfg-coverage nextest -p wgpu -p wgpu-types -p wgpu-hal -p wgpu-core -p player --no-fail-fast --no-report
292273
done
293274
294275
- name: generate coverage report
@@ -305,26 +286,18 @@ jobs:
305286

306287
doctest:
307288
name: Doctest
308-
runs-on: ubuntu-22.04
289+
runs-on: ubuntu-latest
309290

310291
steps:
311292
- name: checkout repo
312293
uses: actions/checkout@v3
313294

314-
- name: install rust stable
315-
uses: actions-rs/toolchain@v1
316-
with:
317-
toolchain: stable
318-
profile: minimal
319-
override: true
320-
321295
- name: disable debug
322296
shell: bash
323297
run: |
324298
mkdir -p .cargo
325299
echo """
326300
[profile.dev]
327-
incremental = false
328301
debug = 1" >> .cargo/config.toml
329302
330303
- name: caching
@@ -346,14 +319,6 @@ jobs:
346319
- name: checkout repo
347320
uses: actions/checkout@v3
348321

349-
- name: install rust
350-
uses: actions-rs/toolchain@v1
351-
with:
352-
profile: minimal
353-
toolchain: stable
354-
override: true
355-
components: rustfmt
356-
357322
- name: run rustfmt
358323
run: |
359324
cargo fmt -- --check
@@ -365,21 +330,17 @@ jobs:
365330
- name: checkout repo
366331
uses: actions/checkout@v3
367332

368-
- name: install rust ${{ env.RUST_VERSION }}
369-
uses: actions-rs/toolchain@v1
370-
with:
371-
profile: minimal
372-
toolchain: ${{ env.RUST_VERSION }}
373-
override: true
374-
components: clippy
333+
- name: Install MSRV toolchain
334+
run: |
335+
rustup toolchain install ${{ env.MSRV }} --no-self-update --profile=minimal --component clippy
336+
rustup default ${{ env.MSRV }}
375337
376338
- name: disable debug
377339
shell: bash
378340
run: |
379341
mkdir -p .cargo
380342
echo """
381343
[profile.dev]
382-
incremental = false
383344
debug = 1" >> .cargo/config.toml
384345
385346
- name: caching
@@ -403,7 +364,7 @@ jobs:
403364
with:
404365
command: check advisories
405366
arguments: --all-features --workspace
406-
rust-version: ${{ env.RUST_VERSION }}
367+
rust-version: ${{ env.MSRV }}
407368

408369
cargo-deny-check-rest:
409370
name: "Run `cargo deny check`"
@@ -417,4 +378,4 @@ jobs:
417378
with:
418379
command: check bans licenses sources
419380
arguments: --all-features --workspace
420-
rust-version: ${{ env.RUST_VERSION }}
381+
rust-version: ${{ env.MSRV }}

.github/workflows/cts.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ on:
88
types: [labeled, opened, synchronize]
99

1010
env:
11-
RUST_BACKTRACE: 1
12-
RUST_VERSION: 1.64
11+
CARGO_INCREMENTAL: false
12+
CARGO_TERM_COLOR: always
13+
RUST_BACKTRACE: full
14+
MSRV: 1.64
1315

1416
jobs:
1517
cts:
@@ -37,7 +39,7 @@ jobs:
3739

3840
steps:
3941
- name: checkout repo
40-
uses: actions/checkout@v2
42+
uses: actions/checkout@v3
4143
with:
4244
path: wgpu
4345

@@ -47,16 +49,13 @@ jobs:
4749
cd cts
4850
git checkout $(cat ../wgpu/cts_runner/revision.txt)
4951
50-
- name: install rust ${{ env.RUST_VERSION }}
51-
uses: actions-rs/toolchain@v1
52-
with:
53-
toolchain: ${{ env.RUST_VERSION }}
54-
target: ${{ matrix.target }}
55-
profile: minimal
56-
override: true
52+
- name: Install MSRV toolchain
53+
run: |
54+
rustup toolchain install ${{ env.MSRV }} --no-self-update --profile=minimal --target ${{ matrix.target }}
55+
rustup default ${{ env.MSRV }}
5756
5857
- name: caching
59-
uses: Swatinem/rust-cache@v1
58+
uses: Swatinem/rust-cache@v2
6059
with:
6160
key: cts-a # suffix for cache busting
6261
working-directory: wgpu/cts_runner

.github/workflows/docs.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@ on:
55
branches:
66
- master
77

8+
env:
9+
CARGO_INCREMENTAL: false
10+
CARGO_TERM_COLOR: always
11+
RUST_BACKTRACE: full
12+
813
jobs:
914
build:
1015
runs-on: ubuntu-latest
1116

1217
steps:
1318
- name: Checkout the code
14-
uses: actions/checkout@v2
19+
uses: actions/checkout@v3
1520
with:
1621
persist-credentials: false
1722

18-
- name: Install latest nightly
19-
uses: actions-rs/toolchain@v1
20-
with:
21-
toolchain: nightly
22-
override: true
23-
continue-on-error: true
23+
- name: Install nightly toolchain
24+
run: rustup toolchain install nightly --no-self-update --profile=minimal
2425

2526
- name: Add EGL for OpenGL
2627
run: |
@@ -38,10 +39,10 @@ jobs:
3839
if: ${{ failure() }}
3940

4041
- name: Deploy the docs
41-
uses: JamesIves/github-pages-deploy-action@releases/v3
42+
uses: JamesIves/github-pages-deploy-action@v4.4.1
4243
with:
43-
ACCESS_TOKEN: ${{ secrets.WEB_DEPLOY }}
44-
FOLDER: target/doc
45-
REPOSITORY_NAME: gfx-rs/wgpu-rs.github.io
46-
BRANCH: master
47-
TARGET_FOLDER: doc
44+
token: ${{ secrets.WEB_DEPLOY }}
45+
folder: target/doc
46+
repository-name: gfx-rs/wgpu-rs.github.io
47+
branch: master
48+
target-folder: doc

.github/workflows/publish.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@ on:
66
- gecko
77

88
env:
9+
CARGO_INCREMENTAL: false
10+
CARGO_TERM_COLOR: always
11+
RUST_BACKTRACE: full
912
RUSTFLAGS: --cfg=web_sys_unstable_apis
1013

1114
jobs:
1215
publish:
1316
runs-on: ubuntu-latest
1417
steps:
1518
- name: Checkout the code
16-
uses: actions/checkout@v2
19+
uses: actions/checkout@v3
1720
with:
1821
persist-credentials: false
1922

20-
- name: Install Rust WASM toolchain
21-
uses: actions-rs/toolchain@v1
22-
with:
23-
toolchain: stable
24-
target: wasm32-unknown-unknown
23+
- name: Install Rust WASM target
24+
run: rustup target add wasm32-unknown-unknown
2525

2626
- name: Install wasm-bindgen-cli
2727
run: cargo install wasm-bindgen-cli --version=0.2.83
@@ -37,13 +37,13 @@ jobs:
3737
done
3838
3939
- name: Deploy WebGPU examples
40-
uses: JamesIves/github-pages-deploy-action@releases/v3
40+
uses: JamesIves/github-pages-deploy-action@v4.4.1
4141
with:
42-
ACCESS_TOKEN: ${{ secrets.WEB_DEPLOY }}
43-
FOLDER: target/generated-gpu
44-
REPOSITORY_NAME: gfx-rs/wgpu-rs.github.io
45-
BRANCH: master
46-
TARGET_FOLDER: examples-gpu/wasm
42+
token: ${{ secrets.WEB_DEPLOY }}
43+
folder: target/generated-gpu
44+
repository-name: gfx-rs/wgpu-rs.github.io
45+
branch: master
46+
target-folder: examples-gpu/wasm
4747

4848
- name: Clean the build
4949
run: cargo clean
@@ -59,10 +59,10 @@ jobs:
5959
done
6060
6161
- name: Deploy WebGL examples
62-
uses: JamesIves/github-pages-deploy-action@releases/v3
62+
uses: JamesIves/github-pages-deploy-action@v4.4.1
6363
with:
64-
ACCESS_TOKEN: ${{ secrets.WEB_DEPLOY }}
65-
FOLDER: target/generated-gl
66-
REPOSITORY_NAME: gfx-rs/wgpu-rs.github.io
67-
BRANCH: master
68-
TARGET_FOLDER: examples-gl/wasm
64+
token: ${{ secrets.WEB_DEPLOY }}
65+
folder: target/generated-gl
66+
repository-name: gfx-rs/wgpu-rs.github.io
67+
branch: master
68+
target-folder: examples-gl/wasm

0 commit comments

Comments
 (0)