-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TEST/MAJOR: ci: use go version from go.mod file in gitlab
- Loading branch information
Showing
2 changed files
with
78 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
variables: | ||
GO_VERSION: "from_go_mod_file" | ||
stages: | ||
- diff | ||
- lint | ||
- test | ||
diff: | ||
stage: diff | ||
image: | ||
name: $CI_REGISTRY_GO/golang:$GO_VERSION | ||
entrypoint: [""] | ||
tags: | ||
- go | ||
script: | ||
- make generate | ||
- git diff | ||
- test -z "$(git diff 2> /dev/null)" || exit 'Files are not generated or formatted with gofumpt, issue `make generate` and commit the result' | ||
- test -z "$(git ls-files --others --exclude-standard 2> /dev/null)" || exit 'Generation created untracked files, cannot proceed' | ||
rules: | ||
- if: '$CI_PIPELINE_SOURCE == "parent_pipeline"' | ||
lint: | ||
stage: lint | ||
image: | ||
name: $CI_REGISTRY_GO/golang:$GO_VERSION | ||
entrypoint: [""] | ||
tags: | ||
- go | ||
script: | ||
- make lint | ||
rules: | ||
- if: '$CI_PIPELINE_SOURCE == "parent_pipeline"' | ||
tidy: | ||
stage: lint | ||
image: | ||
name: $CI_REGISTRY_GO/golang:$GO_VERSION | ||
entrypoint: [""] | ||
tags: | ||
- go | ||
script: | ||
- go mod tidy | ||
- test -z "$(git diff 2> /dev/null)" || exit 'Go modules not tidied, issue \`go mod tidy\` and commit the result' | ||
rules: | ||
- if: '$CI_PIPELINE_SOURCE == "parent_pipeline"' | ||
test: | ||
stage: test | ||
image: | ||
name: $CI_REGISTRY_GO/golang:$GO_VERSION | ||
entrypoint: [""] | ||
tags: | ||
- go | ||
script: | ||
- go build -v . | ||
- make test | ||
rules: | ||
- if: '$CI_PIPELINE_SOURCE == "parent_pipeline"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters