ensure mix clean
[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-25.0.2-ubuntu-jammy-20220428
91 <<: *on-release
92 environment:
93 MIX_ENV: prod
94 DEBIAN_FRONTEND: noninteractive
95 commands:
96 - rm config/emoji.txt
97 - apt-get update && apt-get install -y cmake libmagic-dev rclone zip imagemagick libmagic-dev git build-essential g++ wget
98 - *clean
99 - echo "import Config" > config/prod.secret.exs
100 - *setup-hex
101 - *tag-build
102 - mix deps.get --only prod
103 - mix release --path release
104 - zip akkoma-amd64.zip -r release
105
106 release-ubuntu22:
107 image: akkoma/releaser
108 <<: *on-release
109 secrets: *scw-secrets
110 commands:
111 - export SOURCE=akkoma-amd64.zip
112 - export DEST=scaleway:akkoma-updates/$${CI_COMMIT_TAG:-"$CI_COMMIT_BRANCH"}/akkoma-amd64.zip
113 - /bin/sh /entrypoint.sh
114 environment:
115 SOURCE: akkoma-amd64.zip
116 DEST: scaleway:akkoma-updates/$${CI_COMMIT_TAG:-"$CI_COMMIT_BRANCH"}/akkoma-amd64.zip
117
118 debian-bullseye:
119 image: elixir:1.13.4
120 <<: *on-release
121 environment:
122 MIX_ENV: prod
123 DEBIAN_FRONTEND: noninteractive
124 commands:
125 - apt-get update && apt-get install -y cmake libmagic-dev rclone zip imagemagick libmagic-dev git build-essential gcc make g++ wget
126 - *clean
127 - echo "import Config" > config/prod.secret.exs
128 - *setup-hex
129 - *tag-build
130 - *mix-clean
131 - mix deps.get --only prod
132 - mix release --path release
133 - zip akkoma-amd64.zip -r release
134
135 release-debian:
136 image: akkoma/releaser
137 <<: *on-release
138 secrets: *scw-secrets
139 commands:
140 - export SOURCE=akkoma-amd64.zip
141 - export DEST=scaleway:akkoma-updates/$${CI_COMMIT_TAG:-"$CI_COMMIT_BRANCH"}/akkoma-debian-bullseye.zip
142 - /bin/sh /entrypoint.sh
143
144 # Canonical amd64-musl
145 musl:
146 image: elixir:1.13.4-alpine
147 <<: *on-release
148 environment:
149 MIX_ENV: prod
150 commands:
151 - apk add git gcc g++ musl-dev make cmake file-dev rclone wget zip imagemagick
152 - *clean
153 - *setup-hex
154 - *mix-clean
155 - *tag-build
156 - mix deps.get --only prod
157 - mix release --path release
158 - zip akkoma-amd64-musl.zip -r release
159
160 release-musl:
161 image: akkoma/releaser
162 <<: *on-release
163 secrets: *scw-secrets
164 commands:
165 - export SOURCE=akkoma-amd64-musl.zip
166 - export DEST=scaleway:akkoma-updates/$${CI_COMMIT_TAG:-"$CI_COMMIT_BRANCH"}/akkoma-amd64-musl.zip
167 - /bin/sh /entrypoint.sh
168
169 docs:
170 <<: *on-point-release
171 secrets:
172 - SCW_ACCESS_KEY
173 - SCW_SECRET_KEY
174 - SCW_DEFAULT_ORGANIZATION_ID
175 environment:
176 CI: "true"
177 image: python:3.10-slim
178 commands:
179 - apt-get update && apt-get install -y rclone wget git zip
180 - wget https://github.com/scaleway/scaleway-cli/releases/download/v2.5.1/scaleway-cli_2.5.1_linux_amd64
181 - mv scaleway-cli_2.5.1_linux_amd64 scaleway-cli
182 - chmod +x scaleway-cli
183 - ./scaleway-cli object config install type=rclone
184 - cd docs
185 - pip install -r requirements.txt
186 - mkdocs build
187 - zip -r docs.zip site/*
188 - cd site
189 - rclone copy . scaleway:akkoma-docs/$CI_COMMIT_BRANCH/