From 3bbb3d24c2ed1df899dc20e33b32c11f1120acff Mon Sep 17 00:00:00 2001 From: Adrian Kumpf <8999358+adriankumpf@users.noreply.github.com> Date: Mon, 22 May 2023 09:53:14 +0200 Subject: [PATCH] Tweak action caching --- .github/workflows/ci.yml | 57 +++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ccd4c9..eaa49e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,9 +21,6 @@ jobs: - pair: elixir: "1.14.4" otp: "26.0" - - pair: - elixir: "1.14.4" - otp: "25.3" lint: lint - pair: elixir: "1.12.3" @@ -31,16 +28,42 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/cache@v3.3.1 + - uses: erlef/setup-beam@v1 + id: beam with: - path: | - deps - _build - key: ${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + otp-version: ${{matrix.pair.otp}} + elixir-version: ${{matrix.pair.elixir}} + version-type: "strict" + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Cache deps + id: cache-deps + uses: actions/cache@v3 + env: + cache-name: cache-elixir-deps + with: + path: deps + key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} restore-keys: | - ${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-mix- + ${{ runner.os }}-mix-${{ env.cache-name }}- - - uses: actions/cache@v3.3.1 + - name: Cache compiled build + id: cache-build + uses: actions/cache@v3 + env: + cache-name: cache-compiled-build + with: + path: _build + key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ matrix.pair.elixir }}-${{ matrix.pair.otp }}-${{ hashFiles('**/mix.lock') }} + restore-keys: | + ${{ runner.os }}-mix-${{ env.cache-name }}-${{ matrix.pair.elixir }}-${{ matrix.pair.otp }}- + ${{ runner.os }}-mix-${{ env.cache-name }}- + ${{ runner.os }}-mix- + + - name: Cache NIF build + uses: actions/cache@v3 with: path: | ~/.cargo/bin/ @@ -50,14 +73,12 @@ jobs: native/arb/target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - uses: erlef/setup-beam@v1 - with: - otp-version: ${{matrix.pair.otp}} - elixir-version: ${{matrix.pair.elixir}} - version-type: "strict" - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable + - name: Clean to rule out incremental build as a source of flakiness + if: github.run_attempt != '1' + run: | + mix deps.clean --all + mix clean + shell: sh - name: Install Dependencies run: mix deps.get