-
Notifications
You must be signed in to change notification settings - Fork 6
/
.gitlab-ci.yml
151 lines (135 loc) · 3.32 KB
/
.gitlab-ci.yml
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
# SPDX-FileCopyrightText: 2023 Siemens AG
#
# SPDX-License-Identifier: Apache-2.0
#
# Author: Michael Adler <[email protected]>
---
workflow:
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
stages:
- build
- lint
- test
- deploy
image: golang:1.23.2@sha256:ad5c126b5cf501a8caef751a243bb717ec204ab1aa56dc41dc11be089fafcb4f
build:
stage: build
parallel:
matrix:
- GOOS: ["linux", "windows"]
before_script:
- .ci/setup-build.sh
script:
- just build
artifacts:
expire_in: 1 day
paths:
- dist
test:
stage: test
needs: []
script:
- make test
test-postgres:
stage: test
services:
- postgres:17@sha256:8d3be35b184e70d81e54cbcbd3df3c0b47f37d06482c0dd1c140db5dbcc6a808
needs: []
variables:
CGO_ENABLED: 1
# see https://docs.gitlab.com/ee/ci/services/postgres.html
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_DB: wfx
POSTGRES_USER: wfx
POSTGRES_PASSWORD: secret
POSTGRES_HOST_AUTH_METHOD: trust
# duplicated from above but these variables are used by the Postgres driver
PGHOST: postgres
PGPORT: 5432
PGDATABASE: $POSTGRES_DB
PGUSER: $POSTGRES_USER
PGPASSWORD: $POSTGRES_PASSWORD
PGSSLMODE: disable
before_script:
- .ci/setup-postgres.sh
script:
- just postgres-integration-test
test-mysql:
stage: test
services:
- mysql:8-debian@sha256:49f4fcb0087318aa1c222c7e8ceacbb541cdc457c6307d45e6ee4313f4902e33
needs: []
variables:
CGO_ENABLED: 1
# see https://docs.gitlab.com/ee/ci/services/mysql.html
# Configure mysql service (https://hub.docker.com/_/mysql/)
MYSQL_DATABASE: wfx
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: wfx
MYSQL_PASSWORD: secret
MYSQL_HOST: mysql
before_script:
- .ci/setup-mysql.sh
script:
- just mysql-integration-test
cli-tests:
stage: test
needs: []
services:
- postgres:17@sha256:8d3be35b184e70d81e54cbcbd3df3c0b47f37d06482c0dd1c140db5dbcc6a808
- mysql:8-debian@sha256:49f4fcb0087318aa1c222c7e8ceacbb541cdc457c6307d45e6ee4313f4902e33
variables:
GIT_SUBMODULE_STRATEGY: recursive
CGO_ENABLED: 1
# see https://docs.gitlab.com/ee/ci/services/mysql.html
# Configure mysql service (https://hub.docker.com/_/mysql/)
MYSQL_DATABASE: wfx
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: wfx
MYSQL_PASSWORD: secret
MYSQL_HOST: mysql
# see https://docs.gitlab.com/ee/ci/services/postgres.html
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_DB: wfx
POSTGRES_USER: wfx
POSTGRES_PASSWORD: secret
POSTGRES_HOST_AUTH_METHOD: trust
PGHOST: postgres
PGPORT: 5432
PGUSER: wfx
PGPASSWORD: secret
PGDATABASE: wfx
before_script:
- .ci/setup-cli-tests.sh
- make
- make install
script:
- cd test && bats .
lint:
stage: lint
needs: []
before_script:
- .ci/setup-lint.sh
script:
- just lint
reuse:
stage: lint
needs: []
image:
name: fsfe/reuse:4.0.3@sha256:7e0ca22c55f73947d9ebc77deacc79357deff0c6abc63acdd87222f633718919
entrypoint: [""] # default entrypoint is "reuse" which doesn't work for CI
script:
- reuse lint || true # just a warning
generate:
stage: lint
needs: []
before_script:
- .ci/setup-generate.sh
- git lfs install && git submodule update
script:
- just generate
- git diff --exit-code