From 392bb88e123a24327acbbb7f4b0a9c488dcb7530 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Mon, 30 Mar 2026 11:02:26 +0200 Subject: [PATCH 1/4] Split check matrix. Prevent cache poisoning --- .github/workflows/ci.yaml | 71 +++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fa01906910..36f8d3bbb9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -114,35 +114,33 @@ jobs: matrix: include: - os: ubuntu-latest - targets: - - aarch64-linux-android - - i686-unknown-linux-gnu - - i686-unknown-linux-musl - - wasm32-wasip2 - - x86_64-unknown-freebsd + target: aarch64-linux-android + - os: ubuntu-latest + target: i686-unknown-linux-gnu dependencies: gcc-multilib: true + - os: ubuntu-latest + target: i686-unknown-linux-musl + dependencies: musl-tools: true - os: ubuntu-latest - targets: - - aarch64-unknown-linux-gnu + target: wasm32-wasip2 + - os: ubuntu-latest + target: x86_64-unknown-freebsd + - os: ubuntu-latest + target: aarch64-unknown-linux-gnu dependencies: - gcc-aarch64-linux-gnu: true # conflict with `gcc-multilib` + gcc-aarch64-linux-gnu: true - os: macos-latest - targets: - - aarch64-apple-ios - - x86_64-apple-darwin + target: aarch64-apple-ios + - os: macos-latest + target: x86_64-apple-darwin fail-fast: false steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 - with: - prefix-key: v0-rust-${{ join(matrix.targets, '-') }} - save-if: ${{ github.ref == 'refs/heads/main' }} - - name: Install dependencies uses: ./.github/actions/install-linux-deps # zizmor has an issue with dynamic `with` @@ -152,13 +150,28 @@ jobs: musl-tools: ${{ matrix.dependencies.musl-tools || false }} gcc-aarch64-linux-gnu: ${{ matrix.dependencies.gcc-aarch64-linux-gnu || false }} + - name: Restore cache + uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 + if: ${{ github.ref != 'refs/heads/main' }} # Never restore on main + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + # key won't match, will rely on restore-keys + key: cargo-check-${{ runner.os }}-${{ matrix.target }} + restore-keys: | + cargo-check-${{ runner.os }}-${{ matrix.target }}- + - uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 with: - targets: ${{ join(matrix.targets, ',') }} + target: ${{ matrix.target }} toolchain: stable - name: Setup Android NDK - if: ${{ contains(matrix.targets, 'aarch64-linux-android') }} + if: ${{ matrix.target == 'aarch64-linux-android' }} id: setup-ndk uses: nttld/setup-ndk@v1 with: @@ -174,18 +187,24 @@ jobs: # args: --ignore-rust-version - name: Check compilation - run: | - for target in ${{ join(matrix.targets, ' ') }} - do - echo "::group::${target}" - cargo check --target $target ${{ env.CARGO_ARGS_NO_SSL }} - echo "::endgroup::" - done + run: cargo check --target "${{ matrix.target }}" ${{ env.CARGO_ARGS_NO_SSL }} env: CC_aarch64_linux_android: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang AR_aarch64_linux_android: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang + - name: Save cache + if: ${{ github.ref == 'refs/heads/main' }} # only save on main + uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: cargo-check-${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('Cargo.lock') }}-${{ github.sha }} + snippets_cpython: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} env: From 8a9b9e2b3a138209615c76fd24fb890351570a41 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Mon, 30 Mar 2026 12:17:36 +0200 Subject: [PATCH 2/4] Use `rustup` --- .github/workflows/ci.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 36f8d3bbb9..09f2fc5695 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -165,10 +165,7 @@ jobs: restore-keys: | cargo-check-${{ runner.os }}-${{ matrix.target }}- - - uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 - with: - target: ${{ matrix.target }} - toolchain: stable + - run: rustup toolchain install stable --target "${{ matrix.target }}" - name: Setup Android NDK if: ${{ matrix.target == 'aarch64-linux-android' }} From e38d9b96d6bae4cfc4e668da536dad4024305ded Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Mon, 30 Mar 2026 12:19:55 +0200 Subject: [PATCH 3/4] Change name --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 09f2fc5695..af0036e229 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -108,7 +108,7 @@ jobs: cargo_check: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} - name: Ensure compilation on various targets + name: cargo check runs-on: ${{ matrix.os }} strategy: matrix: From 7e6a7cba8c4a0cf6610314fc8ec04bbd0ef5d5b1 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Mon, 30 Mar 2026 12:32:59 +0200 Subject: [PATCH 4/4] Align cargo args --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index af0036e229..ddcc284e0b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,6 +27,8 @@ env: PYTHON_VERSION: "3.14.3" X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR: C:\Program Files\OpenSSL\lib\VC\x64\MD X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR: C:\Program Files\OpenSSL\include + CARGO_INCREMENTAL: 0 + CARGO_TERM_COLOR: always jobs: rust_tests: