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.
This commit is contained in:
Jamil
2023-10-16 10:16:18 -07:00
committed by GitHub
parent b639c2b231
commit 2a99cc39e9
4 changed files with 8 additions and 14 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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: