-
Notifications
You must be signed in to change notification settings - Fork 18
/
.gitlab-ci-check-golang-lint.yml
66 lines (62 loc) · 1.74 KB
/
.gitlab-ci-check-golang-lint.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
# .gitlab-ci-check-golang-lint.yml
#
# This gitlab-ci template performs all static checks from golangci-lint,
# see https://github.com/golangci/golangci-lint
#
# Add it to the project in hand through Gitlab's include functionality
#
# include:
# - project: 'Northern.tech/Mender/mendertesting'
# file: '.gitlab-ci-check-golang-lint.yml'
#
# The standard .golangci.yml from this repository is used unless the
# project including this template has its own version in the root dir.
#
# If the repo has some compile time dependencies, the template expect to
# exist a deb-requirements.txt file with the Debian OS required packages
#
stages:
- test
variables:
IMAGE_GOLANGCI_VERSION:
description: |-
Container image tag of golangci/golangci-lint used for static checks.
value: "v1.55.1"
test:static:
tags:
- mender-qa-worker-generic-light
stage: test
needs: []
except:
- /^saas-[a-zA-Z0-9.]+$/
image: "golangci/golangci-lint:${IMAGE_GOLANGCI_VERSION}"
before_script:
# Install compile dependencies
- if [ -f deb-requirements.txt ]; then
apt-get -qq update &&
apt install -yq $(cat deb-requirements.txt);
fi
# Copy .golangci.yml
- if [ ! -f .golangci.yml ]; then
- curl -f
https://raw.githubusercontent.com/mendersoftware/mendertesting/master/.golangci.yml
--output .golangci.yml
- sed -i "s/#CI_PROJECT_NAME#/${CI_PROJECT_NAME}/g" .golangci.yml
- fi
script:
- golangci-lint run -v
test:govendor-check:
tags:
- mender-qa-worker-generic-light
stage: test
needs: []
rules:
- exists:
- vendor
variables:
GOLANG_VERSION: "1.21.3"
image: golang:${GOLANG_VERSION}
script:
- go mod tidy
- go mod vendor
- git diff --exit-code