From 693c7c073511af2040644c3faccee518e0af79ea Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Wed, 21 Jun 2023 02:15:40 +0000 Subject: [PATCH 1/4] feat: use elixir slim image --- .drone.yml | 4 ++-- docker-compose.yml | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index eb0dd88..ed91eed 100644 --- a/.drone.yml +++ b/.drone.yml @@ -37,7 +37,7 @@ steps: restore: true - name: test - image: 'elixir:1.14.5' + image: 'elixir:1.14.5-slim' environment: MIX_ENV: test POSTGRES_HOST: db @@ -48,7 +48,7 @@ steps: - make test - name: lint - image: 'elixir:1.14.5' + image: 'elixir:1.14.5-slim' commands: - mix do local.rebar --force, local.hex --force, deps.get, deps.compile - make static_code_analysis diff --git a/docker-compose.yml b/docker-compose.yml index db136b0..185b77d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,4 @@ --- -version: '3.7' - services: db: image: 'postgres:15.3-alpine' @@ -15,7 +13,7 @@ services: - 'db_data:/var/lib/postgresql/data' restart: unless-stopped app: - image: 'elixir:1.14.5' + image: 'elixir:1.14.5-slim' hostname: app depends_on: - db -- 2.47.2 From bfd7f52cb27f7051c0d9dca5fb3cad146bd0af77 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Sun, 23 Jul 2023 22:18:36 +0000 Subject: [PATCH 2/4] feat: upgrade elixir and erlang * elixir from 1.14.5 to 1.15.4 * erlang from 24.3.4 to 26.0.2 --- .drone.yml | 4 ++-- .tool-versions | 4 ++-- docker-compose.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index ed91eed..58b1694 100644 --- a/.drone.yml +++ b/.drone.yml @@ -37,7 +37,7 @@ steps: restore: true - name: test - image: 'elixir:1.14.5-slim' + image: 'elixir:1.15.4-slim' environment: MIX_ENV: test POSTGRES_HOST: db @@ -48,7 +48,7 @@ steps: - make test - name: lint - image: 'elixir:1.14.5-slim' + image: 'elixir:1.15.4-slim' commands: - mix do local.rebar --force, local.hex --force, deps.get, deps.compile - make static_code_analysis diff --git a/.tool-versions b/.tool-versions index 5b25d50..44acbf0 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -erlang 24.3.4 -elixir 1.15.0 +erlang 26.0.2 +elixir 1.15.4 diff --git a/docker-compose.yml b/docker-compose.yml index 185b77d..09244a7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ services: - 'db_data:/var/lib/postgresql/data' restart: unless-stopped app: - image: 'elixir:1.14.5-slim' + image: 'elixir:1.15.4-slim' hostname: app depends_on: - db -- 2.47.2 From 1704c3907452c6eb829cb3e01eadf7a0560fd9cd Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Sun, 23 Jul 2023 22:31:26 +0000 Subject: [PATCH 3/4] fix(ci): use raw commands for test and static code analysis The `slim` variant image doesn't have `make` installed. --- .drone.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 58b1694..8d9800e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -45,13 +45,17 @@ steps: POSTGRES_PASS: postgres commands: - mix do local.rebar --force, local.hex --force, deps.get, deps.compile - - make test + - mix compile + - mix test --cover --trace --slowest 10 - name: lint image: 'elixir:1.15.4-slim' commands: - mix do local.rebar --force, local.hex --force, deps.get, deps.compile - - make static_code_analysis + - mix compile + - mix format --check-formatted + - mix credo suggest --strict --format=flycheck + - mix dialyzer --no-check --quiet --ignore-exit-status --format short - name: rebuild cache image: 'meltwater/drone-cache:v1.4.0' -- 2.47.2 From 343b353795e0e88c5aec272c48af04ae4fcb94e5 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Sun, 23 Jul 2023 22:40:50 +0000 Subject: [PATCH 4/4] fix(ci): add `.tool-versions` to set cache key With this change we ensure dependencies and build directories are re-created when changes in runtime are applied. --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 8d9800e..8d95fd4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -27,7 +27,7 @@ steps: settings: archive_format: gzip bucket: trainlog-cache - cache_key: '{{ .Repo.Name }}-{{ checksum "mix.lock" }}' + cache_key: '{{ .Repo.Name }}-{{ checksum ".tool-versions" }}-{{ checksum "mix.lock" }}' endpoint: minio:9000 mount: - _build @@ -67,7 +67,7 @@ steps: settings: archive_format: gzip bucket: trainlog-cache - cache_key: '{{ .Repo.Name }}-{{ checksum "mix.lock" }}' + cache_key: '{{ .Repo.Name }}-{{ checksum ".tool-versions" }}-{{ checksum "mix.lock" }}' endpoint: minio:9000 exit_code: true mount: -- 2.47.2