Use Rust cache action

This commit is contained in:
Thomas Eizinger 2021-03-04 17:47:39 +11:00
parent 88b3321ec5
commit 52433f7412
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96
2 changed files with 8 additions and 28 deletions

View File

@ -15,15 +15,11 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2
- name: Cache ~/.cargo/bin directory
id: cargo-bin-cache
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/bin
key: ubuntu-rust-${{ hashFiles('rust-toolchain') }}-cargo-bin-directory-v1
- uses: Swatinem/rust-cache@v1.2.0
id: cache
- name: Install tomlfmt
if: steps.cargo-bin-cache.outputs.cache-hit != 'true'
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install cargo-tomlfmt
- name: Check Cargo.toml formatting
@ -58,13 +54,7 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2
- name: Cache target and registry directory
uses: actions/cache@v2.1.4
with:
path: |
target
~/.cargo/registry
key: rust-${{ matrix.target }}-build-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('rust-toolchain') }}-v1
- uses: Swatinem/rust-cache@v1.2.0
- name: Build binary
run: |
@ -99,13 +89,7 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2
- name: Cache target and registry directory
uses: actions/cache@v2.1.4
with:
path: |
target
~/.cargo/registry
key: rust-${{ matrix.target }}-test-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('rust-toolchain') }}-v1
- uses: Swatinem/rust-cache@v1.2.0
- name: Build tests
run: cargo build --tests --workspace --all-features
@ -135,13 +119,7 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2
- name: Cache target and registry directory
uses: actions/cache@v2.1.4
with:
path: |
target
~/.cargo/registry
key: rust-${{ matrix.target }}-test-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('rust-toolchain') }}-v1
- uses: Swatinem/rust-cache@v1.2.0
- name: Run test ${{ matrix.test_name }}
run: cargo test --package swap --all-features --test ${{ matrix.test_name }} ""

View File

@ -27,6 +27,8 @@ jobs:
ref: ${{ github.event.release.target_commitish }}
token: ${{ secrets.BOTTY_GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v1.2.0
- name: Build ${{ matrix.target }} release binary
run: cargo build --target=${{ matrix.target }} --release --package swap --bin swap_cli