-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
25 lines (24 loc) · 1.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
stages:
- check
code_check:
tags:
- docker
stage: check
image: golang:1.17
before_script:
- echo -e "machine git.sapienzaapps.it\nlogin gitlab-ci-token\npassword ${CI_JOB_TOKEN}" > ~/.netrc
- export PATH=$PATH:~/go/bin/
- go env -w GOPRIVATE=git.sapienzaapps.it
- go install github.com/psampaz/go-mod-outdated@v0.8.0
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.43.0
# - wget https://github.com/aquasecurity/trivy/releases/download/v0.18.3/trivy_0.18.3_Linux-64bit.tar.gz -O /tmp/trivy_0.18.3_Linux-64bit.tar.gz
# - tar xf /tmp/trivy_0.18.3_Linux-64bit.tar.gz -C /usr/local/bin/ trivy
script:
# go test cannot modify go.sum and go.mod starting from Go 1.16. But some
# tests require additional dependencies and causes the command to fail. So
# we need to relax the constrain.
# See official docs: https://golang.org/ref/mod#build-commands
# And related issue: https://github.com/golang/go/issues/44129#issuecomment-814131122
- go test ./... -mod=mod
- golangci-lint run
- go list -u -m -json all | go-mod-outdated -update -direct