-
Notifications
You must be signed in to change notification settings - Fork 15
/
.gitlab-ci.yml
75 lines (67 loc) · 1.66 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
---
image: golang:1.20.1
stages:
- prepare
- test
- build
- release
default:
tags:
- shared
# Calls 'go vet' on the entire project to catch subtle errors
vet:
stage: prepare
tags:
- shared
script:
- go vet $(go list ./... | grep -v /vendor/)
# Lint job is responsible for calling 'golangci-lint'.
lint:
stage: prepare
image: golangci/golangci-lint:v1.51.2
script:
- golangci-lint --timeout 10m run --go "1.20"
# Execute all tests in the project
test:
stage: test
script:
- go test -race $(go list ./... | grep -v /vendor/)
# Build the calendarsync binary, injecting current git version information
build:
stage: build
script:
- go mod download
- go build -race -ldflags "-X 'main.Version=$(git describe --exact-match --tags 2> /dev/null || git rev-parse --short HEAD)' -X 'main.BuildTime=$(date)'" -o calendarsync cmd/calendarsync/main.go
artifacts:
paths:
- calendarsync
createTag:
stage: release
image: registry.gitlab.com/juhani/go-semrel-gitlab:v0.21.1
variables:
GSG_PATCH_COMMIT_TYPES: chore,fix,refactor,perf,docs,style,test,renovate
GSG_INITIAL_DEVELOPMENT: "true"
tags:
- shared
when: manual
only:
- main
script:
- release tag --list-other-changes
release:
stage: release
image:
name: goreleaser/goreleaser:v1.17.2
entrypoint: ['']
dependencies: []
only:
- tags
variables:
# Disable shallow cloning so that goreleaser can diff between tags to
# generate a changelog.
GIT_DEPTH: 0
DOCKER_REGISTRY: $CI_REGISTRY
# DOCKER_USERNAME: $CI_REGISTRY_USER
# DOCKER_PASSWORD: $CI_REGISTRY_PASSWORD
script:
- goreleaser release --clean