Skip to content

update: deps and dev env #126

update: deps and dev env

update: deps and dev env #126

Workflow file for this run

name: ci
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
env:
MIX_ENV: test
strategy:
matrix:
include:
- elixir: 1.18
otp: 28
- elixir: 1.18
otp: 27
- elixir: 1.18
otp: 26
- elixir: 1.17
otp: 27
- elixir: 1.17
otp: 26
- elixir: 1.17
otp: 25
- elixir: 1.16
otp: 25
- elixir: 1.16
otp: 24
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Cache Elixir deps
uses: actions/cache@v4
id: deps-cache
with:
path: deps
key: ${{ runner.os }}-mix-${{ env.MIX_ENV }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Cache Elixir _build
uses: actions/cache@v4
id: build-cache
with:
path: _build
key: ${{ runner.os }}-build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Install deps
if: steps.deps-cache.outputs.cache-hit != 'true'
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get --only ${{ env.MIX_ENV }}
- name: Compile deps
if: steps.build-cache.outputs.cache-hit != 'true'
run: mix deps.compile --warnings-as-errors
- name: Clean build
run: mix clean
- name: Check code formatting
if: matrix.elixir != '1.16'
run: mix format --check-formatted
- name: Run Credo
run: mix credo --strict
static-analysis:
runs-on: ubuntu-latest
env:
MIX_ENV: test
strategy:
matrix:
include:
- elixir: 1.18
otp: 28
- elixir: 1.18
otp: 27
- elixir: 1.18
otp: 26
- elixir: 1.17
otp: 27
- elixir: 1.17
otp: 26
- elixir: 1.17
otp: 25
- elixir: 1.16
otp: 25
- elixir: 1.16
otp: 24
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Cache Elixir deps
uses: actions/cache@v4
id: deps-cache
with:
path: deps
key: ${{ runner.os }}-mix-${{ env.MIX_ENV }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Cache Elixir _build
uses: actions/cache@v4
id: build-cache
with:
path: _build
key: ${{ runner.os }}-build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Install deps
if: steps.deps-cache.outputs.cache-hit != 'true'
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get --only ${{ env.MIX_ENV }}
- name: Compile deps
if: steps.build-cache.outputs.cache-hit != 'true'
run: mix deps.compile --warnings-as-errors
# Ensure PLTs directory exists
- name: Create PLTs directory
run: mkdir -p priv/plts
# Cache PLTs based on Elixir & Erlang version + mix.lock hash
- name: Restore/Save PLT cache
uses: actions/cache@v4
id: plt_cache
with:
path: priv/plts
key: plt-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
# Create PLTs if no cache was found
- name: Create PLTs
if: steps.plt_cache.outputs.cache-hit != 'true'
run: mix dialyzer --plt
- name: Run dialyzer
run: mix dialyzer --format github
test:
runs-on: ubuntu-latest
env:
MIX_ENV: test
strategy:
matrix:
include:
- elixir: 1.18
otp: 28
- elixir: 1.18
otp: 27
- elixir: 1.18
otp: 26
- elixir: 1.17
otp: 27
- elixir: 1.17
otp: 26
- elixir: 1.17
otp: 25
- elixir: 1.16
otp: 25
- elixir: 1.16
otp: 24
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Cache Elixir deps
uses: actions/cache@v4
id: deps-cache
with:
path: deps
key: ${{ runner.os }}-mix-${{ env.MIX_ENV }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Cache Elixir _build
uses: actions/cache@v4
id: build-cache
with:
path: _build
key: ${{ runner.os }}-build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Install deps
if: steps.deps-cache.outputs.cache-hit != 'true'
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get --only ${{ env.MIX_ENV }}
- name: Compile deps
if: steps.build-cache.outputs.cache-hit != 'true'
run: mix deps.compile --warnings-as-errors
- name: Clean build
run: mix clean
- name: Run tests
run: mix test --warnings-as-errors