Merge pull request 'Optimise CI runs' (#938) from Oneric/akkoma:ci-tweaks into develop

Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/938
Reviewed-by: floatingghost <hannah@coffee-and-dreams.uk>
This commit is contained in:
Oneric 2025-07-11 22:23:29 +00:00
commit e2987402b3
6 changed files with 36 additions and 144 deletions

View file

@ -4,6 +4,14 @@ labels:
depends_on:
- test
when:
event:
- push
- tag
branch:
- develop
- stable
variables:
- &scw-secrets
SCW_ACCESS_KEY:
@ -42,7 +50,6 @@ steps:
# Canonical amd64
debian-bookworm:
image: hexpm/elixir:1.15.4-erlang-26.0.2-debian-bookworm-20230612
<<: *on-release
environment:
MIX_ENV: prod
DEBIAN_FRONTEND: noninteractive
@ -58,7 +65,6 @@ steps:
release-debian-bookworm:
image: akkoma/releaser
<<: *on-release
environment: *scw-secrets
commands:
- export SOURCE=akkoma-amd64.zip
@ -71,7 +77,6 @@ steps:
debian-bullseye:
image: hexpm/elixir:1.15.4-erlang-26.0.2-debian-bullseye-20230612
<<: *on-release
environment:
MIX_ENV: prod
DEBIAN_FRONTEND: noninteractive
@ -87,7 +92,6 @@ steps:
release-debian-bullseye:
image: akkoma/releaser
<<: *on-release
environment: *scw-secrets
commands:
- export SOURCE=akkoma-amd64-debian-bullseye.zip

View file

@ -4,6 +4,14 @@ labels:
depends_on:
- test
when:
event:
- push
- tag
branch:
- develop
- stable
variables:
- &scw-secrets
SCW_ACCESS_KEY:
@ -42,7 +50,6 @@ steps:
# Canonical arm64
debian-bookworm:
image: hexpm/elixir:1.15.4-erlang-26.0.2-debian-bookworm-20230612
<<: *on-release
environment:
MIX_ENV: prod
DEBIAN_FRONTEND: noninteractive
@ -58,7 +65,6 @@ steps:
release-debian-bookworm:
image: akkoma/releaser:arm64
<<: *on-release
environment: *scw-secrets
commands:
- export SOURCE=akkoma-arm64.zip

View file

@ -5,46 +5,15 @@ depends_on:
- test
- build-amd64
variables:
- &setup-hex "mix local.hex --force && mix local.rebar --force"
- &on-release
when:
event:
- push
- tag
branch:
- develop
- stable
- refs/tags/v*
- refs/tags/stable-*
- &on-stable
when:
event:
- push
- tag
branch:
- stable
- refs/tags/stable-*
- &on-point-release
when:
event:
- push
branch:
- develop
- stable
- &on-pr-open
when:
event:
- pull_request
- &tag-build "export BUILD_TAG=$${CI_COMMIT_TAG:-\"$CI_COMMIT_BRANCH\"} && export PLEROMA_BUILD_BRANCH=$BUILD_TAG"
- &clean "(rm -rf release || true) && (rm -rf _build || true) && (rm -rf /root/.mix)"
- &mix-clean "mix deps.clean --all && mix clean"
when:
event:
- push
branch:
- develop
- stable
steps:
docs:
<<: *on-point-release
environment:
CI: "true"
SCW_ACCESS_KEY:

View file

@ -1,52 +0,0 @@
labels:
platform: linux/amd64
variables:
- &setup-hex "mix local.hex --force && mix local.rebar --force"
- &on-release
when:
event:
- push
- tag
branch:
- develop
- stable
- refs/tags/v*
- refs/tags/stable-*
- &on-stable
when:
event:
- push
- tag
branch:
- stable
- refs/tags/stable-*
- &on-point-release
when:
event:
- push
branch:
- develop
- stable
- &on-pr-open
when:
event:
- pull_request
- &tag-build "export BUILD_TAG=$${CI_COMMIT_TAG:-\"$CI_COMMIT_BRANCH\"} && export PLEROMA_BUILD_BRANCH=$BUILD_TAG"
- &clean "(rm -rf release || true) && (rm -rf _build || true) && (rm -rf /root/.mix)"
- &mix-clean "mix deps.clean --all && mix clean"
steps:
lint:
image: akkoma/ci-base:1.18-otp27
<<: *on-pr-open
environment:
MIX_ENV: test
commands:
- mix local.hex --force
- mix local.rebar --force
- mix deps.get
- mix compile
- mix format --check-formatted

View file

@ -1,59 +1,19 @@
labels:
platform: linux/amd64
depends_on:
- lint
when:
event:
- pull_request
matrix:
# test the lowest and highest versions
ELIXIR_VERSION:
- 1.14
- 1.18
OTP_VERSION:
- 25
- 27
include:
- ELIXIR_VERSION: 1.14
OTP_VERSION: 25
LINT: NO
- ELIXIR_VERSION: 1.18
OTP_VERSION: 27
variables:
- &setup-hex "mix local.hex --force && mix local.rebar --force"
- &on-release
when:
event:
- push
- tag
branch:
- develop
- stable
- refs/tags/v*
- refs/tags/stable-*
- &on-stable
when:
event:
- push
- tag
branch:
- stable
- refs/tags/stable-*
- &on-point-release
when:
event:
- push
branch:
- develop
- stable
- &on-pr-open
when:
event:
- pull_request
- &tag-build "export BUILD_TAG=$${CI_COMMIT_TAG:-\"$CI_COMMIT_BRANCH\"} && export PLEROMA_BUILD_BRANCH=$BUILD_TAG"
- &clean "(rm -rf release || true) && (rm -rf _build || true) && (rm -rf /root/.mix)"
- &mix-clean "mix deps.clean --all && mix clean"
LINT: YES
services:
postgres:
@ -69,18 +29,19 @@ services:
steps:
test:
image: akkoma/ci-base:${ELIXIR_VERSION}-otp${OTP_VERSION}
<<: *on-pr-open
environment:
MIX_ENV: test
POSTGRES_DB: pleroma_test_${ELIXIR_VERSION}_${OTP_VERSION}
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
DB_HOST: postgres
LINT: ${LINT}
commands:
- mix local.hex --force
- mix local.rebar --force
- mix deps.get
- mix compile
- test "${LINT}" = "NO" || mix format --check-formatted
- mix ecto.drop -f -q
- mix ecto.create
- mix ecto.migrate

10
mix.exs
View file

@ -8,7 +8,6 @@ def project do
elixir: "~> 1.14.1 or ~> 1.15",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: Mix.compilers(),
elixirc_options: [warnings_as_errors: warnings_as_errors()],
xref: [exclude: [:eldap]],
start_permanent: Mix.env() == :prod,
aliases: aliases(),
@ -90,8 +89,6 @@ defp elixirc_paths(:benchmark), do: ["lib", "benchmarks", "priv/scrubbers"]
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
defp warnings_as_errors, do: System.get_env("CI") == "true"
# Specifies OAuth dependencies.
defp oauth_deps do
oauth_strategy_packages =
@ -235,6 +232,13 @@ defp aliases do
copyright: &add_copyright/1,
"copyright.bump": &bump_copyright/1
]
|> then(fn a ->
if System.get_env("CI") == "true" do
[{:compile, "compile --warnings-as-errors"} | a]
else
a
end
end)
end
# Builds a version string made of: