From 3ec60bea29c1cd5ed00a4af0a9e2a40af0441482 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Thu, 20 May 2021 10:16:43 +0200 Subject: [PATCH] use test cache for build lib --- .github/workflows/ci.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5430daa45..e011aa942 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -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