test drone

This commit is contained in:
Moritz 2025-04-23 18:01:18 +02:00 committed by Rafael Epplée
parent 77632bedec
commit 817689a975

View file

@ -3,62 +3,62 @@ type: docker
name: default name: default
services: services:
- name: postgres - name: postgres
image: docker.io/library/postgres:17.2 image: docker.io/library/postgres:17.2
environment: environment:
POSTGRES_USER: postgres POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: postgres
trigger: trigger:
event: event:
- push - push
steps: steps:
- name: check - name: check
image: docker.io/library/elixir:1.18.3-otp-27 image: docker.io/library/elixir:1.18.3-otp-27
commands: commands:
# Install hex package manager # Install hex package manager
- mix local.hex --force - mix local.hex --force
# Fetch dependencies # Fetch dependencies
- mix deps.get - mix deps.get
# Check for compilation errors & warnings # Check for compilation errors & warnings
- mix compile --warnings-as-errors - mix compile --warnings-as-errors
# Check formatting # Check formatting
- mix format --check-formatted - mix format --check-formatted
# Security checks # Security checks
- mix sobelow --config - mix sobelow --config
# Check dependencies for known vulnerabilities # Check dependencies for known vulnerabilities
- mix deps.audit - mix deps.audit
# Check for dependencies that are not maintained anymore # Check for dependencies that are not maintained anymore
- mix hex.audit - mix hex.audit
# Provide hints for improving code quality # Provide hints for improving code quality
- mix credo - mix credo
- name: wait_for_postgres - name: wait_for_postgres
image: docker.io/library/postgres:17.2 image: docker.io/library/postgres:17.2
commands: commands:
# Wait for postgres to become available # Wait for postgres to become available
- | - |
for i in {1..20}; do for i in {1..20}; do
if pg_isready -h postgres -U postgres; then if pg_isready -h postgres -U postgres; then
exit 0 exit 0
else else
true true
fi fi
sleep 2 sleep 2
done done
echo "Postgres did not become available, aborting." echo "Postgres did not become available, aborting."
exit 1 exit 1
- name: test - name: test
image: docker.io/library/elixir:1.18.3-otp-27 image: docker.io/library/elixir:1.18.3-otp-27
environment: environment:
MIX_ENV: test MIX_ENV: test
TEST_POSTGRES_HOST: postgres TEST_POSTGRES_HOST: postgres
commands: commands:
# Install hex package manager # Install hex package manager
- mix local.hex --force - mix local.hex --force
# Fetch dependencies # Fetch dependencies
- mix deps.get - mix deps.get
# Run tests # Run tests
- mix test - mix test