WIP: speed-up drone #272

Draft
simon wants to merge 4 commits from speed-up-drone into main
Showing only changes of commit e959d069f2 - Show all commits

View file

@ -28,33 +28,24 @@ steps:
restore: true restore: true
mount: mount:
- ./deps - ./deps
- ./_build - ./.hex-cache
ttl: 30 ttl: 30
volumes: volumes:
- name: cache - name: cache
path: /cache path: /cache
- name: lint - name: setup
image: docker.io/library/elixir:1.18.3-otp-27 image: docker.io/library/elixir:1.18.3-otp-27
depends_on:
- restore-cache
environment:
HEX_HOME: ./.hex-cache
MIX_HOME: ./.hex-cache
commands: commands:
# Install hex package manager # Install hex package manager (uses cached .hex-cache if available)
- mix local.hex --force - mix local.hex --force
# Fetch dependencies # Fetch dependencies
- mix deps.get - mix deps.get
# Check for compilation errors & warnings
- mix compile --warnings-as-errors
# Check formatting
- 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: wait_for_postgres - name: wait_for_postgres
image: docker.io/library/postgres:17.6 image: docker.io/library/postgres:17.6
@ -72,30 +63,70 @@ steps:
echo "Postgres did not become available, aborting." echo "Postgres did not become available, aborting."
exit 1 exit 1
- name: compile
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 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
commands:
# Check formatting
- 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 - name: test
image: docker.io/library/elixir:1.18.3-otp-27 image: docker.io/library/elixir:1.18.3-otp-27
depends_on:
- compile
- wait_for_postgres
environment: environment:
MIX_ENV: test MIX_ENV: test
TEST_POSTGRES_HOST: postgres TEST_POSTGRES_HOST: postgres
TEST_POSTGRES_PORT: 5432 TEST_POSTGRES_PORT: 5432
HEX_HOME: ./.hex-cache
MIX_HOME: ./.hex-cache
commands: commands:
# Install hex package manager # Run tests with increased parallelism
- mix local.hex --force - mix test --max-cases 16
# Fetch dependencies
- mix deps.get
# Run tests
- mix test
- name: rebuild-cache - name: rebuild-cache
image: drillster/drone-volume-cache image: drillster/drone-volume-cache
depends_on:
- lint
- test
settings: settings:
rebuild: true rebuild: true
mount: mount:
- ./deps - ./deps
- ./_build - ./.hex-cache
volumes: volumes:
- name: cache - name: cache
path: /cache path: /cache
when:
status:
- success
volumes: volumes:
- name: cache - name: cache