-
Notifications
You must be signed in to change notification settings - Fork 15
/
.gitlab-ci.yml
95 lines (85 loc) · 3.25 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
variables:
DOCKER_REPOSITORY: mendersoftware/integration-test-runner
DOCKER_VERSION: "27.3"
stages:
- test
- build
- publish
- sync
include:
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-check-golang-lint.yml'
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-check-golang-unittests.yml'
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-check-docker-build.yml'
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-github-status-updates.yml'
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-check-docker-deploy.yml'
test:unit:
script:
- pip install PyGithub
- git config --global user.email test@example.com
- git config --global user.name mendertester
# Clone this for use in certain tests.
- git clone --depth 1 https://github.com/mendersoftware/integration
- export INTEGRATION_DIRECTORY="$(realpath integration)"
- go list ./... | grep -v vendor | xargs -n1 -I {} go test -v -covermode=atomic -coverprofile=../../../{}/coverage.txt {} 2>&1 | tee /dev/stderr | go-junit-report > ${CI_PROJECT_DIR}/test-results.xml || exit $?
- mkdir -p tests/unit-coverage && find . -name 'coverage.txt' -exec cp --parents {} ./tests/unit-coverage \;
- tar -cvf ${CI_PROJECT_DIR}/unit-coverage.tar tests/unit-coverage
test:acceptance_tests:
stage: test
tags:
- hetzner-amd-beefy
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/tiangolo/docker-with-compose
services:
- name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:${DOCKER_VERSION}-dind
alias: docker
variables:
DOCKER_HOST: "tcp://docker:2376"
DOCKER_CERT_PATH: "/certs/client"
DOCKER_TLS_VERIFY: "1"
DOCKER_TLS_CERTDIR: "/certs"
script:
- make acceptance-testing-build
- make acceptance-testing-up
- sh -c "sleep 30"
- make acceptance-testing-run
after_script:
- make acceptance-testing-logs
- make acceptance-testing-down
artifacts:
expire_in: 2w
paths:
- tests/coverage-acceptance.txt
when: always
publish:acceptance:
stage: publish
rules:
- if: $CI_COMMIT_BRANCH !~ /^saas-[a-zA-Z0-9.]+$/
image: registry.gitlab.com/northern.tech/mender/mender-test-containers:goveralls-master
needs:
- job: test:acceptance_tests
artifacts: true
before_script:
# Coveralls env variables:
# According to https://docs.coveralls.io/supported-ci-services
# we should set CI_NAME, CI_BUILD_NUMBER, etc. But according
# to goveralls source code (https://github.com/mattn/goveralls)
# many of these are not supported. Set CI_BRANCH,
# and pass few others as command line arguments.
# See also https://docs.coveralls.io/api-reference
- export CI_BRANCH=${CI_COMMIT_BRANCH}
script:
- goveralls
-repotoken ${COVERALLS_TOKEN}
-service gitlab-ci
-jobid $CI_PIPELINE_ID
-covermode set
-flagname acceptance
-parallel
-coverprofile ./tests/coverage-acceptance.txt
sync:image:
variables:
TARGET_MANIFEST_FILE: "kubernetes/mender-test-runner/test-runner-deployment.yaml,kubernetes/cfengine-repos-sync/repos-sync-cfengine-com-deployment.yaml,kubernetes/northerntechhq-repos-sync/repos-sync-northerntechhq-deployment.yaml"