forked from mendersoftware/mender-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
110 lines (103 loc) · 3.04 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
variables:
GOLANG_VERSION:
value: "1.22.4"
description: 'Go version to use for building and testing'
include:
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-check-commits.yml'
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-github-status-updates.yml'
stages:
- build
- test
.dind-login: &dind-login
- mkdir -p $HOME/.docker && echo $DOCKER_AUTH_CONFIG > $HOME/.docker/config.json
build:dist:
image: golang:${GOLANG_VERSION}
stage: build
rules:
- when: never
tags:
- hetzner-amd-beefy
script:
- make -C backend build
after_script:
- tar -zcvf dist.tar.gz dist/
artifacts:
expire_in: 1w
when: always
paths:
- dist.tar.gz
test:unit:
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/golang:${GOLANG_VERSION}-bullseye
stage: test
rules:
- when: never
tags:
- hetzner-amd-beefy
services:
- name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/mongo:6.0
alias: mongo
variables:
MONGODB_DEBIAN_RELEASE: "bullseye"
MONGODB_VERSION: "6.0"
TEST_MONGO_URL: "mongodb://mongo"
WORKFLOWS_MONGO_URL: "mongodb://mongo"
before_script:
# mongodb-org package needs systemd, this circumnavigates the issue providing a fake systemctl command
- ln -s /bin/true /usr/sbin/systemctl
# install mongodb for the tests that use it locally
- curl -fsSL https://www.mongodb.org/static/pgp/server-${MONGODB_VERSION}.asc | gpg -o /usr/share/keyrings/mongodb-server-${MONGODB_VERSION}.gpg --dearmor
- echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-${MONGODB_VERSION}.gpg ] http://repo.mongodb.org/apt/debian ${MONGODB_DEBIAN_RELEASE}/mongodb-org/${MONGODB_VERSION} main" | tee /etc/apt/sources.list.d/mongodb-org-${MONGODB_VERSION}.list
- apt-get -qq update
- apt-get install -qy mongodb-org
script:
- make -C backend test-unit
test:acceptance:
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:26-cli
stage: test
rules:
- when: never
tags:
- hetzner-amd-beefy
services:
- name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:26-dind
alias: docker
needs:
- job: build:dist
artifacts: true
before_script:
- apk add make bash go git
- tar -zxvf dist.tar.gz
- make -C backend docker-acceptance
- *dind-login
script:
- make -C backend test-acceptance
test:integration:
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:26-cli
stage: test
rules:
- when: never
tags:
- hetzner-amd-beefy
services:
- name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:26-dind
alias: docker
needs:
- job: build:dist
artifacts: true
before_script:
- apk add make bash git curl
- tar -zxvf dist.tar.gz
- *dind-login
script:
- make -C backend test-integration
artifacts:
expire_in: 1w
when: always
paths:
- backend/logs.*
- backend/results_integration_*.xml
- backend/report_integration_*.html
reports:
junit: backend/results_integration_*.xml