update circle-ci to run tests on darwin & windows
This commit is contained in:
parent
a5b899770e
commit
368d39cadf
|
@ -1,68 +1,131 @@
|
||||||
defaults: &golang
|
orbs:
|
||||||
docker:
|
win: circleci/windows@1.0.0
|
||||||
- image: circleci/golang:1.12
|
version: 2.1
|
||||||
working_directory: /go/src/github.com/hashicorp/packer
|
|
||||||
steps:
|
executors:
|
||||||
- checkout
|
golang:
|
||||||
- run: go build -ldflags="-s -w" -o ./pkg/packer_$(go env GOOS)_$(go env GOARCH) .
|
docker:
|
||||||
- run: zip ./pkg/packer_$(go env GOOS)_$(go env GOARCH).zip ./pkg/packer_$(go env GOOS)_$(go env GOARCH)
|
- image: circleci/golang:1.12
|
||||||
- run: rm ./pkg/packer_$(go env GOOS)_$(go env GOARCH)
|
darwin:
|
||||||
- persist_to_workspace:
|
macos:
|
||||||
root: .
|
xcode: "9.0"
|
||||||
paths:
|
|
||||||
- ./pkg/
|
commands:
|
||||||
|
install-go-run-tests-unix:
|
||||||
|
parameters:
|
||||||
|
GOOS:
|
||||||
|
type: string
|
||||||
|
GOVERSION:
|
||||||
|
type: string
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: curl https://dl.google.com/go/go<< parameters.GOVERSION >>.<< parameters.GOOS >>-amd64.tar.gz | tar -C ~/ -xz
|
||||||
|
- run: ~/go/bin/go test ./...
|
||||||
|
install-go-run-tests-windows:
|
||||||
|
parameters:
|
||||||
|
GOVERSION:
|
||||||
|
type: string
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: curl https://dl.google.com/go/go<< parameters.GOVERSION >>.windows-amd64.zip --output ~/go<< parameters.GOVERSION >>.windows-amd64.zip
|
||||||
|
- run: unzip ~/go<< parameters.GOVERSION >>.windows-amd64.zip -d ~/
|
||||||
|
- run: ~/go/bin/go test ./...
|
||||||
|
build-and-persist-packer-binary:
|
||||||
|
parameters:
|
||||||
|
GOOS:
|
||||||
|
type: string
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: GOOS=<< parameters.GOOS >> go build -ldflags="-s -w" -o ./pkg/packer_<< parameters.GOOS >>_$(go env GOARCH) .
|
||||||
|
- run: zip ./pkg/packer_<< parameters.GOOS >>_$(go env GOARCH).zip ./pkg/packer_<< parameters.GOOS >>_$(go env GOARCH)
|
||||||
|
- run: rm ./pkg/packer_<< parameters.GOOS >>_$(go env GOARCH)
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: .
|
||||||
|
paths:
|
||||||
|
- ./pkg/
|
||||||
# Golang CircleCI 2.0 configuration file
|
# Golang CircleCI 2.0 configuration file
|
||||||
#
|
#
|
||||||
# Check https://circleci.com/docs/2.0/language-go/ for more details
|
# Check https://circleci.com/docs/2.0/language-go/ for more details
|
||||||
version: 2
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
test-linux:
|
||||||
<<: *golang
|
executor: golang
|
||||||
|
working_directory: /go/src/github.com/hashicorp/packer
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run: make ci
|
- run: make ci
|
||||||
|
test-darwin:
|
||||||
|
executor: darwin
|
||||||
|
working_directory: ~/go/src/github.com/hashicorp/packer
|
||||||
|
environment:
|
||||||
|
GO111MODULE: "off"
|
||||||
|
steps:
|
||||||
|
- install-go-run-tests-unix:
|
||||||
|
GOOS: darwin
|
||||||
|
GOVERSION: "1.13"
|
||||||
|
test-windows:
|
||||||
|
executor:
|
||||||
|
name: win/vs2019
|
||||||
|
shell: bash.exe
|
||||||
|
steps:
|
||||||
|
- install-go-run-tests-windows:
|
||||||
|
GOVERSION: "1.13"
|
||||||
check-vendor-vs-mod:
|
check-vendor-vs-mod:
|
||||||
<<: *golang
|
executor: golang
|
||||||
|
working_directory: /go/src/github.com/hashicorp/packer
|
||||||
|
environment:
|
||||||
|
GO111MODULE: "off"
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run: GO111MODULE=on go run . --help
|
- run: GO111MODULE=on go run . --help
|
||||||
- run: make check-vendor-vs-mod
|
- run: make check-vendor-vs-mod
|
||||||
check-fmt:
|
check-fmt:
|
||||||
<<: *golang
|
executor: golang
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run: make fmt-check
|
- run: make fmt-check
|
||||||
check-generate:
|
check-generate:
|
||||||
<<: *golang
|
executor: golang
|
||||||
|
working_directory: /go/src/github.com/hashicorp/packer
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run: make generate-check
|
- run: make generate-check
|
||||||
build_linux:
|
build_linux:
|
||||||
<<: *golang
|
executor: golang
|
||||||
environment:
|
steps:
|
||||||
GOOS: linux
|
- build-and-persist-packer-binary:
|
||||||
|
GOOS: linux
|
||||||
build_windows:
|
build_windows:
|
||||||
<<: *golang
|
executor: golang
|
||||||
environment:
|
working_directory: /go/src/github.com/hashicorp/packer
|
||||||
GOOS: windows
|
steps:
|
||||||
|
- build-and-persist-packer-binary:
|
||||||
|
GOOS: windows
|
||||||
build_darwin:
|
build_darwin:
|
||||||
<<: *golang
|
executor: golang
|
||||||
environment:
|
working_directory: /go/src/github.com/hashicorp/packer
|
||||||
GOOS: darwin
|
steps:
|
||||||
|
- build-and-persist-packer-binary:
|
||||||
|
GOOS: darwin
|
||||||
build_freebsd:
|
build_freebsd:
|
||||||
<<: *golang
|
executor: golang
|
||||||
environment:
|
working_directory: /go/src/github.com/hashicorp/packer
|
||||||
GOOS: freebsd
|
steps:
|
||||||
|
- build-and-persist-packer-binary:
|
||||||
|
GOOS: freebsd
|
||||||
build_solaris:
|
build_solaris:
|
||||||
<<: *golang
|
executor: golang
|
||||||
environment:
|
working_directory: /go/src/github.com/hashicorp/packer
|
||||||
GOOS: solaris
|
steps:
|
||||||
|
- build-and-persist-packer-binary:
|
||||||
|
GOOS: solaris
|
||||||
build_openbsd:
|
build_openbsd:
|
||||||
<<: *golang
|
executor: golang
|
||||||
environment:
|
working_directory: /go/src/github.com/hashicorp/packer
|
||||||
GOOS: openbsd
|
steps:
|
||||||
|
- build-and-persist-packer-binary:
|
||||||
|
GOOS: openbsd
|
||||||
store_artifacts:
|
store_artifacts:
|
||||||
<<: *golang
|
executor: golang
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
at: .
|
at: .
|
||||||
|
@ -80,12 +143,18 @@ jobs:
|
||||||
ghr -prerelease -t ${GITHUB_TOKEN_AZR} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${CIRCLE_TAG} ./pkg/
|
ghr -prerelease -t ${GITHUB_TOKEN_AZR} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${CIRCLE_TAG} ./pkg/
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
build_and_check_vendor_vs_module:
|
test:
|
||||||
|
jobs:
|
||||||
|
- test-linux
|
||||||
|
- test-darwin
|
||||||
|
- test-windows
|
||||||
|
check-code:
|
||||||
jobs:
|
jobs:
|
||||||
- build
|
|
||||||
- check-vendor-vs-mod
|
- check-vendor-vs-mod
|
||||||
- check-fmt
|
- check-fmt
|
||||||
- check-generate
|
- check-generate
|
||||||
|
build_packer_binaries:
|
||||||
|
jobs:
|
||||||
- build_linux:
|
- build_linux:
|
||||||
filters:
|
filters:
|
||||||
tags:
|
tags:
|
||||||
|
|
Loading…
Reference in New Issue