Fix CI (#3) #30
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: Build and test | |
on: | |
push: | |
branches: [ master, fix_ci ] | |
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 Schema Registry 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 Schema Registry is ready | |
start_time=$(date +%s) | |
until docker compose logs schema-registry | grep -q "started"; do | |
current_time=$(date +%s) | |
elapsed_time=$((current_time - start_time)) | |
if [ "$elapsed_time" -ge "$max_wait_time" ]; then | |
echo "Schema Registry 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 |