Skip to content

Commit

Permalink
Better CI caching
Browse files Browse the repository at this point in the history
  • Loading branch information
whatyouhide committed Mar 12, 2024
1 parent 758651d commit 582dead
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@ jobs:
lint: lint
coverage: coverage
steps:
- uses: actions/checkout@v4
- name: Check out this repository
uses: actions/checkout@v4

- uses: erlef/setup-beam@v1
- name: Set up Erlang and Elixir
uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.pair.otp }}
elixir-version: ${{ matrix.pair.elixir }}

- uses: actions/cache@v4
- name: Restored cached Mix dependencies (downloaded and compiled)
uses: actions/cache/restore@v4
id: restore-mix-deps-cache
with:
path: |
deps
Expand All @@ -44,20 +48,30 @@ jobs:
${{ runner.os }}-mix-${{ matrix.pair.elixir }}-${{ matrix.pair.otp }}-${{ hashFiles('**/mix.lock') }}-
${{ runner.os }}-mix-${{ matrix.pair.elixir }}-${{ matrix.pair.otp }}-
- run: mix deps.get --check-locked
- name: Fetch and compile Mix dependencies
run: mix do deps.get --check-locked, deps.compile

- run: mix format --check-formatted
if: ${{ matrix.lint }}
- name: Cache compiled Mix dependencies
uses: actions/cache/save@v4
with:
path: |
deps
_build
key: ${{ steps.restore-mix-deps-cache.outputs.cache-primary-key }}

- run: mix deps.unlock --check-unused
- name: Check for formatted files
run: mix format --check-formatted
if: ${{ matrix.lint }}

- run: mix deps.compile
- name: Check for unused dependencies
run: mix deps.unlock --check-unused
if: ${{ matrix.lint }}

- run: mix compile --warnings-as-errors
- name: Check compilation warnings
run: mix compile --warnings-as-errors
if: ${{ matrix.lint }}

- name: mix test
- name: Run tests
run: |
if [ -z "${{ matrix.coverage }}" ]; then
mix test
Expand Down

0 comments on commit 582dead

Please sign in to comment.