Last active
October 9, 2019 05:27
-
-
Save d-kuro/664bdc199ad8c95bbde8f9259e168f39 to your computer and use it in GitHub Desktop.
Golang CircieCI config
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
version: 2.1 | |
executors: | |
build: | |
parameters: | |
go-version: | |
type: string | |
docker: | |
- image: circleci/golang:<< parameters.go-version >> | |
environment: | |
GO111MODULE: "on" | |
working_directory: /go/src/d-kuro/go-sandbox | |
commands: | |
go_mod_download: | |
steps: | |
- restore_cache: | |
name: Restore go modules cache | |
keys: | |
- go-modules-{{ checksum "go.sum" }} | |
- run: go mod download | |
- save_cache: | |
name: Save go modules cache | |
key: go-modules-{{ checksum "go.sum" }} | |
paths: | |
- "/go/pkg/mod" | |
jobs: | |
build: | |
parameters: | |
go-version: | |
type: string | |
golangci-lint-version: | |
type: string | |
executor: | |
name: build | |
go-version: << parameters.go-version >> | |
steps: | |
- checkout | |
- go_mod_download | |
- run: | |
name: Install GolangCI-Lint | |
command: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v<< parameters.golangci-lint-version >> | |
- run: | |
name: Run GolangCI-Lint | |
command: ./bin/golangci-lint run --tests --disable-all --enable=goimports --enable=golint --enable=govet --enable=errcheck --enable=staticcheck | |
- run: | |
name: Run Tests | |
command: go test -race -v ./... | |
workflows: | |
golang-workflow: | |
jobs: | |
- build: | |
go-version: "1.11.5" | |
golangci-lint-version: "1.15.0" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment