From 85c87809905bcf1a2af8c78df4358c0b8e7328e8 Mon Sep 17 00:00:00 2001 From: jasonwilliams Date: Sat, 20 Sep 2025 13:31:57 +0100 Subject: [PATCH 1/5] Use same cache key for builds and tests --- .github/workflows/nightly_build.yml | 17 +++++-- .github/workflows/pull_request.yml | 2 +- .github/workflows/release.yml | 22 +++++--- .github/workflows/rust.yml | 72 ++++++++++++++++++++------- .github/workflows/test262.yml | 2 +- .github/workflows/test262_release.yml | 2 +- .github/workflows/webassembly.yml | 13 +++-- 7 files changed, 96 insertions(+), 34 deletions(-) diff --git a/.github/workflows/nightly_build.yml b/.github/workflows/nightly_build.yml index 932d7f66790..69d0c427a50 100644 --- a/.github/workflows/nightly_build.yml +++ b/.github/workflows/nightly_build.yml @@ -16,16 +16,17 @@ jobs: - target: x86_64-unknown-linux-gnu os: ubuntu-latest binary_extension: "" - - target: x86_64-apple-darwin - os: macos-13 - binary_extension: "" + arch : X64 - target: aarch64-apple-darwin os: macos-14 + arch : ARM64 - target: aarch64-unknown-linux-gnu os: ubuntu-24.04-arm + arch : ARM64 binary_extension: "" - target: x86_64-pc-windows-msvc os: windows-latest + arch : X64 binary_extension: ".exe" runs-on: ${{ matrix.os }} steps: @@ -38,6 +39,16 @@ jobs: toolchain: stable targets: ${{ matrix.target }} + - name: Restore cache + id: cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ matrix.os }}-${{ matrix.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Build run: cargo build --target ${{ matrix.target }} --release --locked --bin boa diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 3c9cbeabb88..1d6fda7c954 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -34,7 +34,7 @@ jobs: target ~/.cargo/git ~/.cargo/registry - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} - uses: boa-dev/criterion-compare-action@v3.2.4 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b2c76a54ceb..0bd016996ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -82,23 +82,22 @@ jobs: strategy: fail-fast: false matrix: - build: [linux, macos-amd64, macos-arm64, win-msvc] + build: [linux, macos-arm64, win-msvc] include: - build: linux - os: ubuntu-20.04 + os: ubuntu-latest target: x86_64-unknown-linux-gnu - binary_extension: "" - - build: macos-amd64 - os: macos-13 - target: x86_64-apple-darwin + arch: X64 binary_extension: "" - build: macos-arm64 os: macos-14 target: aarch64-apple-darwin + arch : ARM64 binary_extension: "" - build: win-msvc - os: windows-2019 + os: windows-latest target: x86_64-pc-windows-msvc + arch : X64 binary_extension: ".exe" runs-on: ${{ matrix.os }} steps: @@ -111,6 +110,15 @@ jobs: toolchain: stable targets: ${{ matrix.target }} + - name: Cache cargo + uses: actions/cache@v4 + with: + path: | + target + ~/.cargo/git + ~/.cargo/registry + key: ${{ matrix.os }}-${{ matrix.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Build run: cargo build --target ${{ matrix.target }} --verbose --release --locked --bin boa diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 81d687dcbf0..0c98e4d167b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -39,9 +39,15 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 + - name: Cache cargo + uses: actions/cache@v4 with: - key: tarpaulin + path: | + target + ~/.cargo/git + ~/.cargo/registry + key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Install cargo-tarpaulin uses: baptiste0928/cargo-install@v3.3.2 with: @@ -65,12 +71,15 @@ jobs: CARGO_TARGET_X86_64_APPLE_DARWIN_RUSTFLAGS: ${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && '-D warnings' || '' }} CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU: ${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && '-D warnings' || '' }} strategy: - matrix: - os: - - macos-13 - - macos-14 - - windows-latest - - ubuntu-24.04-arm + include: + - os: macos-14 + arch: ARM64 + - os: windows-latest + arch: x64 + - os: ubuntu-24.04-arm + arch: ARM64 + - os: ubuntu-latest + arch: X64 steps: - name: Checkout repository uses: actions/checkout@v5 @@ -80,7 +89,15 @@ jobs: with: toolchain: stable - - uses: Swatinem/rust-cache@v2 + - name: Cache cargo + uses: actions/cache@v4 + with: + path: | + target + ~/.cargo/git + ~/.cargo/registry + key: ${{ matrix.os }}-${{ matrix.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Build tests run: cargo test --no-run --profile ci # this order is faster according to rust-analyzer @@ -157,9 +174,14 @@ jobs: toolchain: stable components: clippy - - uses: Swatinem/rust-cache@v2 + - name: Cache cargo + uses: actions/cache@v4 with: - key: clippy + path: | + target + ~/.cargo/git + ~/.cargo/registry + key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install cargo-workspaces run: cargo install cargo-workspaces @@ -194,9 +216,15 @@ jobs: with: toolchain: stable - - uses: Swatinem/rust-cache@v2 + - name: Cache cargo + uses: actions/cache@v4 with: - key: docs + path: | + target + ~/.cargo/git + ~/.cargo/registry + key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Generate documentation run: cargo doc -v --document-private-items --all-features @@ -217,9 +245,14 @@ jobs: with: toolchain: stable - - uses: Swatinem/rust-cache@v2 + - name: Cache cargo + uses: actions/cache@v4 with: - key: build-fuzz + path: | + target + ~/.cargo/git + ~/.cargo/registry + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install cargo-fuzz run: cargo install cargo-fuzz @@ -244,9 +277,14 @@ jobs: with: toolchain: stable - - uses: Swatinem/rust-cache@v2 + - name: Cache cargo + uses: actions/cache@v4 with: - key: build-run-examples + path: | + target + ~/.cargo/git + ~/.cargo/registry + key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install cargo-workspaces run: cargo install cargo-workspaces diff --git a/.github/workflows/test262.yml b/.github/workflows/test262.yml index 2bf827c821e..f5ff6e794b4 100644 --- a/.github/workflows/test262.yml +++ b/.github/workflows/test262.yml @@ -35,7 +35,7 @@ jobs: target ~/.cargo/git ~/.cargo/registry - key: ${{ runner.os }}-cargo-test262-${{ hashFiles('**/Cargo.lock') }} + key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Checkout the data repo uses: actions/checkout@v5 diff --git a/.github/workflows/test262_release.yml b/.github/workflows/test262_release.yml index f95b5f4036a..fb4e4cc4237 100644 --- a/.github/workflows/test262_release.yml +++ b/.github/workflows/test262_release.yml @@ -31,7 +31,7 @@ jobs: target ~/.cargo/git ~/.cargo/registry - key: ${{ runner.os }}-cargo-test262-${{ hashFiles('**/Cargo.lock') }} + key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} # Checkout the `data` repository - name: Checkout the data repo diff --git a/.github/workflows/webassembly.yml b/.github/workflows/webassembly.yml index 693f239b056..fcf35f056fb 100644 --- a/.github/workflows/webassembly.yml +++ b/.github/workflows/webassembly.yml @@ -49,11 +49,16 @@ jobs: with: toolchain: stable - - uses: Swatinem/rust-cache@v2 - - name: Install wasm-pack - uses: baptiste0928/cargo-install@v3.3.2 + + - name: Cache cargo + uses: actions/cache@v4 with: - crate: wasm-pack + path: | + target + ~/.cargo/git + ~/.cargo/registry + key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Build Playground run: wasm-pack build ./ffi/wasm --verbose - name: Test (Chrome) From 1e62c03ec8929271376440c6823686de7d625adf Mon Sep 17 00:00:00 2001 From: jasonwilliams Date: Sat, 20 Sep 2025 13:37:51 +0100 Subject: [PATCH 2/5] re add back the wasm pack installation --- .github/workflows/webassembly.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/webassembly.yml b/.github/workflows/webassembly.yml index fcf35f056fb..ab2f4f98c22 100644 --- a/.github/workflows/webassembly.yml +++ b/.github/workflows/webassembly.yml @@ -59,6 +59,11 @@ jobs: ~/.cargo/registry key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Install wasm-pack + uses: baptiste0928/cargo-install@v3.3.2 + with: + crate: wasm-pack + - name: Build Playground run: wasm-pack build ./ffi/wasm --verbose - name: Test (Chrome) From 7025c760f5500bc287d3254baa12204ab014d63a Mon Sep 17 00:00:00 2001 From: Jason Williams <936006+jasonwilliams@users.noreply.github.com> Date: Sat, 20 Sep 2025 13:39:37 +0100 Subject: [PATCH 3/5] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0c98e4d167b..e5c26099aa5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -252,7 +252,7 @@ jobs: target ~/.cargo/git ~/.cargo/registry - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install cargo-fuzz run: cargo install cargo-fuzz From 46a813bc87f4e3f03f1100b6a1ab8b8866fe838e Mon Sep 17 00:00:00 2001 From: jasonwilliams Date: Sat, 20 Sep 2025 13:56:17 +0100 Subject: [PATCH 4/5] tidy up matrix/include --- .github/workflows/rust.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e5c26099aa5..1f274178f97 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -71,15 +71,16 @@ jobs: CARGO_TARGET_X86_64_APPLE_DARWIN_RUSTFLAGS: ${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && '-D warnings' || '' }} CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU: ${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && '-D warnings' || '' }} strategy: - include: - - os: macos-14 - arch: ARM64 - - os: windows-latest - arch: x64 - - os: ubuntu-24.04-arm - arch: ARM64 - - os: ubuntu-latest - arch: X64 + matrix: + include: + - os: macos-14 + arch: ARM64 + - os: windows-latest + arch: x64 + - os: ubuntu-24.04-arm + arch: ARM64 + - os: ubuntu-latest + arch: X64 steps: - name: Checkout repository uses: actions/checkout@v5 From b633b1010d9cf57a3d8e2e9f108660bc62105e4e Mon Sep 17 00:00:00 2001 From: jasonwilliams Date: Mon, 13 Oct 2025 19:05:39 +0100 Subject: [PATCH 5/5] remove matrix.arch and use runner.arch instead --- .github/workflows/nightly_build.yml | 6 +----- .github/workflows/release.yml | 5 +---- .github/workflows/rust.yml | 6 +----- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/.github/workflows/nightly_build.yml b/.github/workflows/nightly_build.yml index 69d0c427a50..1829151a0fd 100644 --- a/.github/workflows/nightly_build.yml +++ b/.github/workflows/nightly_build.yml @@ -16,17 +16,13 @@ jobs: - target: x86_64-unknown-linux-gnu os: ubuntu-latest binary_extension: "" - arch : X64 - target: aarch64-apple-darwin os: macos-14 - arch : ARM64 - target: aarch64-unknown-linux-gnu os: ubuntu-24.04-arm - arch : ARM64 binary_extension: "" - target: x86_64-pc-windows-msvc os: windows-latest - arch : X64 binary_extension: ".exe" runs-on: ${{ matrix.os }} steps: @@ -47,7 +43,7 @@ jobs: ~/.cargo/registry ~/.cargo/git target - key: ${{ matrix.os }}-${{ matrix.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} + key: ${{ matrix.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Build run: cargo build --target ${{ matrix.target }} --release --locked --bin boa diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0bd016996ad..cef2ca784e9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -87,17 +87,14 @@ jobs: - build: linux os: ubuntu-latest target: x86_64-unknown-linux-gnu - arch: X64 binary_extension: "" - build: macos-arm64 os: macos-14 target: aarch64-apple-darwin - arch : ARM64 binary_extension: "" - build: win-msvc os: windows-latest target: x86_64-pc-windows-msvc - arch : X64 binary_extension: ".exe" runs-on: ${{ matrix.os }} steps: @@ -117,7 +114,7 @@ jobs: target ~/.cargo/git ~/.cargo/registry - key: ${{ matrix.os }}-${{ matrix.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} + key: ${{ matrix.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Build run: cargo build --target ${{ matrix.target }} --verbose --release --locked --bin boa diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1f274178f97..adb4b78f8cd 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -74,13 +74,9 @@ jobs: matrix: include: - os: macos-14 - arch: ARM64 - os: windows-latest - arch: x64 - os: ubuntu-24.04-arm - arch: ARM64 - os: ubuntu-latest - arch: X64 steps: - name: Checkout repository uses: actions/checkout@v5 @@ -97,7 +93,7 @@ jobs: target ~/.cargo/git ~/.cargo/registry - key: ${{ matrix.os }}-${{ matrix.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} + key: ${{ matrix.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Build tests run: cargo test --no-run --profile ci