Added a new route and template for the first 4 fields #719
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: CI | |
on: [pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-20.04 | |
name: OTP ${{ matrix.otp }} / Elixir ${{ matrix.elixir }} | |
strategy: | |
matrix: | |
otp: ["26.2.5"] | |
elixir: ["1.16.3"] | |
services: | |
db: | |
image: postgres:13-alpine | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: animina_test | |
ports: ["5432:5432"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ matrix.otp }} | |
elixir-version: ${{ matrix.elixir }} | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.mix | |
~/.hex | |
deps | |
_build | |
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
restore-keys: | | |
${{ runner.os }}-mix- | |
- name: Install dependencies | |
run: | | |
mix local.hex --force | |
mix local.rebar --force | |
mix deps.get | |
- name: Compile the project with warnings as errors in source files | |
run: mix compile --warnings-as-errors lib/**/*.ex | |
- name: Check formatting | |
run: mix format --check-formatted | |
- name: Restore database from cache | |
id: restore-db | |
uses: actions/cache@v3 | |
with: | |
path: db_dump.sql | |
key: ${{ runner.os }}-db-${{ hashFiles('priv/repo/migrations/**/*', 'priv/repo/seeds.exs') }} | |
restore-keys: | | |
${{ runner.os }}-db- | |
- name: Restore database from dump | |
if: steps.restore-db.outputs.cache-hit == 'true' | |
env: | |
PGHOST: localhost | |
PGUSER: postgres | |
PGPASSWORD: postgres | |
PGDATABASE: animina_test | |
run: | | |
pg_restore -U postgres -d animina_test db_dump.sql | |
- name: Setup and dump database if no cache | |
if: steps.restore-db.outputs.cache-hit != 'true' | |
env: | |
PGHOST: localhost | |
PGUSER: postgres | |
PGPASSWORD: postgres | |
PGDATABASE: animina_test | |
run: | | |
mix ecto.create | |
mix ecto.migrate | |
mix run priv/repo/seeds.exs | |
pg_dump -Fc -f db_dump.sql -U postgres animina_test | |
- name: Cache database dump | |
if: steps.restore-db.outputs.cache-hit != 'true' | |
uses: actions/cache@v3 | |
with: | |
path: db_dump.sql | |
key: ${{ runner.os }}-db-${{ hashFiles('priv/repo/migrations/**/*', 'priv/repo/seeds.exs') }} | |
- name: Run tests | |
env: | |
MIX_ENV: test | |
PGHOST: localhost | |
PGUSER: postgres | |
PGPASSWORD: postgres | |
PGDATABASE: animina_test | |
CI: true # Set a CI environment variable | |
DISABLE_ML_FEATURES: true # Disable ML features | |
run: mix test | |
- name: Run Credo | |
run: mix credo --strict |