diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index 7da34ac07a..fbf4e48e5c 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -94,6 +94,9 @@ jobs: defaults: run: working-directory: codex-rs + env: + IS_MACOS_RELEASE: ${{ matrix.profile == 'release' && startsWith(matrix.runner, 'macos') }} + CARGO_CI_PROFILE: ${{ (matrix.profile == 'release' && startsWith(matrix.runner, 'macos')) && 'ci-release' || matrix.profile }} strategy: fail-fast: false @@ -174,10 +177,6 @@ jobs: run: | sudo apt install -y musl-tools pkg-config && sudo rm -rf /var/lib/apt/lists/* - - name: cargo clippy - id: clippy - run: cargo clippy --target ${{ matrix.target }} --all-features --tests --profile ${{ matrix.profile }} -- -D warnings - # Running `cargo build` from the workspace root builds the workspace using # the union of all features from third-party crates. This can mask errors # where individual crates have underspecified features. To avoid this, we @@ -191,7 +190,14 @@ jobs: find . -name Cargo.toml -mindepth 2 -maxdepth 2 -print0 \ | xargs -0 -n1 -I{} bash -c 'cd "$(dirname "{}")" && cargo check --profile ${{ matrix.profile }}' + - if: ${{ matrix.profile == 'release' && startsWith(matrix.runner, 'macos') }} + name: Enable sccache + uses: mozilla-actions/sccache-action@v0 + with: + version: 0.5.4 + - uses: taiki-e/install-action@0c5db7f7f897c03b771660e91d065338615679f4 # v2 + if: ${{ matrix.profile != 'release' || startsWith(matrix.runner, 'macos') }} with: tool: nextest version: 0.9.103 @@ -209,10 +215,24 @@ jobs: id: test_release if: ${{ matrix.profile == 'release' && startsWith(matrix.runner, 'macos') }} continue-on-error: true - run: cargo nextest run --all-features --no-fail-fast --target ${{ matrix.target }} --cargo-profile release + run: | + if [[ "$IS_MACOS_RELEASE" == 'true' ]]; then + export RUSTC_WRAPPER="sccache" + export SCCACHE_GHA_ENABLED="on" + fi + cargo nextest run --all-features --no-fail-fast --target "${{ matrix.target }}" --cargo-profile "$CARGO_CI_PROFILE" env: RUST_BACKTRACE: 1 + - name: cargo clippy + id: clippy + run: | + if [[ "$IS_MACOS_RELEASE" == 'true' ]]; then + export RUSTC_WRAPPER="sccache" + export SCCACHE_GHA_ENABLED="on" + fi + cargo clippy --target "${{ matrix.target }}" --all-features --tests --profile "$CARGO_CI_PROFILE" -- -D warnings + # Save caches explicitly; make non-fatal so cache packaging # never fails the overall job. Only save when key wasn't hit. - name: Save cargo home cache