Skip to content

Clean up CI and dev setup #32

Clean up CI and dev setup

Clean up CI and dev setup #32

Workflow file for this run

name: Build and test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
elixir-version: '1.14'
otp-version: '25'
- name: Restore dependencies cache
uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: Start supporting services
run: docker compose --profile with-postgres up -d
- name: Ensure Kafka is started
# Copied from: https://github.com/happening-oss/kafka-client/blob/develop/.github/workflows/ci.yml
run: |
# give up after 60 seconds
max_wait_time=60
# Use a loop to check if Kafka is ready
start_time=$(date +%s)
until docker compose logs kafka | grep -q "started"; do
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
if [ "$elapsed_time" -ge "$max_wait_time" ]; then
echo "Kafka did not start within the specified timeout."
exit 1 # Exit the workflow with an error
fi
sleep 5
done
- name: Install dependencies
run: mix deps.get
- name: Setup Database
env:
MIX_ENV: test
run: mix ecto.create && mix ecto.migrate
- name: Check formatting
run: mix format --check-formatted
- name: Test
run: mix test
- name: Dialyzer
run: mix dialyzer