Skip to content

Commit

Permalink
Run golangci-lint in CircleCI, abandon GolangCI
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Mirić committed Apr 24, 2020
1 parent c30017b commit f967a5f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
40 changes: 40 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,43 @@ jobs:
dep check
lint:
docker:
- image: circleci/golang:1.14
environment:
GOPATH: /home/circleci/.go_workspace
GOLANGCI_VERSION: v1.20.0
working_directory: /home/circleci/.go_workspace/src/github.com/loadimpact/k6
steps:
# Workaround for custom env vars not available in cache keys
# https://discuss.circleci.com/t/cannot-use-circle-yml-environment-variables-in-cache-keys/10994/8
- run: echo $GOLANGCI_VERSION > /tmp/.golangci.version
- restore_cache:
name: Restore golangci-lint cache
key: golangci-lint-{{ arch }}-{{ checksum "/tmp/.golangci.version" }}-{{ .Environment.CACHE_VERSION }}
paths:
- /home/circleci/.go_workspace/bin/golangci-lint
- run:
name: Install golangci-lint
command: |
export PATH="$GOPATH/bin:$PATH"
command -v golangci-lint && exit
GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@$GOLANGCI_VERSION
- save_cache:
name: Save golangci-lint cache
key: golangci-lint-{{ arch }}-{{ checksum "/tmp/.golangci.version" }}-{{ .Environment.CACHE_VERSION }}
paths:
- /home/circleci/.go_workspace/bin/golangci-lint
- checkout
- run:
name: Run golangci-lint
command: |
export PATH="$GOPATH/bin:$PATH"
basecommit=$(echo $CIRCLE_COMPARE_URL | sed -n 's:.*compare/\([^.]*\)\..*$:\1:p')
echo -e "$CIRCLE_COMPARE_URL\nbasecommit=$basecommit"
golangci-lint run --out-format=tab --new-from-rev "${basecommit-master}" ./...
test:
docker:
- image: circleci/golang:1.14
Expand Down Expand Up @@ -152,6 +189,8 @@ jobs:
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"
# Publishing rpm
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"
workflows:
version: 2
test_and_build:
Expand All @@ -160,6 +199,7 @@ workflows:
filters:
tags:
only: /.*/
- lint
- test:
filters:
tags:
Expand Down
3 changes: 0 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,3 @@ linters:
- godox
- wsl
fast: false

service:
golangci-lint-version: 1.20.x

0 comments on commit f967a5f

Please sign in to comment.