From 939305ff5a310c1a11c38514470dbe84fce93a16 Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Sun, 15 Sep 2019 12:10:13 +0200 Subject: [PATCH 1/3] ci: global GOFLAGS with -mod=vendor --- .circleci/config.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e05ab85a..e8b471a2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,5 +1,9 @@ version: 2 +env-shared: &env-shared + environment: + GOFLAGS: "-mod=vendor" + build-shared: &build-shared steps: - checkout @@ -16,12 +20,12 @@ build-shared: &build-shared - run: name: Run tests command: | - go test -v -mod=vendor ./... + go test -v ./... - run: name: Compile project on every platform command: | go get github.com/mitchellh/gox - GOFLAGS=-mod=vendor gox -parallel 10 -os "linux freebsd" -osarch "darwin/i386 darwin/amd64" + gox -parallel 10 -os "linux freebsd" -osarch "darwin/i386 darwin/amd64" - save_cache: key: pkg-cache-{{ checksum "go.sum" }}-v5 paths: @@ -29,14 +33,17 @@ build-shared: &build-shared jobs: "golang:1.12": + <<: *env-shared <<: *build-shared docker: - image: circleci/golang:1.12 "golang:latest": + <<: *env-shared <<: *build-shared docker: - image: circleci/golang:latest release: + <<: *env-shared docker: - image: circleci/golang:1.12 steps: From 74444ae328b3c399ac5911419990b9891f16cb44 Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Sun, 15 Sep 2019 12:19:04 +0200 Subject: [PATCH 2/3] ci: split gox step --- .circleci/config.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e8b471a2..48e39ee4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,9 +22,13 @@ build-shared: &build-shared command: | go test -v ./... - run: - name: Compile project on every platform + name: Get gox + working_directory: "/tmp" command: | go get github.com/mitchellh/gox + - run: + name: Compile project on every platform + command: | gox -parallel 10 -os "linux freebsd" -osarch "darwin/i386 darwin/amd64" - save_cache: key: pkg-cache-{{ checksum "go.sum" }}-v5 From 0bb696a24e9ca696ebe3149fec50fb6b45a70776 Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Sun, 15 Sep 2019 12:31:00 +0200 Subject: [PATCH 3/3] ci: comment some stuff --- .circleci/config.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 48e39ee4..c21a7ff0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,9 +1,12 @@ version: 2 +# global environment variables +# '& ' syntax is a YAML thing for creating referenceable documents env-shared: &env-shared environment: GOFLAGS: "-mod=vendor" +# build steps shared across different jobs build-shared: &build-shared steps: - checkout @@ -23,6 +26,7 @@ build-shared: &build-shared go test -v ./... - run: name: Get gox + # -mod=vendor doesn't work with go get while in source tree with go.mod in it working_directory: "/tmp" command: | go get github.com/mitchellh/gox @@ -36,6 +40,9 @@ build-shared: &build-shared - ~/.cache/go-build jobs: + # matrix build jobs run on every commit + # building on versioned Go and the latest one + # '<<: *' syntax is a YAML thing for including documents "golang:1.12": <<: *env-shared <<: *build-shared @@ -46,6 +53,7 @@ jobs: <<: *build-shared docker: - image: circleci/golang:latest + # release job run only when a commit is tagged release: <<: *env-shared docker: @@ -79,6 +87,7 @@ workflows: version: 2 build: jobs: + # build matrix - "golang:1.12" - "golang:latest" release: