feat: add gh workflow #439
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: Staging Formatting Checks | |
on: | |
pull_request: | |
branches: | |
- main | |
env: | |
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }} | |
jobs: | |
format: | |
name: Formatting Checks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup elixir | |
id: beam | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: 25.x # Define the OTP version [required] | |
elixir-version: 1.14.x # Define the elixir version [required] | |
- 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 | |
- name: Set up Postgres | |
run: docker-compose -f ./docker-compose.db.yml up -d | |
- name: Run main database migrations | |
run: mix ecto.migrate --prefix _supavisor --log-migrator-sql | |
- name: Run format check | |
run: mix format --check-formatted | |
- name: Credo checks | |
run: mix credo --strict --mute-exit-status | |
- 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 | |
- name: Start epmd | |
run: epmd -daemon | |
- name: Run tests | |
run: mix test |