Skip to content

Merge pull request #12 from wintermeyer/refactoring #42

Merge pull request #12 from wintermeyer/refactoring

Merge pull request #12 from wintermeyer/refactoring #42

Workflow file for this run

name: Elixir CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
services:
db:
image: postgres:13
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: animina_test
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache Asdf installation and plugins
uses: actions/cache@v4
with:
path: |
~/.asdf
~/.asdf/plugins/*
~/.asdf/installs/*
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
- name: Install Asdf
run: |
if [ ! -d $HOME/.asdf ]; then
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.0
echo -e "\n. $HOME/.asdf/asdf.sh" >> $HOME/.bashrc
echo -e "\n. $HOME/.asdf/completions/asdf.bash" >> $HOME/.bashrc
fi
- name: Install Erlang and Elixir from .tool-versions
run: |
. $HOME/.asdf/asdf.sh
asdf plugin-add erlang || true
asdf plugin-add elixir || true
erlang_version=$(grep erlang .tool-versions | cut -d " " -f2)
elixir_version=$(grep elixir .tool-versions | cut -d " " -f2)
asdf install erlang $erlang_version
asdf global erlang $erlang_version
asdf install elixir $elixir_version
asdf global elixir $elixir_version
- name: Install dependencies
run: |
. $HOME/.asdf/asdf.sh
mix local.hex --force
mix local.rebar --force
mix deps.get
mix compile
- name: Create and migrate database
env:
MIX_ENV: test
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: animina_test
run: |
. $HOME/.asdf/asdf.sh
mix ecto.create
mix ecto.migrate
- name: Run tests
env:
MIX_ENV: test
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: animina_test
run: |
. $HOME/.asdf/asdf.sh
mix test
- name: Run Credo
run: |
. $HOME/.asdf/asdf.sh
mix credo --strict
# For Emacs:
# Local Variables:
# mode: yaml
# indent-tabs-mode: nil
# tab-width: 2
# c-basic-offset: 2
# End:
#
# For VIM:
# vim: set softtabstop=2 shiftwidth=2 tabstop=2 expandtab: