Skip to content

Merge pull request #290 from sneako/v0.19.0 #943

Merge pull request #290 from sneako/v0.19.0

Merge pull request #290 from sneako/v0.19.0 #943

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
jobs:
mix_test:
runs-on: ubuntu-20.04
env:
MIX_ENV: test
strategy:
fail-fast: false
matrix:
include:
- pair:
elixir: "1.11.4"
otp: "22.x"
- pair:
elixir: "1.16.0"
otp: "26.x"
lint: lint
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: deps
key: deps-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-${{ hashFiles('**/mix.lock') }}
restore-keys: deps-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-
- uses: actions/cache@v4
with:
path: _build
key: build-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-${{ hashFiles('**/mix.lock') }}
restore-keys: build-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-
- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.pair.otp}}
elixir-version: ${{matrix.pair.elixir}}
# Don't cache PLTs based on mix.lock hash, as Dialyzer can incrementally update even old ones
# Cache key based on Elixir & Erlang version (also useful when running in matrix)
- name: Cache Dialyzer's PLT
uses: actions/cache@v4
if: ${{ matrix.lint }}
id: cache-plt
with:
path: _build/test
key: |
${{ runner.os }}-plt-otp${{ matrix.erlang }}-elixir${{ matrix.elixir }}
- name: Install Dependencies
run: mix deps.get
# Create PLTs if no cache was found
- name: Create PLTs
if: ${{ matrix.lint && steps.cache-plt.outputs.cache-hit != 'true' }}
run: mix dialyzer --plt
- run: mix format --check-formatted
if: ${{ matrix.lint }}
- run: mix deps.unlock --check-unused
if: ${{ matrix.lint }}
- run: mix deps.compile
- run: mix compile --warnings-as-errors
if: ${{ matrix.lint }}
- name: Run Credo
run: mix credo
if: ${{ matrix.lint }}
- name: Run Tests
run: mix test
if: ${{ ! matrix.lint }}
- name: Run Tests
run: mix test --warnings-as-errors
if: ${{ matrix.lint }}
- name: Run Dialyzer
run: mix dialyzer
if: ${{ matrix.lint }}