Skip to content

Commit

Permalink
Implement cache in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-ferraz-oliveira committed Jun 8, 2024
1 parent 3c81e4c commit 9db9cc1
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ on:

jobs:
build:
name: Test on OTP ${{ matrix.tuple.otp_version }} and ${{ matrix.tuple.os }}
runs-on: ${{ matrix.tuple.os }}
name: Test on OTP ${{ matrix.otp_version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
tuple:
include:
- otp_version: 25
os: ubuntu-22.04
rebar3_version: 3.22
Expand All @@ -25,18 +25,39 @@ jobs:
rebar3_version: 3.22
- otp_version: 23
os: ubuntu-20.04
rebar3_version: 3.15
rebar3_version: 3.18
- otp_version: 22
os: ubuntu-20.04
rebar3_version: 3.15
rebar3_version: 3.18

steps:
- uses: actions/checkout@v4

- uses: erlef/setup-beam@v1
id: setup-beam
with:
otp-version: ${{ matrix.tuple.otp_version }}
rebar3-version: ${{ matrix.tuple.rebar3_version }}
otp-version: ${{ matrix.otp_version }}
rebar3-version: ${{ matrix.rebar3_version }}

- name: Restore _build
uses: actions/cache@v3
with:
path: _build
key: "_build-cache-for\
-os-${{ matrix.os }}\
-otp-${{ steps.setup-beam.outputs.otp-version }}\
-rebar3-${{ steps.setup-beam.outputs.rebar3-version }}\
-hash-${{ hashFiles('rebar.lock') }}"

- name: Restore rebar3's cache
uses: actions/cache@v3
with:
path: ~/.cache/rebar3
key: "rebar3-cache-for\
-os-${{ matrix.os }}\
-otp-${{ steps.setup-beam.outputs.otp-version }}\
-rebar3-${{ steps.setup-beam.outputs.rebar3-version }}\
-hash-${{ hashFiles('rebar.lock') }}"

- name: Compile
run: rebar3 compile
Expand Down

0 comments on commit 9db9cc1

Please sign in to comment.