be497b531cd7bdb1001ac67ecf32ba9f92844c9e
[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
33 services:
34 postgres:
35 image: postgres:13
36 when:
37 event:
38 - pull_request
39 environment:
40 POSTGRES_DB: pleroma_test
41 POSTGRES_USER: postgres
42 POSTGRES_PASSWORD: postgres
43
44 pipeline:
45 lint:
46 <<: *on-pr-open
47 image: akkoma/ci-base:latest
48 commands:
49 - mix local.hex --force
50 - mix local.rebar --force
51 - mix format --check-formatted
52
53 build:
54 image: akkoma/ci-base:latest
55 <<: *on-pr-open
56 environment:
57 MIX_ENV: test
58 POSTGRES_DB: pleroma_test
59 POSTGRES_USER: postgres
60 POSTGRES_PASSWORD: postgres
61 DB_HOST: postgres
62 commands:
63 - mix local.hex --force
64 - mix local.rebar --force
65 - mix deps.get
66 - mix compile
67
68 test:
69 image: akkoma/ci-base:latest
70 <<: *on-pr-open
71 environment:
72 MIX_ENV: test
73 POSTGRES_DB: pleroma_test
74 POSTGRES_USER: postgres
75 POSTGRES_PASSWORD: postgres
76 DB_HOST: postgres
77 commands:
78 - mix local.hex --force
79 - mix local.rebar --force
80 - mix deps.get
81 - mix compile
82 - mix ecto.drop -f -q
83 - mix ecto.create
84 - mix ecto.migrate
85 - mix test --preload-modules --exclude erratic --exclude federated --max-cases 4
86
87 # Canonical amd64
88 ubuntu22:
89 image: hexpm/elixir:1.13.4-erlang-25.0.2-ubuntu-jammy-20220428
90 <<: *on-release
91 environment:
92 MIX_ENV: prod
93 DEBIAN_FRONTEND: noninteractive
94 commands:
95 - rm config/emoji.txt
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-amd64.zip -r release
104
105 release-ubuntu22:
106 image: akkoma/releaser
107 <<: *on-release
108 secrets: *scw-secrets
109 commands:
110 - export SOURCE=akkoma-amd64.zip
111 - export DEST=scaleway:akkoma-updates/$${CI_COMMIT_TAG:-"$CI_COMMIT_BRANCH"}/akkoma-amd64.zip
112 - /bin/sh /entrypoint.sh
113 environment:
114 SOURCE: akkoma-amd64.zip
115 DEST: scaleway:akkoma-updates/$${CI_COMMIT_TAG:-"$CI_COMMIT_BRANCH"}/akkoma-amd64.zip
116
117 debian-bullseye:
118 image: elixir:1.13.4
119 <<: *on-release
120 environment:
121 MIX_ENV: prod
122 DEBIAN_FRONTEND: noninteractive
123 commands:
124 - apt-get update && apt-get install -y cmake libmagic-dev rclone zip imagemagick libmagic-dev git build-essential gcc make g++ wget
125 - *clean
126 - echo "import Config" > config/prod.secret.exs
127 - *setup-hex
128 - *tag-build
129 - mix deps.get --only prod
130 - mix release --path release
131 - zip akkoma-amd64.zip -r release
132
133 release-debian:
134 image: akkoma/releaser
135 <<: *on-release
136 secrets: *scw-secrets
137 commands:
138 - export SOURCE=akkoma-amd64.zip
139 - export DEST=scaleway:akkoma-updates/$${CI_COMMIT_TAG:-"$CI_COMMIT_BRANCH"}/akkoma-debian-bullseye.zip
140 - /bin/sh /entrypoint.sh
141
142 # Canonical amd64-musl
143 musl:
144 image: elixir:1.13.4-alpine
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 deps.clean --all
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: python:3.10-slim
176 commands:
177 - apt-get update && apt-get install -y rclone wget git zip
178 - wget https://github.com/scaleway/scaleway-cli/releases/download/v2.5.1/scaleway-cli_2.5.1_linux_amd64
179 - mv scaleway-cli_2.5.1_linux_amd64 scaleway-cli
180 - chmod +x scaleway-cli
181 - ./scaleway-cli object config install type=rclone
182 - cd docs
183 - pip install -r requirements.txt
184 - mkdocs build
185 - zip -r docs.zip site/*
186 - cd site
187 - rclone copy . scaleway:akkoma-docs/$CI_COMMIT_BRANCH/