Skip to content

add mix format and dialyzer to CI #4

add mix format and dialyzer to CI

add mix format and dialyzer to CI #4

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Lint and style checks
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
# Sets the ENV `MIX_ENV` to `test` for running tests
env:
MIX_ENV: test
ELIXIR_VER: '1.14.3'
OTP_VER: '25.2.3'
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
name: Dialyzer
steps:
# Step: Setup Elixir + Erlang image as the base.
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VER }}
elixir-version: ${{ env.ELIXIR_VER }}
# Step: Check out the code.
- name: Checkout code
uses: actions/checkout@v4
# Step: Define how to cache deps. Restores existing cache if present.
- name: Cache deps
id: cache-deps
uses: actions/cache@v4
env:
cache-name: cache-elixir-deps
with:
path: deps
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
# Step: Define how to cache the `_build` directory. After the first run,
# this speeds up tests runs a lot. This includes not re-compiling our
# project's downloaded deps every run.
- name: Cache compiled build
id: cache-build
uses: actions/cache@v4
env:
cache-name: cache-compiled-build
with:
path: _build
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
# Step: Download project dependencies. If unchanged, uses
# the cached version.
- name: Install dependencies
run: mix deps.get
- name: Restore PLT cache
uses: actions/cache/restore@v3
id: plt_cache
with:
key: |
${{ runner.os }}-${{ env.ELIXIR_VER }}-${{ env.OTP_VER }}-plt
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VER }}-${{ env.OTP_VER }}-plt
path: |
priv/plts
- name: Create PLTs
run: mix dialyzer --plt
- name: Save PLT cache
uses: actions/cache/save@v3
if: steps.plt_cache.outputs.cache-hit != 'true'
id: plt_cache_save
with:
key: |
${{ runner.os }}-${{ env.ELIXIR_VER }}-${{ env.OTP_VER }}-plt
path: |
priv/plts
- name: Run dialyzer
run: mix dialyzer --format github