forked from siemens/wfx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
118 lines (109 loc) · 2.35 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
# SPDX-FileCopyrightText: 2023 Siemens AG
#
# SPDX-License-Identifier: Apache-2.0
#
# Author: Michael Adler <michael.adler@siemens.com>
---
workflow:
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
stages:
- build
- lint
- test
- deploy
build:
stage: build
image: golang:alpine
variables:
GOPATH: /tmp/go
CC: gcc
before_script:
- apk add --no-cache git gcc libc-dev make bash git
- |
if [[ -d go ]]; then
mv go "$GOPATH"
else
mkdir -p "$GOPATH"
fi
go mod download
script:
- make test
- make STATIC=1
after_script:
- mv "$GOPATH" .
artifacts:
expire_in: 1 day
paths:
- wfx
- wfxctl
- wfx-viewer
- wfx-loadtest
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- go/
lint:
stage: lint
needs: []
image: alpine:edge
before_script:
- apk add --no-cache go just staticcheck reuse golangci-lint bash
script:
- just lint
generate:
stage: lint
needs: []
image:
name: archlinux:latest
before_script:
- pacman -Syu --noconfirm python-yaml git just go flatbuffers go-swagger gofumpt
- git lfs install && git submodule update
script:
- just generate
- git diff --exit-code
test-postgres:
stage: test
image: golang:alpine
services:
- postgres:15
needs: []
variables:
CGO_ENABLED: 1
# see https://docs.gitlab.com/ee/ci/services/postgres.html
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_DB: $POSTGRES_DB
POSTGRES_USER: $POSTGRES_USER
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
POSTGRES_HOST_AUTH_METHOD: trust
PGHOST: postgres
PGPORT: 5432
PGDATABASE: $POSTGRES_DB
PGUSER: $POSTGRES_USER
PGPASSWORD: $POSTGRES_PASSWORD
PGSSLMODE: disable
before_script:
- apk add --no-cache gcc libc-dev git just bash
script:
- just postgres-integration-test
test-mysql:
stage: test
image: golang:alpine
services:
- mysql:8-debian
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:
- apk add --no-cache gcc libc-dev git just bash
script:
- just mysql-integration-test