Skip to content

Commit

Permalink
ci: Disable Rust cache (#1719)
Browse files Browse the repository at this point in the history
* ci: Disable Rust cache

Check if it makes any difference to build times first.

* Update action.yml

* Give sccache one more go

* Tweaks for sccache

* Fix step title

* Leave commented-out cache configs in the action, in case we want to re-try

---------

Signed-off-by: Lars Eggert <[email protected]>
  • Loading branch information
larseggert authored Mar 8, 2024
1 parent 3476bd0 commit 1df959c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
35 changes: 26 additions & 9 deletions .github/actions/rust/action.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
name: Install Rust
description: Install Rust and sccache
description: Install Rust and tools

inputs:
version:
description: 'Rust toolchain version to install'
required: true
default: 'stable'
components:
description: 'Rust components to install'
required: false
default: ''

runs:
Expand All @@ -25,7 +23,7 @@ runs:
shell: pwsh
run: Set-ExecutionPolicy Unrestricted -Scope Process; iex (iwr "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.ps1").Content

- name: Install cargo-binstall (Windows)
- name: Install cargo-binstall (Linux & MacOS)
if: runner.os != 'Windows'
shell: bash
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
Expand All @@ -34,8 +32,27 @@ runs:
shell: bash
run: cargo +${{ inputs.version }} binstall --no-confirm cargo-llvm-cov cargo-nextest flamegraph cargo-hack

- name: Use Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
cache-directories: "${{ github.workspace }}/dist"
# sccache slows CI down, so we leave it disabled.
# Leaving the steps below commented out, so we can re-evaluate enabling it later.
# - name: Use sccache
# uses: mozilla-actions/[email protected]

# - name: Enable sscache
# shell: bash
# run: |
# if [ "${{ runner.os }}" = "Windows" ]; then
# echo "CC=sccache cl" >> "$GITHUB_ENV"
# echo "CXX=sccache cl" >> "$GITHUB_ENV"
# else
# echo "CC=sccache cc" >> "$GITHUB_ENV"
# echo "CXX=sccache c++" >> "$GITHUB_ENV"
# fi
# echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV"
# echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
# echo "CARGO_INCREMENTAL=0" >> "$GITHUB_ENV"

# Ditto for rust-cache.
# - name: Use Rust cache
# uses: Swatinem/rust-cache@v2
# with:
# cache-all-crates: "true"
12 changes: 6 additions & 6 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust
uses: ./.github/actions/rust
with:
version: ${{ matrix.rust-toolchain }}
components: rustfmt, clippy, llvm-tools-preview

- name: Install dependencies (Linux)
if: runner.os == 'Linux'
env:
Expand Down Expand Up @@ -97,6 +91,12 @@ jobs:
# See https://github.com/ilammy/msvc-dev-cmd#name-conflicts-with-shell-bash
rm /usr/bin/link.exe
- name: Install Rust
uses: ./.github/actions/rust
with:
version: ${{ matrix.rust-toolchain }}
components: rustfmt, clippy, llvm-tools-preview

- name: Fetch and build NSS and NSPR
uses: ./.github/actions/nss

Expand Down

0 comments on commit 1df959c

Please sign in to comment.