version: 2 templates: golang-template: &golang-template docker: - image: ghcr.io/hugelgupf/vmtest/ci-amd64:main working_directory: /home/circleci/go/src/github.com/hugelgupf/p9 environment: - CGO_ENABLED: 0 workflows: version: 2 build: jobs: - tidy - build: requires: - tidy - test: requires: - tidy jobs: tidy: <<: *golang-template steps: - checkout - run: go env - run: go vet ./... - run: name: go mod tidy command: | go mod tidy go mod verify git status if [[ -n "$(git status --porcelain .)" ]]; then echo 'go.mod/go.sum is out-of-date: run `go mod tidy` in the right module directories (see git status) and then check in the changes' echo 'If `go mod tidy` results in no changes, make sure you are using the latest relase of Go' git status --porcelain . exit 1 fi - run: name: gofmt command: test -z "$(gofmt -s -l $(find -name '*.go'))" test: <<: *golang-template steps: - checkout - run: go env - run: go test -timeout 15m -v ./... - run: CGO_ENABLED=1 go test -race -timeout 15m -v ./... build: <<: *golang-template steps: - checkout - run: go env - run: | go install github.com/mitchellh/gox@latest # Exclude darwin/arm(64?). gox -osarch="darwin/amd64" ./... gox -parallel=2 -os="windows linux freebsd netbsd openbsd solaris" -arch="386 amd64 arm arm64 ppc64 ppc64le s390x mips mipsle mips64 mips64le" ./...