Skip to content

Commit 0cc901b

Browse files
author
Ivan Mirić
committed
Run golangci-lint in CircleCI, abandon GolangCI
Closes #1365
1 parent 7e4309c commit 0cc901b

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed

.circleci/config.yml

+40
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,43 @@ jobs:
2121
dep check
2222
2323
24+
lint:
25+
docker:
26+
- image: circleci/golang:1.14
27+
environment:
28+
GOPATH: /home/circleci/.go_workspace
29+
GOLANGCI_VERSION: v1.20.0
30+
working_directory: /home/circleci/.go_workspace/src/github.com/loadimpact/k6
31+
steps:
32+
# Workaround for custom env vars not available in cache keys
33+
# https://discuss.circleci.com/t/cannot-use-circle-yml-environment-variables-in-cache-keys/10994/8
34+
- run: echo $GOLANGCI_VERSION > /tmp/.golangci.version
35+
- restore_cache:
36+
name: Restore golangci-lint cache
37+
key: golangci-lint-{{ arch }}-{{ checksum "/tmp/.golangci.version" }}-{{ .Environment.CACHE_VERSION }}
38+
paths:
39+
- /home/circleci/.go_workspace/bin/golangci-lint
40+
- run:
41+
name: Install golangci-lint
42+
command: |
43+
export PATH="$GOPATH/bin:$PATH"
44+
command -v golangci-lint && exit
45+
GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@$GOLANGCI_VERSION
46+
- save_cache:
47+
name: Save golangci-lint cache
48+
key: golangci-lint-{{ arch }}-{{ checksum "/tmp/.golangci.version" }}-{{ .Environment.CACHE_VERSION }}
49+
paths:
50+
- /home/circleci/.go_workspace/bin/golangci-lint
51+
- checkout
52+
- run:
53+
name: Run golangci-lint
54+
command: |
55+
export PATH="$GOPATH/bin:$PATH"
56+
basecommit=$(echo $CIRCLE_COMPARE_URL | sed -n 's:.*compare/\([^.]*\)\..*$:\1:p')
57+
echo -e "$CIRCLE_COMPARE_URL\nbasecommit=$basecommit"
58+
golangci-lint run --out-format=tab --new-from-rev "${basecommit-master}" ./...
59+
60+
2461
test:
2562
docker:
2663
- image: circleci/golang:1.14
@@ -152,6 +189,8 @@ jobs:
152189
curl --fail -H "X-GPG-PASSPHRASE: $GPG_PASSPHRASE" -T dist/k6-v$VERSION-amd64.deb "https://$BINTRAY_USER:[email protected]/content/loadimpact/deb/k6/$VERSION/k6-v$VERSION-amd64.deb;deb_distribution=stable;deb_component=main;deb_architecture=amd64;publish=1;override=1"
153190
# Publishing rpm
154191
curl --fail -H "X-GPG-PASSPHRASE: $GPG_PASSPHRASE" -T dist/k6-v$VERSION-amd64.rpm "https://$BINTRAY_USER:[email protected]/content/loadimpact/rpm/k6/$VERSION/k6-v$VERSION-amd64.rpm?publish=1&override=1"
192+
193+
155194
workflows:
156195
version: 2
157196
test_and_build:
@@ -160,6 +199,7 @@ workflows:
160199
filters:
161200
tags:
162201
only: /.*/
202+
- lint
163203
- test:
164204
filters:
165205
tags:

.golangci.yml

-3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,3 @@ linters:
5555
- godox
5656
- wsl
5757
fast: false
58-
59-
service:
60-
golangci-lint-version: 1.20.x

0 commit comments

Comments
 (0)