From c52390a7d9170c00371561115f3eb8eea6fb3515 Mon Sep 17 00:00:00 2001 From: Lain Soykaf Date: Sun, 26 Dec 2021 18:05:42 +0100 Subject: [PATCH 1/2] CI: Use own package as base So we can skip updating and installing the same packages a million times. It will still grab the hex.pm stuff -- maybe we can find a way to avoid this, too. --- .gitlab-ci.yml | 9 +-------- ci/Dockerfile | 7 +++++++ ci/build_and_push.sh | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 ci/Dockerfile create mode 100755 ci/build_and_push.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3860f1db9..9155af0e5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: elixir:1.9.4 +image: git.pleroma.social:5050/pleroma/pleroma/ci-base variables: &global_variables POSTGRES_DB: pleroma_test @@ -26,12 +26,7 @@ stages: before_script: - echo $MIX_ENV - rm -rf _build/*/lib/pleroma - - apt-get update && apt-get install -y cmake - - mix local.hex --force - - mix local.rebar --force - mix deps.get - - apt-get -qq update - - apt-get install -y libmagic-dev after_script: - rm -rf _build/*/lib/pleroma @@ -88,7 +83,6 @@ unit-testing: alias: postgres command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] script: - - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg - mix ecto.create - mix ecto.migrate - mix coveralls --preload-modules @@ -146,7 +140,6 @@ unit-testing-rum: <<: *global_variables RUM_ENABLED: "true" script: - - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg - mix ecto.create - mix ecto.migrate - "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/" diff --git a/ci/Dockerfile b/ci/Dockerfile new file mode 100644 index 000000000..e6a8b438c --- /dev/null +++ b/ci/Dockerfile @@ -0,0 +1,7 @@ +FROM elixir:1.9.4 + +RUN apt-get update &&\ + apt-get install -y libmagic-dev cmake libimage-exiftool-perl ffmpeg &&\ + mix local.hex --force &&\ + mix local.rebar --force + diff --git a/ci/build_and_push.sh b/ci/build_and_push.sh new file mode 100755 index 000000000..484cc2643 --- /dev/null +++ b/ci/build_and_push.sh @@ -0,0 +1 @@ +docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t git.pleroma.social:5050/pleroma/pleroma/ci-base:latest --push . From ac3b5037219f75c0dcec424052dab2e2e65149bd Mon Sep 17 00:00:00 2001 From: Lain Soykaf Date: Sun, 26 Dec 2021 18:54:54 +0100 Subject: [PATCH 2/2] CI: Fix the broken tasks. --- .gitlab-ci.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9155af0e5..bebd97efb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -154,6 +154,10 @@ lint: - "**/*.exs" - "mix.lock" cache: *testing_cache_policy + before_script: + - mix local.hex --force + - mix local.rebar --force + - mix deps.get script: - mix format --check-formatted @@ -177,8 +181,13 @@ cycles: - "**/*.exs" - "mix.lock" cache: {} - script: + before_script: + - 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")}'