From 2a45ecf46b2c280031b7df5caecfa7ae1373b570 Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Thu, 7 Mar 2024 15:40:58 +0200 Subject: [PATCH 1/3] Refactor CI jobs to allow for more concurrency. --- .github/workflows/ci.yml | 98 ++++++++++++++++++++++++++++------------ 1 file changed, 68 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4454a98c25..9d196263a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,9 +31,9 @@ on: merge_group: jobs: - rustfmt: - runs-on: ubuntu-latest + fmt: name: cargo fmt + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -54,7 +54,68 @@ jobs: - name: check copyright headers run: bash .github/copyright.sh + clippy-stable: + name: cargo clippy + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, macos-latest, ubuntu-latest] + steps: + - uses: actions/checkout@v4 + + - name: restore cache + uses: Swatinem/rust-cache@v2 + + - name: install stable toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ env.RUST_STABLE_VER }} + components: clippy + + - name: install cargo-hack + uses: taiki-e/install-action@v2 + with: + tool: cargo-hack + + - name: install native dependencies + if: matrix.os == 'ubuntu-latest' + run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev + + - name: cargo clippy + run: cargo hack clippy --workspace --each-feature --optional-deps -- -D warnings + + - name: cargo clippy (auxiliary) + run: cargo hack clippy --workspace --each-feature --optional-deps --tests --benches --examples -- -D warnings + + clippy-stable-wasm: + name: cargo clippy (wasm32) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: restore cache + uses: Swatinem/rust-cache@v2 + + - name: install stable toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ env.RUST_STABLE_VER }} + targets: wasm32-unknown-unknown + components: clippy + + - name: install cargo-hack + uses: taiki-e/install-action@v2 + with: + tool: cargo-hack + + - name: cargo clippy + run: cargo hack clippy --workspace --target wasm32-unknown-unknown --each-feature --optional-deps -- -D warnings + + - name: cargo clippy (auxiliary) + run: cargo hack clippy --workspace --target wasm32-unknown-unknown --each-feature --optional-deps --tests --benches --examples -- -D warnings + test-stable: + name: cargo test runs-on: ${{ matrix.os }} strategy: matrix: @@ -69,7 +130,6 @@ jobs: # TODO: The windows runners theoretically have CPU fallback for GPUs, but # this failed in initial testing gpu: 'no' - name: cargo clippy + test steps: - uses: actions/checkout@v4 @@ -82,11 +142,6 @@ jobs: toolchain: ${{ env.RUST_STABLE_VER }} components: clippy - - name: install cargo-hack - uses: taiki-e/install-action@v2 - with: - tool: cargo-hack - - name: install native dependencies if: matrix.os == 'ubuntu-latest' run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev @@ -101,20 +156,14 @@ jobs: sudo apt-get update sudo apt install -y xvfb libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers - - name: cargo clippy - run: cargo hack clippy --workspace --each-feature --optional-deps -- -D warnings - - - name: cargo clippy (auxiliary) - run: cargo hack clippy --workspace --each-feature --optional-deps --tests --benches --examples -- -D warnings - - name: cargo test run: cargo test --workspace --all-features env: VELLO_CI_GPU_SUPPORT: ${{ matrix.gpu }} - clippy-stable-wasm: + test-stable-wasm: + name: cargo test (wasm32) runs-on: ubuntu-latest - name: cargo clippy + test (wasm32) steps: - uses: actions/checkout@v4 @@ -128,24 +177,13 @@ jobs: targets: wasm32-unknown-unknown components: clippy - - name: install cargo-hack - uses: taiki-e/install-action@v2 - with: - tool: cargo-hack - - - name: cargo clippy - run: cargo hack clippy --workspace --target wasm32-unknown-unknown --each-feature --optional-deps -- -D warnings - - - name: cargo clippy (auxiliary) - run: cargo hack clippy --workspace --target wasm32-unknown-unknown --each-feature --optional-deps --tests --benches --examples -- -D warnings - # TODO: Find a way to make tests work. Until then the tests are merely compiled. - name: cargo test compile run: cargo test --workspace --target wasm32-unknown-unknown --all-features --no-run - android-stable-check: - runs-on: ubuntu-latest + check-stable-android: name: cargo check (aarch64-android) + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -167,7 +205,7 @@ jobs: # This is a bit of a hack, but cargo apk doesn't seem to allow customising this RUSTFLAGS: '-D warnings' - docs: + doc: name: cargo doc runs-on: ${{ matrix.os }} strategy: From e94ff715094e0c0d6e3dde68b813b5b146b0540a Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Thu, 7 Mar 2024 16:25:21 +0200 Subject: [PATCH 2/3] Switch all macOS runners to `macos-14`. --- .github/workflows/ci.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d196263a6..ad2c3b9f08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,14 @@ env: # # Using cargo-hack also allows us to more easily test the feature matrix of our packages. # We use --each-feature & --optional-deps which will run a separate check for every feature. +# +# We use macos-14 explictly instead of macos-latest because: +# * macos-latest currently points to macos-12 +# * macos-14 provides us with the GPU support we want for testing +# * macos-14 comes with the M1 CPU which compiles our code much faster than the older runners +# This explicit dependency can be switched back to macos-latest once it points to macos-14, +# which is expected to happen sometime in Q2 FY24 (April – June 2024). +# https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available/ name: CI @@ -59,7 +67,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [windows-latest, macos-latest, ubuntu-latest] + os: [windows-latest, macos-14, ubuntu-latest] steps: - uses: actions/checkout@v4 @@ -119,7 +127,6 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - # We use macos-14 as that is an arm runner. These have the virtgpu support we need os: [windows-latest, macos-14, ubuntu-latest] include: - os: ubuntu-latest @@ -210,7 +217,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [windows-latest, macos-latest, ubuntu-latest] + os: [windows-latest, macos-14, ubuntu-latest] steps: - uses: actions/checkout@v4 From 38f5369753f9fc4b00432d5111b350b4415c34b1 Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Thu, 14 Mar 2024 16:29:19 +0200 Subject: [PATCH 3/3] Limit doc jobs to only Ubuntu. --- .github/workflows/ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad2c3b9f08..b089bef2f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -214,10 +214,9 @@ jobs: doc: name: cargo doc - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-latest, macos-14, ubuntu-latest] + # NOTE: We don't have any platform specific docs in this workspace, so we only run on Ubuntu. + # If we get per-platform docs (win/macos/linux/wasm32/..) then doc jobs should match that. + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4