Skip to content

Add code coverage

Add code coverage #133

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- master
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.3"
- pair:
elixir: "1.16"
otp: "26.2"
lint: lint
coverage: coverage
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.pair.otp}}
elixir-version: ${{matrix.pair.elixir}}
- uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{matrix.pair.elixir}}-${{matrix.pair.otp}}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-
- run: mix deps.get --check-locked
- 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: mix test
run: |
if [ -z "${{ matrix.coverage }}" ]; then
mix test
else
mix coveralls.html
fi