chore: split Elixir tasks #8
Workflow file for this run
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: Elixir tests | |
on: | |
pull_request: | |
branches: | |
- main | |
env: | |
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }} | |
jobs: | |
deps: | |
name: Fetch deps | |
runs-on: u22-arm-runner | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: '25.3.2.7' | |
elixir-version: '1.17' | |
- name: Cache Mix | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
restore-keys: | | |
${{ runner.os }}-mix- | |
- name: Install dependencies | |
run: mix deps.get | |
compile-dev: | |
name: Compile project in dev env | |
runs-on: u22-arm-runner | |
needs: [deps] | |
env: | |
MIX_ENV: dev | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: '25.3.2.7' | |
elixir-version: '1.17' | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Cache Mix | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
restore-keys: | | |
${{ runner.os }}-mix- | |
- name: Cache Build | |
uses: actions/cache@v3 | |
with: | |
path: _build/dev | |
key: ${{ runner.os }}-build-dev-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
restore-keys: | | |
${{ runner.os }}-build-dev- | |
- name: Compile | |
run: mix compile | |
compile-test: | |
name: Compile project in test env | |
runs-on: u22-arm-runner | |
needs: [deps] | |
env: | |
MIX_ENV: test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: '25.3.2.7' | |
elixir-version: '1.17' | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Cache Mix | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
restore-keys: | | |
${{ runner.os }}-mix- | |
- name: Cache Build | |
uses: actions/cache@v3 | |
with: | |
path: _build/test | |
key: ${{ runner.os }}-build-test-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
restore-keys: | | |
${{ runner.os }}-build-test- | |
- name: Compile | |
run: mix compile | |
format: | |
name: Formatting checks | |
runs-on: u22-arm-runner | |
needs: [deps] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: '25.3.2.7' | |
elixir-version: '1.17' | |
- name: Cache Mix | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
restore-keys: | | |
${{ runner.os }}-mix- | |
- name: Cache Build | |
uses: actions/cache@v3 | |
with: | |
path: _build | |
key: ${{ runner.os }}-build-dev-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
restore-keys: | | |
${{ runner.os }}-build-dev- | |
- name: Run format check | |
run: mix format --check-formatted | |
credo: | |
name: Code style | |
runs-on: u22-arm-runner | |
needs: [compile-dev] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: '25.3.2.7' | |
elixir-version: '1.17' | |
- name: Cache Mix | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
restore-keys: | | |
${{ runner.os }}-mix- | |
- name: Cache Build | |
uses: actions/cache@v3 | |
with: | |
path: _build/dev | |
key: ${{ runner.os }}-build-dev-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
restore-keys: | | |
${{ runner.os }}-build-dev- | |
- name: Credo checks | |
run: mix credo --strict --mute-exit-status | |
tests: | |
name: Run tests | |
runs-on: u22-arm-runner | |
needs: [compile-test] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: '25.3.2.7' | |
elixir-version: '1.17' | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Cache Mix | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
restore-keys: | | |
${{ runner.os }}-mix- | |
- name: Cache Build | |
uses: actions/cache@v3 | |
with: | |
path: _build/test | |
key: ${{ runner.os }}-build-test-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
restore-keys: | | |
${{ runner.os }}-build-test- | |
- name: Set up Postgres | |
run: docker-compose -f ./docker-compose.db.yml up -d | |
- name: Run main database migrations | |
env: | |
MIX_ENV: test | |
run: mix do ecto.create, ecto.migrate --prefix _supavisor --log-migrator-sql | |
- name: Start epmd | |
run: epmd -daemon | |
- name: Run tests | |
run: mix test | |
dialyzer: | |
name: Dialyze | |
runs-on: u22-arm-runner | |
needs: [compile-dev] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: '25.3.2.7' | |
elixir-version: '1.17' | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Cache Mix | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
restore-keys: | | |
${{ runner.os }}-mix- | |
- name: Cache Build | |
uses: actions/cache@v3 | |
with: | |
path: _build/dev | |
key: ${{ runner.os }}-build-dev-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
restore-keys: | | |
${{ runner.os }}-build-dev- | |
- name: Retrieve PLT Cache | |
uses: actions/cache@v3 | |
id: plt-cache | |
with: | |
path: priv/plts | |
key: ${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-plts-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- name: Create PLTs | |
if: steps.plt-cache.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p priv/plts | |
mix dialyzer.build | |
- name: Run dialyzer | |
run: mix dialyzer |