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