-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve CircleCI config; clean up go.mod/go.sum; .dockerignore more f…
…iles (#915)
- Loading branch information
Showing
6 changed files
with
114 additions
and
95 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 |
---|---|---|
@@ -1,106 +1,92 @@ | ||
--- | ||
version: 2.1 | ||
orbs: | ||
win: circleci/windows@2.4.0 | ||
|
||
parameters: | ||
go-version: | ||
type: string | ||
default: "1.14.2" | ||
workspace-dir: | ||
type: string | ||
default: "/home/circleci" | ||
|
||
commands: | ||
setup: | ||
description: "install go, checkout and restore cache" | ||
steps: | ||
- run: | ||
name: "install go" | ||
command: | | ||
curl --create-dirs -o $GOPATH/go.tar.gz https://dl.google.com/go/go${GOVERSION}.linux-amd64.tar.gz | ||
tar --strip-components=1 -C $GOPATH -xzf $GOPATH/go.tar.gz | ||
rm -rf $GOPATH/go.tar.gz | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- 'v2-pkg-cache-{{ checksum "go.sum" }}-{{ .Environment.GOVERSION }}' | ||
|
||
executors: | ||
linux: | ||
machine: | ||
image: ubuntu-1604:201903-01 | ||
docker_layer_caching: true | ||
working_directory: << pipeline.parameters.workspace-dir >>/project | ||
environment: | ||
GOPATH: << pipeline.parameters.workspace-dir >>/go/<< pipeline.parameters.go-version >> | ||
PATH: << pipeline.parameters.workspace-dir >>/go/<< pipeline.parameters.go-version >>/bin:/usr/local/bin:/usr/bin:/bin | ||
GOVERSION: << pipeline.parameters.go-version >> | ||
|
||
workflows: | ||
version: 2 | ||
test_os: | ||
main: | ||
jobs: | ||
- go-install | ||
- tidy-lint: | ||
- prepare-tidy | ||
- lint: | ||
requires: | ||
- go-install | ||
- test-linux: | ||
- prepare-tidy | ||
- build-test: | ||
requires: | ||
- go-install | ||
- test-windows | ||
- prepare-tidy | ||
|
||
jobs: | ||
go-install: | ||
machine: | ||
image: ubuntu-1604:201903-01 | ||
prepare-tidy: | ||
executor: linux | ||
steps: | ||
- restore_cache: | ||
keys: | ||
- v1-pkg-cache | ||
- setup | ||
- run: | ||
name: "install go 1.14" | ||
command: | | ||
ls -A ~/go && echo already downloaded. exiting. && exit 0 | ||
curl -o ~/go.tar.gz https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz | ||
tar -C ~/ -xzvf ~/go.tar.gz | ||
name: "make tidy" | ||
command: make tidy && git diff --exit-code | ||
- run: | ||
name: "make mod-download" | ||
command: make mod-download | ||
- save_cache: | ||
key: v1-pkg-cache | ||
key: 'v2-pkg-cache-{{ checksum "go.sum" }}-{{ .Environment.GOVERSION }}' | ||
paths: | ||
- ~/go | ||
- << pipeline.parameters.workspace-dir >>/go/<< pipeline.parameters.go-version >>/pkg/mod | ||
|
||
tidy-lint: | ||
machine: | ||
image: ubuntu-1604:201903-01 | ||
environment: | ||
GOPATH: "/home/circleci/go" | ||
GOROOT: "/home/circleci/go" | ||
GOBIN: "/home/circleci/go/bin" | ||
PATH: "/home/circleci/go/bin:/usr/local/bin:/usr/bin:/bin" | ||
lint: | ||
executor: linux | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- v1-pkg-cache | ||
- run: | ||
name: "make tidy" | ||
command: make tidy && git diff --exit-code | ||
- setup | ||
- run: | ||
name: "install linter" | ||
command: go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.23.6 | ||
command: "pushd .. && GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.23.6 && popd" | ||
- run: | ||
name: "make lint" | ||
command: make lint | ||
test-linux: | ||
machine: | ||
image: ubuntu-1604:201903-01 | ||
docker_layer_caching: true | ||
environment: | ||
GOPATH: "/home/circleci/go" | ||
GOROOT: "/home/circleci/go" | ||
GOBIN: "/home/circleci/go/bin" | ||
PATH: "/home/circleci/go/bin:/usr/local/bin:/usr/bin:/bin" | ||
|
||
build-test: | ||
executor: linux | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- v1-pkg-cache | ||
- setup | ||
- run: | ||
name: "make build-all" | ||
name: "make build-all" | ||
command: make build-all | ||
- run: | ||
name: "make sidecar" | ||
command: make docker-sidecar | ||
name: "make docker" | ||
command: make docker | ||
- run: | ||
name: "make test" | ||
command: | | ||
mkdir -p $HOME/testground/plans | ||
ln -s $HOME/project/plans/placebo $HOME/testground/plans/placebo | ||
go test -v ./... | ||
# The cache might be updated due to the build. Save it back. | ||
- save_cache: | ||
key: v1-pkg-cache | ||
paths: | ||
- ~/go | ||
|
||
# https://circleci.com/docs/2.0/executor-intro/#windows | ||
test-windows: | ||
executor: win/default | ||
steps: | ||
- checkout | ||
- run: | ||
name: "install go 1.14" | ||
command: | | ||
$wc = New-Object System.Net.WebClient | ||
$wc.DownloadFile("https://dl.google.com/go/go1.14.2.windows-amd64.zip", "C:\Users\circleci\go.zip") | ||
unzip.exe -d C:\Users\circleci C:\Users\circleci\go.zip | ||
- run: | ||
name: "test build" | ||
command: | | ||
C:\Users\circleci\go\bin\go.exe build ./... |
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 |
---|---|---|
|
@@ -6,4 +6,10 @@ | |
**/.gitkeep | ||
**/.gitmodules | ||
**/Dockerfile | ||
**/infra | ||
**/infra | ||
.circleci | ||
**/*.md | ||
Makefile | ||
LICENSE-* | ||
.env.* | ||
**/*.toml |
File renamed without changes.
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
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
Oops, something went wrong.