updated circleci config

This commit is contained in:
christophe-duc 2026-01-08 19:00:24 -04:00
parent 2fd2fb8211
commit 6a4897f299

View file

@ -1,10 +1,9 @@
version: 2 version: 2
# global environment variables # global environment variables
# '& ' syntax is a YAML thing for creating referenceable documents
env-shared: &env-shared env-shared: &env-shared
environment: environment:
GOFLAGS: "-mod=vendor" GOFLAGS: ""
# build steps shared across different jobs # build steps shared across different jobs
build-shared: &build-shared build-shared: &build-shared
@ -13,51 +12,49 @@ build-shared: &build-shared
- run: - run:
name: Run gofmt -s name: Run gofmt -s
command: | command: |
if [ $(find . ! -path "./vendor/*" -name "*.go" -exec gofmt -s -d {} \;|wc -l) -gt 0 ]; then if [ $(find . -name "*.go" -exec gofmt -s -d {} \;|wc -l) -gt 0 ]; then
find . ! -path "./vendor/*" -name "*.go" -exec gofmt -s -d {} \; find . -name "*.go" -exec gofmt -s -d {} \;
exit 1; exit 1;
fi fi
- restore_cache: - restore_cache:
keys: keys:
- pkg-cache-{{ checksum "go.sum" }}-v5 - pkg-cache-{{ checksum "go.sum" }}-v6
- run:
name: Download dependencies
command: go mod download
- run: - run:
name: Run tests name: Run tests
command: | command: |
go test -v ./... go test -v ./...
- run: - run:
name: Get gox name: Get gox
# -mod=vendor doesn't work with go get while in source tree with go.mod in it
working_directory: "/tmp"
command: | command: |
go get github.com/mitchellh/gox go install github.com/mitchellh/gox@latest
- run: - run:
name: Compile project on every platform name: Compile project on every platform
command: | command: |
gox -parallel 10 -os "linux freebsd" -osarch "darwin/i386 darwin/amd64 windows/i386 windows/amd64" gox -parallel 10 -os "linux freebsd" -osarch "darwin/amd64 darwin/arm64 windows/amd64"
- save_cache: - save_cache:
key: pkg-cache-{{ checksum "go.sum" }}-v5 key: pkg-cache-{{ checksum "go.sum" }}-v6
paths: paths:
- ~/.cache/go-build - ~/.cache/go-build
- /go/pkg/mod
jobs: jobs:
# matrix build jobs run on every commit "golang:1.21":
# building on versioned Go and the latest one
# '<<: *' syntax is a YAML thing for including documents
"golang:1.17":
<<: *env-shared <<: *env-shared
<<: *build-shared <<: *build-shared
docker: docker:
- image: circleci/golang:1.17 - image: cimg/go:1.21
"golang:latest": "golang:latest":
<<: *env-shared <<: *env-shared
<<: *build-shared <<: *build-shared
docker: docker:
- image: circleci/golang:latest - image: cimg/go:1.23
# release job run only when a commit is tagged
release: release:
<<: *env-shared <<: *env-shared
docker: docker:
- image: circleci/golang:1.17 - image: cimg/go:1.21
steps: steps:
- checkout - checkout
- run: - run:
@ -73,8 +70,7 @@ workflows:
version: 2 version: 2
build: build:
jobs: jobs:
# build matrix - "golang:1.21"
- "golang:1.17"
- "golang:latest" - "golang:latest"
release: release:
jobs: jobs: