use on-release tag
[akkoma] / .woodpecker.yml
1 variables:
2 - &scw-secrets
3 - SCW_ACCESS_KEY
4 - SCW_SECRET_KEY
5 - SCW_DEFAULT_ORGANIZATION_ID
6 - &setup-hex "mix local.hex --force && mix local.rebar --force"
7 - &on-release
8 when:
9 event:
10 - push
11 - tag
12 branch:
13 - develop
14 - stable
15 - refs/tags/v*
16 - refs/tags/stable-*
17 - &on-point-release
18 when:
19 event:
20 - push
21 branch:
22 - develop
23 - stable
24 - &on-pr-open
25 when:
26 event:
27 - pull_request
28
29 - &tag-build "export BUILD_TAG=$${CI_COMMIT_TAG:-\"$CI_COMMIT_BRANCH\"} && export PLEROMA_BUILD_BRANCH=$BUILD_TAG"
30
31 - &clean "(rm -rf release || true) && (rm -rf _build || true) && (rm -rf /root/.mix)"
32 - &mix-clean "mix deps.clean --all && mix clean"
33
34 services:
35 postgres:
36 image: postgres:13
37 when:
38 event:
39 - pull_request
40 environment:
41 POSTGRES_DB: pleroma_test
42 POSTGRES_USER: postgres
43 POSTGRES_PASSWORD: postgres
44
45 pipeline:
46 lint:
47 <<: *on-pr-open
48 image: akkoma/ci-base:latest
49 commands:
50 - mix local.hex --force
51 - mix local.rebar --force
52 - mix format --check-formatted
53
54 build:
55 image: akkoma/ci-base:latest
56 <<: *on-pr-open
57 environment:
58 MIX_ENV: test
59 POSTGRES_DB: pleroma_test
60 POSTGRES_USER: postgres
61 POSTGRES_PASSWORD: postgres
62 DB_HOST: postgres
63 commands:
64 - mix local.hex --force
65 - mix local.rebar --force
66 - mix deps.get
67 - mix compile
68
69 test:
70 image: akkoma/ci-base:latest
71 <<: *on-pr-open
72 environment:
73 MIX_ENV: test
74 POSTGRES_DB: pleroma_test
75 POSTGRES_USER: postgres
76 POSTGRES_PASSWORD: postgres
77 DB_HOST: postgres
78 commands:
79 - mix local.hex --force
80 - mix local.rebar --force
81 - mix deps.get
82 - mix compile
83 - mix ecto.drop -f -q
84 - mix ecto.create
85 - mix ecto.migrate
86 - mix test --preload-modules --exclude erratic --exclude federated --max-cases 4
87
88 # Canonical amd64
89 ubuntu22:
90 image: hexpm/elixir:1.13.4-erlang-24.3.4.5-ubuntu-jammy-20220428
91 <<: *on-release
92 environment:
93 MIX_ENV: prod
94 DEBIAN_FRONTEND: noninteractive
95 commands:
96 - apt-get update && apt-get install -y cmake libmagic-dev rclone zip imagemagick libmagic-dev git build-essential g++ wget
97 - *clean
98 - echo "import Config" > config/prod.secret.exs
99 - *setup-hex
100 - *tag-build
101 - mix deps.get --only prod
102 - mix release --path release
103 - zip akkoma-ubuntu-jammy.zip -r release
104
105 release-ubuntu22:
106 image: akkoma/releaser
107 <<: *on-release
108 secrets: *scw-secrets
109 commands:
110 - export SOURCE=akkoma-ubuntu-jammy.zip
111 - export DEST=scaleway:akkoma-updates/$${CI_COMMIT_TAG:-"$CI_COMMIT_BRANCH"}/akkoma-ubuntu-jammy.zip
112 - /bin/sh /entrypoint.sh
113
114 debian-bullseye:
115 image: hexpm/elixir:1.13.4-erlang-24.3.4.5-debian-bullseye-20220801
116 <<: *on-release
117 environment:
118 MIX_ENV: prod
119 DEBIAN_FRONTEND: noninteractive
120 commands:
121 - apt-get update && apt-get install -y cmake libmagic-dev rclone zip imagemagick libmagic-dev git build-essential gcc make g++ wget
122 - *clean
123 - echo "import Config" > config/prod.secret.exs
124 - *setup-hex
125 - *tag-build
126 - *mix-clean
127 - mix deps.get --only prod
128 - mix release --path release
129 - zip akkoma-amd64.zip -r release
130
131 release-debian:
132 image: akkoma/releaser
133 <<: *on-release
134 secrets: *scw-secrets
135 commands:
136 - export SOURCE=akkoma-amd64.zip
137 - export DEST=scaleway:akkoma-updates/$${CI_COMMIT_TAG:-"$CI_COMMIT_BRANCH"}/akkoma-amd64.zip
138 - /bin/sh /entrypoint.sh
139 - export DEST=scaleway:akkoma-updates/$${CI_COMMIT_TAG:-"$CI_COMMIT_BRANCH"}/akkoma-debian-stable.zip
140 - /bin/sh /entrypoint.sh
141
142 # Canonical amd64-musl
143 musl:
144 image: hexpm/elixir:1.13.4-erlang-24.3.4.5-alpine-3.15.6
145 <<: *on-release
146 environment:
147 MIX_ENV: prod
148 commands:
149 - apk add git gcc g++ musl-dev make cmake file-dev rclone wget zip imagemagick
150 - *clean
151 - *setup-hex
152 - *mix-clean
153 - *tag-build
154 - mix deps.get --only prod
155 - mix release --path release
156 - zip akkoma-amd64-musl.zip -r release
157
158 release-musl:
159 image: akkoma/releaser
160 <<: *on-release
161 secrets: *scw-secrets
162 commands:
163 - export SOURCE=akkoma-amd64-musl.zip
164 - export DEST=scaleway:akkoma-updates/$${CI_COMMIT_TAG:-"$CI_COMMIT_BRANCH"}/akkoma-amd64-musl.zip
165 - /bin/sh /entrypoint.sh
166
167 docs:
168 <<: *on-point-release
169 secrets:
170 - SCW_ACCESS_KEY
171 - SCW_SECRET_KEY
172 - SCW_DEFAULT_ORGANIZATION_ID
173 environment:
174 CI: "true"
175 image: akkoma/docs-builder
176 commands:
177 - ./scaleway-cli object config install type=rclone
178 - cd docs
179 - pip install -r requirements.txt
180 - mkdocs build
181 - zip -r docs.zip site/*
182 - cd site
183 - rclone copy . scaleway:akkoma-docs/$CI_COMMIT_BRANCH/