From e959d069f23eac8e878059202588a6a6904dc893 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 4 Dec 2025 17:37:52 +0100 Subject: [PATCH 1/4] chore: reorder drone steps for speed improvements --- .drone.yml | 79 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 24 deletions(-) diff --git a/.drone.yml b/.drone.yml index 483a08a..91ea2af 100644 --- a/.drone.yml +++ b/.drone.yml @@ -28,33 +28,24 @@ steps: restore: true mount: - ./deps - - ./_build + - ./.hex-cache ttl: 30 volumes: - name: cache path: /cache - - name: lint + - 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 package manager + # Install hex package manager (uses cached .hex-cache if available) - mix local.hex --force # Fetch dependencies - 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 image: docker.io/library/postgres:17.6 @@ -72,30 +63,70 @@ steps: echo "Postgres did not become available, aborting." 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 image: docker.io/library/elixir:1.18.3-otp-27 + depends_on: + - compile + - wait_for_postgres environment: MIX_ENV: test TEST_POSTGRES_HOST: postgres TEST_POSTGRES_PORT: 5432 + HEX_HOME: ./.hex-cache + MIX_HOME: ./.hex-cache commands: - # Install hex package manager - - mix local.hex --force - # Fetch dependencies - - mix deps.get - # Run tests - - mix test + # Run tests with increased parallelism + - mix test --max-cases 16 - name: rebuild-cache image: drillster/drone-volume-cache + depends_on: + - lint + - test settings: rebuild: true mount: - ./deps - - ./_build + - ./.hex-cache volumes: - name: cache path: /cache + when: + status: + - success volumes: - name: cache From 69bd519fb412cb36fe431f70f88c2514ed5c9b67 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 11 Dec 2025 01:14:56 +0100 Subject: [PATCH 2/4] fix: drone job --- .drone.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index 91ea2af..328ba36 100644 --- a/.drone.yml +++ b/.drone.yml @@ -50,14 +50,14 @@ steps: - name: wait_for_postgres image: docker.io/library/postgres:17.6 commands: - # Wait for postgres to become available + # Wait for postgres to become available (POSIX-compatible) - | - for i in {1..20}; do + i=0 + while [ $i -lt 20 ]; do if pg_isready -h postgres -U postgres; then exit 0 - else - true fi + i=$((i + 1)) sleep 2 done echo "Postgres did not become available, aborting." From 2bdf7f6f7210172a001051147fe9e7230fafd629 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 11 Dec 2025 02:17:10 +0100 Subject: [PATCH 3/4] fix: add rebar to drone job --- .drone.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 328ba36..8a1461f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -42,8 +42,9 @@ steps: HEX_HOME: ./.hex-cache MIX_HOME: ./.hex-cache commands: - # Install hex package manager (uses cached .hex-cache if available) + # Install hex and rebar (uses cached .hex-cache if available) - mix local.hex --force + - mix local.rebar --force # Fetch dependencies - mix deps.get From 765d5ee199477befcbf3b953414b3d61ab51f620 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 11 Dec 2025 02:43:40 +0100 Subject: [PATCH 4/4] fix: drone --- .drone.yml | 95 ++++++------------------------------------------------ 1 file changed, 9 insertions(+), 86 deletions(-) diff --git a/.drone.yml b/.drone.yml index 8a1461f..f80a718 100644 --- a/.drone.yml +++ b/.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