forked from mendersoftware/mender
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
100 lines (94 loc) · 3.1 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
stages:
- test
- publish
- trigger
include:
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-github-status-updates.yml'
test:
stage: test
image: golang:1.14
variables:
REPO_NAME: github.com/mendersoftware/mender
before_script:
# Rename the branch we're on, so that it's not in the way for the
# subsequent fetch. It's ok if this fails, it just means we're not on any
# branch.
- git branch -m temp-branch || true
# Git trick: Fetch directly into our local branches instead of remote
# branches.
- git fetch origin 'refs/heads/*:refs/heads/*'
# Get last remaining tags, if any.
- git fetch --tags origin
- mkdir -p /go/src/$(dirname $REPO_NAME)/mender /go/src/_/builds
- cp -r $CI_PROJECT_DIR /go/src/$(dirname $REPO_NAME)
- cd $GOPATH/src/$REPO_NAME
- apt-get update && apt-get install -yyq liblzma-dev libssl-dev
- make get-tools
script:
- make extracheck
- make coverage
- make
- 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
tags:
- mender-qa-slave
artifacts:
expire_in: 2w
paths:
- unit-coverage.tar
publish:tests:
stage: publish
image: golang:1.14-alpine3.11
dependencies:
- test
before_script:
- apk add --no-cache git
# Run go get out of the repo to not modify go.mod
- cd / && go get github.com/mattn/goveralls && cd -
# 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, CI_PR_NUMBER,
# and pass few others as command line arguments.
# See also https://docs.coveralls.io/api-reference
- export CI_BRANCH=${CI_COMMIT_BRANCH}
- export CI_PR_NUMBER=${CI_COMMIT_BRANCH#pr_}
script:
- tar -xvf unit-coverage.tar
- goveralls
-repotoken ${COVERALLS_TOKEN}
-service gitlab-ci
-jobid $(git rev-parse HEAD)
-covermode set
-flagname unittests
-parallel
-coverprofile $(find tests/unit-coverage -name 'coverage.txt' | tr '\n' ',' | sed 's/,$//')
trigger:mender-qa:
image: alpine
stage: trigger
before_script:
- apk add --no-cache git curl bash python3 py3-pip
- pip3 install pyyaml
- git clone https://github.com/mendersoftware/integration.git integration
- git clone https://github.com/mendersoftware/mender-qa.git mender-qa
script:
- export WORKSPACE=$(pwd)
- mender-qa/scripts/gitlab_trigger_client_publish $CI_COMMIT_REF_NAME
only:
- /^(master|[0-9]+\.[0-9]+\.x)$/
trigger:mender-dist-packages:
image: alpine
stage: trigger
before_script:
- apk add --no-cache curl
script:
- curl -v -f -X POST
-F token=$MENDER_DIST_PACKAGES_TRIGGER_TOKEN
-F ref=master
-F variables[MENDER_VERSION]=$CI_COMMIT_REF_NAME
https://gitlab.com/api/v4/projects/14968223/trigger/pipeline
only:
- tags
- master