Update rust-toolchain to new toml syntax

This allows us to completely skip the "Install Rust" step in CI
because the rust-toolchain file completely describes what we need.
The first invocation of cargo will simply install all the required
components.

Additionally, we make all caches dependant on the version of Rust
that we require.
pull/205/head
Thomas Eizinger 3 years ago
parent 8072f4d7ee
commit fb45ff66eb
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96

@ -15,19 +15,12 @@ jobs:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
components: rustfmt, clippy
- name: Cache ~/.cargo/bin directory - name: Cache ~/.cargo/bin directory
id: cargo-bin-cache id: cargo-bin-cache
uses: actions/cache@v2.1.4 uses: actions/cache@v2.1.4
with: with:
path: ~/.cargo/bin path: ~/.cargo/bin
key: ubuntu-rust-${{ env.RUST_TOOLCHAIN }}-cargo-bin-directory-v1 key: ubuntu-rust-${{ hashFiles('rust-toolchain') }}-cargo-bin-directory-v1
- name: Install tomlfmt - name: Install tomlfmt
if: steps.cargo-bin-cache.outputs.cache-hit != 'true' if: steps.cargo-bin-cache.outputs.cache-hit != 'true'
@ -63,19 +56,13 @@ jobs:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
- name: Cache target and registry directory - name: Cache target and registry directory
uses: actions/cache@v2.1.4 uses: actions/cache@v2.1.4
with: with:
path: | path: |
target target
~/.cargo/registry ~/.cargo/registry
key: rust-${{ matrix.target }}-build-${{ hashFiles('Cargo.lock') }}-v1 key: rust-${{ matrix.target }}-build-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('rust-toolchain') }}-v1
- name: Build binary - name: Build binary
run: | run: |
@ -110,19 +97,13 @@ jobs:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
- name: Cache target and registry directory - name: Cache target and registry directory
uses: actions/cache@v2.1.4 uses: actions/cache@v2.1.4
with: with:
path: | path: |
target target
~/.cargo/registry ~/.cargo/registry
key: rust-${{ matrix.target }}-test-${{ hashFiles('Cargo.lock') }}-v1 key: rust-${{ matrix.target }}-test-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('rust-toolchain') }}-v1
- name: Build tests - name: Build tests
run: cargo build --tests --workspace --all-features run: cargo build --tests --workspace --all-features
@ -152,19 +133,13 @@ jobs:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
- name: Cache target and registry directory - name: Cache target and registry directory
uses: actions/cache@v2.1.4 uses: actions/cache@v2.1.4
with: with:
path: | path: |
target target
~/.cargo/registry ~/.cargo/registry
key: rust-${{ matrix.target }}-test-${{ hashFiles('Cargo.lock') }}-v1 key: rust-${{ matrix.target }}-test-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('rust-toolchain') }}-v1
- name: Run test ${{ matrix.test_name }} - name: Run test ${{ matrix.test_name }}
run: cargo test --package swap --all-features --test ${{ matrix.test_name }} "" run: cargo test --package swap --all-features --test ${{ matrix.test_name }} ""

@ -1 +1,3 @@
nightly-2021-01-31 [toolchain]
channel = "nightly-2021-01-31"
components = ["rustfmt", "clippy"]

Loading…
Cancel
Save