Skip to content

Commit

Permalink
Improve CI (#3453)
Browse files Browse the repository at this point in the history
  • Loading branch information
teoxoy authored Feb 9, 2023
1 parent 49cfc88 commit 4bebad7
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 111 deletions.
99 changes: 30 additions & 69 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ on:
merge_group:

env:
RUST_BACKTRACE: 1
RUST_VERSION: 1.64
CARGO_INCREMENTAL: false
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
MSRV: 1.64
PKG_CONFIG_ALLOW_CROSS: 1 # allow android to work
RUSTFLAGS: --cfg=web_sys_unstable_apis -D warnings
RUSTDOCFLAGS: -Dwarnings
Expand Down Expand Up @@ -92,22 +94,17 @@ jobs:
- name: checkout repo
uses: actions/checkout@v3

- name: install rust ${{ env.RUST_VERSION }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_VERSION }}
target: ${{ matrix.target }}
profile: minimal
override: true
components: clippy
- name: Install MSRV toolchain
run: |
rustup toolchain install ${{ env.MSRV }} --no-self-update --profile=minimal --component clippy --target ${{ matrix.target }}
rustup default ${{ env.MSRV }}
- name: disable debug
shell: bash
run: |
mkdir -p .cargo
echo """
[profile.dev]
incremental = false
debug = false" >> .cargo/config.toml
- name: caching
Expand Down Expand Up @@ -142,8 +139,7 @@ jobs:
set -e
# build for Emscripten/WebGL
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal \
--no-default-features --features webgl,emscripten
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal --no-default-features --features webgl,emscripten
# build cube example
cargo clippy --target ${{ matrix.target }} --example cube --features webgl,emscripten
Expand All @@ -164,8 +160,7 @@ jobs:
# (But watch out for backend-selection features in wgpu-core; some of
# those only build on the right platforms.)
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-info -p player --tests --all-features
cargo clippy --target ${{ matrix.target }} -p wgpu-core --tests \
--features="portable_features"
cargo clippy --target ${{ matrix.target }} -p wgpu-core --tests --features="portable_features"
# build docs
# (Watch out for backend-selection features in wgpu-core; some of
Expand All @@ -180,19 +175,14 @@ jobs:
- name: checkout repo
uses: actions/checkout@v3

- name: install rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: install wasm-pack # install from fork until this is merged: https://github.com/rustwasm/wasm-pack/pull/1185
run: |
# replace with "install wasm-pack action", which doesn't work for this project because of https://github.com/rustwasm/wasm-pack/issues/1180
# - name: install wasm-pack
# uses: jetli/[email protected]
cargo install --git https://github.com/haraldreingruber/wasm-pack wasm-pack
# TODO: replace with this once there is a release containing this PR:
# https://github.com/rustwasm/wasm-pack/pull/1185
# - name: Install wasm-pack
# uses: taiki-e/install-action@v2
# with:
# tool: wasm-pack
- name: install wasm-pack
run: cargo install --git https://github.com/rustwasm/wasm-pack --rev e1010233b0ce304f42cda59962254bf30ae97c3e wasm-pack

- name: execute tests
run: |
Expand Down Expand Up @@ -221,18 +211,10 @@ jobs:
- name: checkout repo
uses: actions/checkout@v3

- name: install rust stable
uses: actions-rs/toolchain@v1
- name: Install cargo-nextest and cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
toolchain: nightly
profile: minimal
override: true
components: llvm-tools-preview

- name: latest cargo-nextest
uses: taiki-e/install-action@nextest
- name: install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
tool: cargo-nextest,cargo-llvm-cov

- name: install swiftshader
if: matrix.os == 'ubuntu-22.04'
Expand Down Expand Up @@ -266,7 +248,6 @@ jobs:
mkdir -p .cargo
echo """
[profile.dev]
incremental = false
debug = 1" >> .cargo/config.toml
- name: caching
Expand All @@ -279,7 +260,7 @@ jobs:
run: |
set -e
cargo llvm-cov run --bin wgpu-info --no-report
cargo llvm-cov --no-cfg-coverage run --bin wgpu-info --no-report
- name: run tests
shell: bash
Expand All @@ -288,7 +269,7 @@ jobs:
for backend in ${{ matrix.backends }}; do
echo "======= NATIVE TESTS $backend ======";
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
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
done
- name: generate coverage report
Expand All @@ -305,26 +286,18 @@ jobs:

doctest:
name: Doctest
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:
- name: checkout repo
uses: actions/checkout@v3

- name: install rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: disable debug
shell: bash
run: |
mkdir -p .cargo
echo """
[profile.dev]
incremental = false
debug = 1" >> .cargo/config.toml
- name: caching
Expand All @@ -346,14 +319,6 @@ jobs:
- name: checkout repo
uses: actions/checkout@v3

- name: install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt

- name: run rustfmt
run: |
cargo fmt -- --check
Expand All @@ -365,21 +330,17 @@ jobs:
- name: checkout repo
uses: actions/checkout@v3

- name: install rust ${{ env.RUST_VERSION }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_VERSION }}
override: true
components: clippy
- name: Install MSRV toolchain
run: |
rustup toolchain install ${{ env.MSRV }} --no-self-update --profile=minimal --component clippy
rustup default ${{ env.MSRV }}
- name: disable debug
shell: bash
run: |
mkdir -p .cargo
echo """
[profile.dev]
incremental = false
debug = 1" >> .cargo/config.toml
- name: caching
Expand All @@ -403,7 +364,7 @@ jobs:
with:
command: check advisories
arguments: --all-features --workspace
rust-version: ${{ env.RUST_VERSION }}
rust-version: ${{ env.MSRV }}

cargo-deny-check-rest:
name: "Run `cargo deny check`"
Expand All @@ -417,4 +378,4 @@ jobs:
with:
command: check bans licenses sources
arguments: --all-features --workspace
rust-version: ${{ env.RUST_VERSION }}
rust-version: ${{ env.MSRV }}
21 changes: 10 additions & 11 deletions .github/workflows/cts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ on:
types: [labeled, opened, synchronize]

env:
RUST_BACKTRACE: 1
RUST_VERSION: 1.64
CARGO_INCREMENTAL: false
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
MSRV: 1.64

jobs:
cts:
Expand Down Expand Up @@ -37,7 +39,7 @@ jobs:

steps:
- name: checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: wgpu

Expand All @@ -47,16 +49,13 @@ jobs:
cd cts
git checkout $(cat ../wgpu/cts_runner/revision.txt)
- name: install rust ${{ env.RUST_VERSION }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_VERSION }}
target: ${{ matrix.target }}
profile: minimal
override: true
- name: Install MSRV toolchain
run: |
rustup toolchain install ${{ env.MSRV }} --no-self-update --profile=minimal --target ${{ matrix.target }}
rustup default ${{ env.MSRV }}
- name: caching
uses: Swatinem/rust-cache@v1
uses: Swatinem/rust-cache@v2
with:
key: cts-a # suffix for cache busting
working-directory: wgpu/cts_runner
Expand Down
27 changes: 14 additions & 13 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@ on:
branches:
- master

env:
CARGO_INCREMENTAL: false
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout the code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
continue-on-error: true
- name: Install nightly toolchain
run: rustup toolchain install nightly --no-self-update --profile=minimal

- name: Add EGL for OpenGL
run: |
Expand All @@ -38,10 +39,10 @@ jobs:
if: ${{ failure() }}

- name: Deploy the docs
uses: JamesIves/github-pages-deploy-action@releases/v3
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
ACCESS_TOKEN: ${{ secrets.WEB_DEPLOY }}
FOLDER: target/doc
REPOSITORY_NAME: gfx-rs/wgpu-rs.github.io
BRANCH: master
TARGET_FOLDER: doc
token: ${{ secrets.WEB_DEPLOY }}
folder: target/doc
repository-name: gfx-rs/wgpu-rs.github.io
branch: master
target-folder: doc
36 changes: 18 additions & 18 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ on:
- gecko

env:
CARGO_INCREMENTAL: false
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
RUSTFLAGS: --cfg=web_sys_unstable_apis

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Install Rust WASM toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: Install Rust WASM target
run: rustup target add wasm32-unknown-unknown

- name: Install wasm-bindgen-cli
run: cargo install wasm-bindgen-cli --version=0.2.83
Expand All @@ -37,13 +37,13 @@ jobs:
done
- name: Deploy WebGPU examples
uses: JamesIves/github-pages-deploy-action@releases/v3
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
ACCESS_TOKEN: ${{ secrets.WEB_DEPLOY }}
FOLDER: target/generated-gpu
REPOSITORY_NAME: gfx-rs/wgpu-rs.github.io
BRANCH: master
TARGET_FOLDER: examples-gpu/wasm
token: ${{ secrets.WEB_DEPLOY }}
folder: target/generated-gpu
repository-name: gfx-rs/wgpu-rs.github.io
branch: master
target-folder: examples-gpu/wasm

- name: Clean the build
run: cargo clean
Expand All @@ -59,10 +59,10 @@ jobs:
done
- name: Deploy WebGL examples
uses: JamesIves/github-pages-deploy-action@releases/v3
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
ACCESS_TOKEN: ${{ secrets.WEB_DEPLOY }}
FOLDER: target/generated-gl
REPOSITORY_NAME: gfx-rs/wgpu-rs.github.io
BRANCH: master
TARGET_FOLDER: examples-gl/wasm
token: ${{ secrets.WEB_DEPLOY }}
folder: target/generated-gl
repository-name: gfx-rs/wgpu-rs.github.io
branch: master
target-folder: examples-gl/wasm

0 comments on commit 4bebad7

Please sign in to comment.