From 2a99cc39e95d96cbe430bee524a07cf7344d838b Mon Sep 17 00:00:00 2001 From: Jamil Date: Mon, 16 Oct 2023 10:16:18 -0700 Subject: [PATCH] Install and cache Rust toolchain (#2353) On GH-hosted runners, this isn't a problem. But on self-hosted runners with persistent disks, we hit this issue: https://github.com/Swatinem/rust-cache#known-issues This PR should fix that by ensuring the Rust toolchain is installed. It also installs the toolchain after the cache has been restored so we can take advantage of any cached artifacts. --- .github/workflows/kotlin.yml | 4 +--- .github/workflows/rust.yml | 11 +++++------ .github/workflows/static-analysis.yml | 3 +-- .github/workflows/swift.yml | 4 +--- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/kotlin.yml b/.github/workflows/kotlin.yml index 6729da90b..fc4025f24 100644 --- a/.github/workflows/kotlin.yml +++ b/.github/workflows/kotlin.yml @@ -32,14 +32,12 @@ jobs: working-directory: ./kotlin/android steps: - uses: actions/checkout@v4 - - name: Update toolchain - run: rustup show - working-directory: ./rust - uses: Swatinem/rust-cache@v2 with: workspaces: ./rust key: ubuntu-22.04-${{ runner.arch }} save-if: ${{ github.ref == 'refs/heads/main' }} + - uses: dtolnay/rust-toolchain@stable - uses: actions/setup-java@v3 with: distribution: temurin diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ccfa12ed1..10b0ec076 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,13 +27,14 @@ jobs: runs-on: ${{ matrix.runs-on }} steps: - uses: actions/checkout@v4 - - name: Update toolchain - run: rustup show - uses: Swatinem/rust-cache@v2 with: workspaces: ./rust save-if: ${{ github.ref == 'refs/heads/main' }} key: ${{ matrix.runs-on }}-${{ runner.arch }} + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt,clippy - run: cargo fmt -- --check - run: | cargo doc --all-features --no-deps --document-private-items ${{ matrix.packages }} @@ -62,14 +63,13 @@ jobs: runs-on: ${{ matrix.runs-on }} steps: - uses: actions/checkout@v4 - - name: Update toolchain - run: rustup show - uses: Swatinem/rust-cache@v2 with: # Prevents runner.os caches from conflicting key: ${{ matrix.runs-on }}-${{ runner.arch }} workspaces: ./rust save-if: ${{ github.ref == 'refs/heads/main' }} + - uses: dtolnay/rust-toolchain@stable - run: cargo test --all-features ${{ matrix.packages }} smoke-test-relay: @@ -79,11 +79,10 @@ jobs: working-directory: ./rust/relay steps: - uses: actions/checkout@v4 - - name: Update toolchain - run: rustup show - uses: Swatinem/rust-cache@v2 with: workspaces: ./rust key: ubuntu-22.04-${{ runner.arch }} save-if: ${{ github.ref == 'refs/heads/main' }} + - uses: dtolnay/rust-toolchain@stable - run: ./run_smoke_test.sh diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 8bf419f98..7d33ceae2 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -7,13 +7,12 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - name: Update toolchain - run: rustup show - uses: Swatinem/rust-cache@v2 with: workspaces: ./rust key: ubuntu-22.04-${{ runner.arch }} save-if: ${{ github.ref == 'refs/heads/main' }} + - uses: dtolnay/rust-toolchain@stable - name: Check version is up to date run: | make version diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 2ffa35bd1..b5480423b 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -48,14 +48,12 @@ jobs: working-directory: ./swift/apple steps: - uses: actions/checkout@v4 - - name: Update toolchain - run: rustup show - working-directory: ./rust - uses: Swatinem/rust-cache@v2 with: workspaces: ./rust key: ${{ matrix.runs-on }}-${{ runner.arch }} save-if: ${{ github.ref == 'refs/heads/main' }} + - uses: dtolnay/rust-toolchain@stable - uses: actions/cache/restore@v3 name: Restore Swift DerivedData Cache with: