Skip to content

Add Dialyxir

Add Dialyxir #11

Workflow file for this run

name: Elixir CI
on:
push:
branches:
- main
pull_request:
paths:
- "elixir/**"
env:
MIX_ENV: test
permissions:
contents: read
jobs:
test:
name: Lint and Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: elixir
strategy:
matrix:
otp: ['26.1']
elixir: ['1.15.7']
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Install Erlang/Elixir
uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
- name: Cache deps
uses: actions/cache@v3
id: cache-deps
env:
cache-name: cache-elixir-deps
with:
path: elixir/deps
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('elixir/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
- name: Cache compiled build
id: cache-build
uses: actions/cache@v3
env:
cache-name: cache-compiled-build
with:
path: elixir/_build
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('elixir/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
${{ runner.os }}-mix-
- name: Install Dependencies
run: mix deps.get
- name: Compile
run: mix compile --warnings-as-errors
- name: Run Linter
run: mix lint.ci
- name: Restore PLT cache
id: plt_cache
uses: actions/cache/restore@v3
with:
key: |
plt-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('elixir/mix.lock') }}
restore-keys: |
plt-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-
path: |
elixir/priv/plts
# Create PLTs if no cache was found
- name: Create PLTs
if: steps.plt_cache.outputs.cache-hit != 'true'
run: mix dialyzer --plt
# By default, the GitHub Cache action will only save the cache if all steps in the job succeed,
# so we separate the cache restore and save steps in case running dialyzer fails.
- name: Save PLT cache
id: plt_cache_save
uses: actions/cache/save@v3
if: steps.plt_cache.outputs.cache-hit != 'true'
with:
key: |
plt-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('elixir/mix.lock') }}
path: |
elixir/priv/plts
- name: Run Dialyzer
run: mix dialyzer --format github
- name: Run Tests
run: mix coveralls.json
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./elixir/cover/excoveralls.json
flags: elixir