Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
use test cache for build lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-Steiner committed May 20, 2021
1 parent 14f47e7 commit 3ec60be
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ jobs:
needs: [registry-cache, check]
runs-on: ubuntu-20.04
timeout-minutes: 20
outputs:
cache-key: ${{ steps.cache-key.outputs.key }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand All @@ -201,11 +203,16 @@ jobs:
~/.cargo/git
key: ${{ needs.registry-cache.outputs.cache-key }}

- name: Generate build artifacts key
id: cache-key
shell: bash
run: echo "::set-output name=key::$(echo "${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tests-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }}")"

- name: Cache build artifacts
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/target
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tests-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }}
key: ${{ steps.cache-key.outputs.key }}
restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-tests-${{ needs.registry-cache.outputs.cache-date }}-

- name: Download data
Expand Down Expand Up @@ -476,10 +483,14 @@ jobs:
uses: actions/cache@v2.1.4
with:
path: ${{ github.workspace }}/target
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-linux-${{ needs.registry-cache.outputs.cache-date }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc }}-build-linux-${{ needs.registry-cache.outputs.cache-date }}-
key: ${{ needs.test.outputs.cache-key }}

- name: Build linux lib
# We have to use the same RUSTFLAGS that are used in the test
# job in order to be able to reuse the cache. If we do not do this,
# the compiler will recompile all the libraries from scratch.
env:
RUSTFLAGS: "-D warnings"
run: cargo build

- name: Generate lib artifacts key
Expand Down

0 comments on commit 3ec60be

Please sign in to comment.