This commit is contained in:
parent
2bdf7f6f72
commit
765d5ee199
1 changed files with 9 additions and 86 deletions
95
.drone.yml
95
.drone.yml
|
|
@ -14,126 +14,49 @@ trigger:
|
|||
- push
|
||||
|
||||
steps:
|
||||
- name: compute cache key
|
||||
image: docker.io/library/elixir:1.18.3-otp-27
|
||||
commands:
|
||||
- mix_lock_hash=$(sha256sum mix.lock | cut -d ' ' -f 1)
|
||||
- echo "$DRONE_REPO_OWNER/$DRONE_REPO_NAME/$mix_lock_hash" >> .cache_key
|
||||
# Print cache key for debugging
|
||||
- cat .cache_key
|
||||
|
||||
- name: restore-cache
|
||||
image: drillster/drone-volume-cache
|
||||
settings:
|
||||
restore: true
|
||||
mount:
|
||||
- ./deps
|
||||
- ./.hex-cache
|
||||
ttl: 30
|
||||
volumes:
|
||||
- name: cache
|
||||
path: /cache
|
||||
|
||||
- name: setup
|
||||
image: docker.io/library/elixir:1.18.3-otp-27
|
||||
depends_on:
|
||||
- restore-cache
|
||||
environment:
|
||||
HEX_HOME: ./.hex-cache
|
||||
MIX_HOME: ./.hex-cache
|
||||
commands:
|
||||
# Install hex and rebar (uses cached .hex-cache if available)
|
||||
- mix local.hex --force
|
||||
- mix local.rebar --force
|
||||
# Fetch dependencies
|
||||
- mix deps.get
|
||||
|
||||
- name: wait_for_postgres
|
||||
image: docker.io/library/postgres:17.6
|
||||
commands:
|
||||
# Wait for postgres to become available (POSIX-compatible)
|
||||
- |
|
||||
i=0
|
||||
while [ $i -lt 20 ]; do
|
||||
if pg_isready -h postgres -U postgres; then
|
||||
exit 0
|
||||
fi
|
||||
i=$((i + 1))
|
||||
sleep 2
|
||||
done
|
||||
echo "Postgres did not become available, aborting."
|
||||
exit 1
|
||||
|
||||
- name: compile
|
||||
- name: build
|
||||
image: docker.io/library/elixir:1.18.3-otp-27
|
||||
depends_on:
|
||||
- setup
|
||||
environment:
|
||||
HEX_HOME: ./.hex-cache
|
||||
MIX_HOME: ./.hex-cache
|
||||
commands:
|
||||
# Compile for dev (with warnings as errors) and test environments
|
||||
- mix local.hex --force
|
||||
- mix local.rebar --force
|
||||
- mix compile --warnings-as-errors
|
||||
- MIX_ENV=test mix compile --warnings-as-errors
|
||||
|
||||
- name: lint
|
||||
image: docker.io/library/elixir:1.18.3-otp-27
|
||||
depends_on:
|
||||
- compile
|
||||
environment:
|
||||
HEX_HOME: ./.hex-cache
|
||||
MIX_HOME: ./.hex-cache
|
||||
- build
|
||||
commands:
|
||||
# Check formatting
|
||||
- mix local.hex --force
|
||||
- mix local.rebar --force
|
||||
- mix format --check-formatted
|
||||
# Security checks
|
||||
- mix sobelow --config
|
||||
# Check dependencies for known vulnerabilities
|
||||
- mix deps.audit
|
||||
# Check for dependencies that are not maintained anymore
|
||||
- mix hex.audit
|
||||
# Provide hints for improving code quality
|
||||
- mix credo
|
||||
# Check that translations are up to date
|
||||
- mix gettext.extract --check-up-to-date
|
||||
|
||||
- name: test
|
||||
image: docker.io/library/elixir:1.18.3-otp-27
|
||||
depends_on:
|
||||
- compile
|
||||
- wait_for_postgres
|
||||
- setup
|
||||
environment:
|
||||
MIX_ENV: test
|
||||
TEST_POSTGRES_HOST: postgres
|
||||
TEST_POSTGRES_PORT: 5432
|
||||
HEX_HOME: ./.hex-cache
|
||||
MIX_HOME: ./.hex-cache
|
||||
commands:
|
||||
# Run tests with increased parallelism
|
||||
- mix local.hex --force
|
||||
- mix local.rebar --force
|
||||
- mix test --max-cases 16
|
||||
|
||||
- name: rebuild-cache
|
||||
image: drillster/drone-volume-cache
|
||||
depends_on:
|
||||
- lint
|
||||
- test
|
||||
settings:
|
||||
rebuild: true
|
||||
mount:
|
||||
- ./deps
|
||||
- ./.hex-cache
|
||||
volumes:
|
||||
- name: cache
|
||||
path: /cache
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
|
||||
volumes:
|
||||
- name: cache
|
||||
host:
|
||||
path: /tmp/drone_cache
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue