Support Elixir 17/Erlang OTP 27 in CI (#161) #151
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-20.04 | |
env: | |
MIX_ENV: test | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- pair: | |
elixir: "1.11" | |
otp: "21" | |
- pair: | |
elixir: "1.17" | |
otp: "27" | |
lint: lint | |
coverage: coverage | |
steps: | |
- name: Check out this repository | |
uses: actions/checkout@v4 | |
- name: Set up Erlang and Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ matrix.pair.otp }} | |
elixir-version: ${{ matrix.pair.elixir }} | |
- name: Restored cached Mix dependencies (downloaded and compiled) | |
uses: actions/cache/restore@v4 | |
id: restore-mix-deps-cache | |
with: | |
path: | | |
deps | |
_build | |
key: | | |
${{ runner.os }}-mix-${{ matrix.pair.elixir }}-${{ matrix.pair.otp }}-${{ hashFiles('**/mix.lock') }}-${{ github.run_id }} | |
restore-keys: | | |
${{ runner.os }}-mix-${{ matrix.pair.elixir }}-${{ matrix.pair.otp }}-${{ hashFiles('**/mix.lock') }}- | |
${{ runner.os }}-mix-${{ matrix.pair.elixir }}-${{ matrix.pair.otp }}- | |
- name: Fetch and compile Mix dependencies | |
run: mix do deps.get --check-locked, deps.compile | |
- name: Cache compiled Mix dependencies | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ steps.restore-mix-deps-cache.outputs.cache-primary-key }} | |
- name: Check for formatted files | |
run: mix format --check-formatted | |
if: ${{ matrix.lint }} | |
- name: Check for unused dependencies | |
run: mix deps.unlock --check-unused | |
if: ${{ matrix.lint }} | |
- name: Check compilation warnings | |
run: mix compile --warnings-as-errors | |
if: ${{ matrix.lint }} | |
# We always need to run tests because code coverage forces us to skip some | |
# tests, so better to run normal tests on the whole matrix and the coverage | |
# only on the latest version. | |
- name: Run tests | |
run: mix test | |
- name: Run tests with coverage | |
if: ${{ matrix.coverage }} | |
run: mix coveralls.github --exclude fails_on_coverage |