From 4bebad706ec09f1981f16f829d7a444238dccd31 Mon Sep 17 00:00:00 2001 From: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com> Date: Thu, 9 Feb 2023 16:33:53 +0100 Subject: [PATCH] Improve CI (#3453) --- .github/workflows/ci.yml | 99 +++++++++++------------------------ .github/workflows/cts.yml | 21 ++++---- .github/workflows/docs.yml | 27 +++++----- .github/workflows/publish.yml | 36 ++++++------- 4 files changed, 72 insertions(+), 111 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 410ca55ac..00c085897 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -92,14 +94,10 @@ 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 @@ -107,7 +105,6 @@ jobs: mkdir -p .cargo echo """ [profile.dev] - incremental = false debug = false" >> .cargo/config.toml - name: caching @@ -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 @@ -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 @@ -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/wasm-pack-action@v0.4.0 - 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: | @@ -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' @@ -266,7 +248,6 @@ jobs: mkdir -p .cargo echo """ [profile.dev] - incremental = false debug = 1" >> .cargo/config.toml - name: caching @@ -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 @@ -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 @@ -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 @@ -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 @@ -365,13 +330,10 @@ 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 @@ -379,7 +341,6 @@ jobs: mkdir -p .cargo echo """ [profile.dev] - incremental = false debug = 1" >> .cargo/config.toml - name: caching @@ -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`" @@ -417,4 +378,4 @@ jobs: with: command: check bans licenses sources arguments: --all-features --workspace - rust-version: ${{ env.RUST_VERSION }} + rust-version: ${{ env.MSRV }} diff --git a/.github/workflows/cts.yml b/.github/workflows/cts.yml index 332fc7fb6..58fbc5e89 100644 --- a/.github/workflows/cts.yml +++ b/.github/workflows/cts.yml @@ -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: @@ -37,7 +39,7 @@ jobs: steps: - name: checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: wgpu @@ -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 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8e2c9885d..7a6986a4a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -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: | @@ -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 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 08546cff1..20adf8ccd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,6 +6,9 @@ on: - gecko env: + CARGO_INCREMENTAL: false + CARGO_TERM_COLOR: always + RUST_BACKTRACE: full RUSTFLAGS: --cfg=web_sys_unstable_apis jobs: @@ -13,15 +16,12 @@ jobs: 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 @@ -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 @@ -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