summaryrefslogtreecommitdiff
path: root/.crystalintegration.yml
blob: 1c51f5134fadd71c035ed7af8ebe3f59d00fc594 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
labels:
  platform: linux/amd64

when:
  event: [ push, tag ]

variables:
  - &ci_verify_image 'sc.cryxtal.org/ci-img/git-curl-jq:latest'
  - &golang_image 'golang:1.21-bullseye'
  - &forgejo_test_image 'docker.io/node:20-bookworm'
  - &nodejs_image 'docker.io/node:20-bookworm'
  - &bin_dl_image 'sc.cryxtal.org/ci-img/bin-dl:latest'
  - &deb_build_image 'sc.cryxtal.org/ci-img/dh:bullseye'
  - &deb_test_image_bullseye 'sc.cryxtal.org/ci-img/deb-test:bullseye'
  - &deb_test_image_bookworm 'sc.cryxtal.org/ci-img/deb-test:bookworm'
  - &deb_test_image_buster 'sc.cryxtal.org/ci-img/deb-test:buster'
  - &deb_test_image_sid 'sc.cryxtal.org/ci-img/deb-test:sid'
  - &deb_test_image_jammy 'sc.cryxtal.org/ci-img/deb-test-ubuntu:jammy'
  - &deb_test_image_focal 'sc.cryxtal.org/ci-img/deb-test-ubuntu:focal'
  - &deb_test_image_mantic 'sc.cryxtal.org/ci-img/deb-test-ubuntu:mantic'
  - &deb_test_image_lunar 'sc.cryxtal.org/ci-img/deb-test-ubuntu:lunar'
  - &forgejo_test_golang_ver '1.21'
  - &forgejo_test_golang_nodeb_rev '9'
  - &build_submodule 'forgejo'
  - &goproxy_override ''
  - &goproxy_setup |-
      if [ -n "$${GOPROXY_OVERRIDE:-}" ]; then
        export GOPROXY="$${GOPROXY_OVERRIDE}";
        echo "Using goproxy from goproxy_override \"$${GOPROXY}\"";
      elif [ -n "$${GOPROXY_DEFAULT:-}" ]; then
        export GOPROXY="$${GOPROXY_DEFAULT}";
        echo "Using goproxy from goproxy_default (secret) not displaying";
      else
        export GOPROXY="https://proxy.golang.org,direct";
        echo "No goproxy overrides or defaults given, using \"$${GOPROXY}\"";
      fi

workspace:
  base: /go
  path: src/cryxtal/forgejo-deb

clone:
  git:
    image: woodpeckerci/plugin-git
    settings:
      recursive: true

steps:
  fetch-tags:
    image: *ci_verify_image
    pull: true
    commands:
      - git config --add safe.directory '*'
      - git fetch --tags --force
      - git submodule foreach 'git fetch --tags --force'

  git-push-codeberg:
    image: *ci_verify_image
    secrets: [ cb_git_auth ]
    commands:
      - git remote add codeberg https://$CB_GIT_AUTH@codeberg.org/forgejo-contrib/forgejo-deb
      - if ( $(git rev-parse --is-shallow-repository) == "true" );then git fetch --unshallow origin ;fi
      - git fetch codeberg
      - git push codeberg --tags refs/remotes/origin/*:refs/heads/*

  ci-verify:
    image: *ci_verify_image
    group: deps
    environment:
      BUILD_SUBMODULE: *build_submodule
    commands:
      - ./.ci-make.sh ci-verify "$BUILD_SUBMODULE"

  deps-frontend:
    image: *nodejs_image
    group: deps
    environment:
      BUILD_SUBMODULE: *build_submodule
    commands:
      - ./.ci-make.sh submodule-make "$BUILD_SUBMODULE" deps-frontend

  deps-backend:
    image: *golang_image
    group: deps
    environment:
      BUILD_SUBMODULE: *build_submodule
      GOPROXY_OVERRIDE: *goproxy_override
    commands:
      - *goproxy_setup
      - ./.ci-make.sh submodule-make "$BUILD_SUBMODULE" deps-backend

  tag-pre-condition:
    image: *ci_verify_image
    environment:
      BUILD_SUBMODULE: *build_submodule
    commands:
      - cd "$BUILD_SUBMODULE"
      - git update-ref refs/heads/tag_test $(git rev-parse --verify HEAD)

  security-check:
    image: *golang_image
    group: checks
    environment:
      BUILD_SUBMODULE: *build_submodule
      GOPROXY_OVERRIDE: *goproxy_override
    commands:
      - *goproxy_setup
      - ./.ci-make.sh submodule-make "$BUILD_SUBMODULE" security-check

  checks-backend:
    image: *forgejo_test_image
    group: checks
    environment:
      GOPROXY_OVERRIDE: *goproxy_override
      DEP_GOLANG_VER: *forgejo_test_golang_ver
      DEP_GOLANG_NODEB_REV: *forgejo_test_golang_nodeb_rev
    commands:
      - *goproxy_setup
      - ./.ci-make.sh forgejo-test-deps
      - su forgejo -c './.ci-make.sh submodule-make forgejo checks-backend'
      - chown -R root:root .

  build-frontend:
    image: *nodejs_image
    group: pre-build
    environment:
      BUILD_SUBMODULE: *build_submodule
    commands:
      - ./.ci-make.sh submodule-make "$BUILD_SUBMODULE" frontend

  download-bin-amd64:
    image: *bin_dl_image
    group: build-main
    commands:
      - ./.ci-make.sh download-binary forgejo-bin-dl
    when:
      event: [ tag ]

  build-forgejo-amd64:
    image: *golang_image
    group: build-main
    environment:
      BUILD_SUBMODULE: *build_submodule
      GOSUMDB: sum.golang.org
      TAGS: bindata
      GOPROXY_OVERRIDE: *goproxy_override
    commands:
      - *goproxy_setup
      - ./.ci-make.sh submodule-build "$BUILD_SUBMODULE" forgejo-bin

  build-forgejo-sqlite-amd64:
    image: *golang_image
    environment:
      BUILD_SUBMODULE: *build_submodule
      GOSUMDB: sum.golang.org
      TAGS: bindata sqlite sqlite_unlock_notify
      GOPROXY_OVERRIDE: *goproxy_override
    commands:
      - *goproxy_setup
      - ./.ci-make.sh submodule-build "$BUILD_SUBMODULE" forgejo-sqlite-bin

  package-bullseye:
    image: *deb_build_image
    group: package
    commands:
      - ./.ci-make.sh package-prep
      - ./.ci-make.sh package-build
      - ./.ci-make.sh package-clean
      
  package-repo:
    image: *deb_build_image
    group: package
    commands:
      - cd repo-deb
      - ./build.sh

  gen-sha256:
    image: *ci_verify_image
    commands:
      - ./.ci-make.sh pkg-gen-sha256
      - ./.ci-make.sh preview-sha256

  test-inst-bookworm:
    image: *deb_test_image_bookworm
    group: pkg-test-1
    commands:
      - ./.ci-make.sh install-run-test ./forgejo_*_amd64.deb

  test-inst-bookworm-user:
    image: *deb_test_image_bookworm
    group: pkg-test-1
    commands:
      - ./.ci-make.sh test-userinst-prep
      - ./.ci-make.sh install-run-test ./forgejo_*_amd64.deb

  test-inst-bullseye-sqlite:
    image: *deb_test_image_bullseye
    group: pkg-test-1
    commands:
      - ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb

  test-inst-bookworm-sqlite:
    image: *deb_test_image_bookworm
    group: pkg-test-1
    commands:
      - ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb

  test-inst-buster-sqlite:
    image: *deb_test_image_buster
    group: pkg-test-2
    commands:
      - ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb

  test-inst-sid-sqlite:
    image: *deb_test_image_sid
    group: pkg-test-2
    commands:
      - ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb

  test-inst-jammy-sqlite:
    image: *deb_test_image_jammy
    group: pkg-test-2
    commands:
      - ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb

  test-inst-focal-sqlite:
    image: *deb_test_image_focal
    group: pkg-test-2
    commands:
      - ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb

  test-inst-mantic-sqlite:
    image: *deb_test_image_mantic
    group: pkg-test-3
    commands:
      - ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb

  test-inst-lunar-sqlite:
    image: *deb_test_image_lunar
    group: pkg-test-3
    commands:
      - ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb

  test-inst-bullseye-bin:
    image: *deb_test_image_bullseye
    group: pkg-test-3
    commands:
      - ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
    when:
      event: [ tag ]

  test-inst-bookworm-bin:
    image: *deb_test_image_bookworm
    group: pkg-test-3
    commands:
      - ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
    when:
      event: [ tag ]

  test-inst-buster-bin:
    image: *deb_test_image_buster
    group: pkg-test-4
    commands:
      - ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
    when:
      event: [ tag ]

  test-inst-sid-bin:
    image: *deb_test_image_sid
    group: pkg-test-4
    commands:
      - ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
    when:
      event: [ tag ]

  test-inst-jammy-bin:
    image: *deb_test_image_jammy
    group: pkg-test-4
    commands:
      - ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
    when:
      event: [ tag ]

  test-inst-focal-bin:
    image: *deb_test_image_focal
    group: pkg-test-4
    commands:
      - ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
    when:
      event: [ tag ]

  test-inst-mantic-bin:
    image: *deb_test_image_mantic
    group: pkg-test-5
    commands:
      - ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
    when:
      event: [ tag ]

  test-inst-lunar-bin:
    image: *deb_test_image_lunar
    group: pkg-test-5
    commands:
      - ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
    when:
      event: [ tag ]
      
  test-repo-bookworm-sqlite:
    image: *deb_test_image_bookworm
    group: pkg-test-5
    commands:
      - ./.ci-make.sh install-repo-test ./repo-deb/forgejo-deb-repo_0-0_all.deb forgejo-sqlite
      - ./.ci-make.sh force-clean-forgejo
      - ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
      - ./.ci-make.sh verify-data-dir-chmod

  upload-crystalcommit:
    image: woodpeckerci/plugin-gitea-release
    group: upload
    settings:
      base_url: https://sc.cryxtal.org
      files:
        - "*.deb"
        - "*.deb.sha256"
      api_key:
        from_secret: sc_api_key
      prerelease: false
      skip_verify: true
    when:
      event: [ tag ]

  upload-codeberg:
    image: woodpeckerci/plugin-gitea-release
    group: upload
    settings:
      base_url: https://codeberg.org
      files:
        - "*.deb"
        - "*.deb.sha256"
      api_key:
        from_secret: cb_api_key
      prerelease: false
      skip_verify: true
    when:
      event: [ tag ]

  publish-apt-repo:
    image: *ci_verify_image
    group: upload
    environment:
      FORGEJO_SITE: https://code.forgejo.org
      FORGEJO_OWNER: forgejo-contrib
      DEBIAN_DIST: bullseye
      DEBIAN_COMPONENT: forgejo
    secrets: [ cfo_api_key ]
    commands:
      - export FORGEJO_KEY=$CFO_API_KEY
      - ./.ci-forgejo-apt.sh *.deb
    when:
      event: [ tag ]