From 08c8814ef06455a0abc74fda9bab30729b702453 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 11 Jul 2022 09:28:30 +0200 Subject: [PATCH 1/5] CI: Run postgres services in alpine --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e5664da68..7a61161ee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -59,7 +59,7 @@ benchmark: variables: MIX_ENV: benchmark services: - - name: postgres:9.6 + - name: postgres:9.6-alpine alias: postgres command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] script: @@ -79,7 +79,7 @@ unit-testing: policy: pull services: - - name: postgres:13 + - name: postgres:13-alpine alias: postgres command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] script: @@ -101,7 +101,7 @@ unit-testing-erratic: policy: pull services: - - name: postgres:13 + - name: postgres:13-alpine alias: postgres command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] script: From 702a41ce231999c8343b5c43100211bfc9dab4b5 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 11 Jul 2022 09:28:47 +0200 Subject: [PATCH 2/5] CI: Run lint and cycles in alpine --- .gitlab-ci.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7a61161ee..718524aee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -147,7 +147,7 @@ unit-testing-rum: - mix test --preload-modules lint: - image: elixir:1.12 + image: elixir:1.12-alpine stage: test only: changes: @@ -156,6 +156,8 @@ lint: - "mix.lock" cache: *testing_cache_policy before_script: + - apk update + - apk add cmake file-dev git - mix local.hex --force - mix local.rebar --force - mix deps.get @@ -175,7 +177,7 @@ analysis: cycles: stage: test - image: elixir:1.11 + image: elixir:1.11-alpine only: changes: - "**/*.ex" @@ -183,11 +185,11 @@ cycles: - "mix.lock" cache: {} before_script: + - apk update + - apk add cmake file-dev git - mix local.hex --force - mix local.rebar --force - mix deps.get - - apt-get update - - apt-get install cmake libmagic-dev -y script: - mix compile - mix xref graph --format cycles --label compile | awk '{print $0} END{exit ($0 != "No cycles found")}' From e574408b33a198ecabd035bbfbecaf9d66f05f4d Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 11 Jul 2022 10:15:18 +0200 Subject: [PATCH 3/5] CI: Run stages when .gitlab-ci.yml changes --- .gitlab-ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 718524aee..ff9f1ec16 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,6 +35,7 @@ build: stage: build only: changes: + - ".gitlab-ci.yml" - "**/*.ex" - "**/*.exs" - "mix.lock" @@ -45,6 +46,7 @@ spec-build: stage: test only: changes: + - ".gitlab-ci.yml" - "lib/pleroma/web/api_spec/**/*.ex" - "lib/pleroma/web/api_spec.ex" artifacts: @@ -71,6 +73,7 @@ unit-testing: stage: test only: changes: + - ".gitlab-ci.yml" - "**/*.ex" - "**/*.exs" - "mix.lock" @@ -93,6 +96,7 @@ unit-testing-erratic: allow_failure: true only: changes: + - ".gitlab-ci.yml" - "**/*.ex" - "**/*.exs" - "mix.lock" @@ -129,6 +133,7 @@ unit-testing-rum: stage: test only: changes: + - ".gitlab-ci.yml" - "**/*.ex" - "**/*.exs" - "mix.lock" @@ -151,6 +156,7 @@ lint: stage: test only: changes: + - ".gitlab-ci.yml" - "**/*.ex" - "**/*.exs" - "mix.lock" @@ -168,6 +174,7 @@ analysis: stage: test only: changes: + - ".gitlab-ci.yml" - "**/*.ex" - "**/*.exs" - "mix.lock" @@ -180,6 +187,7 @@ cycles: image: elixir:1.11-alpine only: changes: + - ".gitlab-ci.yml" - "**/*.ex" - "**/*.exs" - "mix.lock" From 6e158bba2ccf6b8380bbf05ab2a486e8e7ba41fe Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Tue, 12 Jul 2022 12:10:32 +0200 Subject: [PATCH 4/5] CI: template for change policies based on build stage --- .gitlab-ci.yml | 38 +++++++------------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ff9f1ec16..a2284614e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,7 +34,7 @@ after_script: build: stage: build only: - changes: + changes: &build_changes_policy - ".gitlab-ci.yml" - "**/*.ex" - "**/*.exs" @@ -72,11 +72,7 @@ benchmark: unit-testing: stage: test only: - changes: - - ".gitlab-ci.yml" - - "**/*.ex" - - "**/*.exs" - - "mix.lock" + changes: *build_changes_policy cache: &testing_cache_policy <<: *global_cache_policy policy: pull @@ -95,11 +91,7 @@ unit-testing-erratic: retry: 2 allow_failure: true only: - changes: - - ".gitlab-ci.yml" - - "**/*.ex" - - "**/*.exs" - - "mix.lock" + changes: *build_changes_policy cache: &testing_cache_policy <<: *global_cache_policy policy: pull @@ -132,11 +124,7 @@ unit-testing-erratic: unit-testing-rum: stage: test only: - changes: - - ".gitlab-ci.yml" - - "**/*.ex" - - "**/*.exs" - - "mix.lock" + changes: *build_changes_policy cache: *testing_cache_policy services: - name: minibikini/postgres-with-rum:12 @@ -155,11 +143,7 @@ lint: image: elixir:1.12-alpine stage: test only: - changes: - - ".gitlab-ci.yml" - - "**/*.ex" - - "**/*.exs" - - "mix.lock" + changes: *build_changes_policy cache: *testing_cache_policy before_script: - apk update @@ -173,11 +157,7 @@ lint: analysis: stage: test only: - changes: - - ".gitlab-ci.yml" - - "**/*.ex" - - "**/*.exs" - - "mix.lock" + changes: *build_changes_policy cache: *testing_cache_policy script: - mix credo --strict --only=warnings,todo,fixme,consistency,readability @@ -186,11 +166,7 @@ cycles: stage: test image: elixir:1.11-alpine only: - changes: - - ".gitlab-ci.yml" - - "**/*.ex" - - "**/*.exs" - - "mix.lock" + changes: *build_changes_policy cache: {} before_script: - apk update From 12d888e04e4ed4660c8c0d8322cbf1820136d1ac Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 11 Jul 2022 22:57:30 +0200 Subject: [PATCH 5/5] CI: cycles: Use current stable elixir image --- .gitlab-ci.yml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a2284614e..d7a38e07e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -140,14 +140,14 @@ unit-testing-rum: - mix test --preload-modules lint: - image: elixir:1.12-alpine + image: ¤t_elixir elixir:1.12-alpine stage: test only: changes: *build_changes_policy cache: *testing_cache_policy - before_script: + before_script: ¤t_bfr_script - apk update - - apk add cmake file-dev git + - apk add build-base cmake file-dev git openssl - mix local.hex --force - mix local.rebar --force - mix deps.get @@ -163,17 +163,12 @@ analysis: - mix credo --strict --only=warnings,todo,fixme,consistency,readability cycles: + image: *current_elixir stage: test - image: elixir:1.11-alpine only: changes: *build_changes_policy - cache: {} - before_script: - - apk update - - apk add cmake file-dev git - - mix local.hex --force - - mix local.rebar --force - - mix deps.get + cache: *testing_cache_policy + before_script: *current_bfr_script script: - mix compile - mix xref graph --format cycles --label compile | awk '{print $0} END{exit ($0 != "No cycles found")}' @@ -294,7 +289,7 @@ amd64-musl: cache: *release-cache variables: *release-variables before_script: &before-release-musl - - apk add git gcc g++ musl-dev make cmake file-dev + - apk add git build-base cmake file-dev openssl - echo "import Mix.Config" > config/prod.secret.exs - mix local.hex --force - mix local.rebar --force