packer-cn/.circleci/config.yml

92 lines
2.3 KiB
YAML

defaults: &golang
docker:
- image: circleci/golang:1.12
working_directory: /go/src/github.com/hashicorp/packer
steps:
- checkout
- run: go build -o pkg/packer .
# Golang CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2
jobs:
build:
<<: *golang
steps:
- checkout
- run: make ci
check-vendor-vs-mod:
<<: *golang
steps:
- checkout
- run: GO111MODULE=on go run . --help
- run: make check-vendor-vs-mod
build_linux:
<<: *golang
environment:
GOOS: linux
build_windows:
<<: *golang
environment:
GOOS: windows
build_darwin:
<<: *golang
environment:
GOOS: darwin
build_freebsd:
<<: *golang
environment:
GOOS: freebsd
build_solaris:
<<: *golang
environment:
GOOS: solaris
build_openbsd:
<<: *golang
environment:
GOOS: openbsd
save_windows_binary:
<<: *golang
steps:
- checkout
- run: go get github.com/mitchellh/gox
- run: PATH=$PATH:$GOPATH/bin XC_ARCH=amd64 XC_OS="windows" GOLDFLAGS="-s -w" ./scripts/build.sh
- run: zip ./pkg/packer_windows.zip ./pkg/windows_amd64/packer.exe
- store_artifacts:
path: ./pkg/packer_windows.zip
save_linux_binary:
<<: *golang
steps:
- checkout
- run: go get github.com/mitchellh/gox
- run: PATH=$PATH:$GOPATH/bin XC_ARCH=amd64 XC_OS="linux" GOLDFLAGS="-s -w" ./scripts/build.sh
- run: zip ./pkg/packer_linux.zip ./pkg/linux_amd64/packer
- store_artifacts:
path: ./pkg/packer_linux.zip
save_darwin_binary:
<<: *golang
steps:
- checkout
- run: go get github.com/mitchellh/gox
- run: PATH=$PATH:$GOPATH/bin XC_ARCH=amd64 XC_OS="darwin" GOLDFLAGS="-s -w" ./scripts/build.sh
- run: zip ./pkg/packer_darwin.zip ./pkg/darwin_amd64/packer
- store_artifacts:
path: ./pkg/packer_darwin.zip
workflows:
version: 2
build_and_check_vendor_vs_module:
jobs:
- build
- check-vendor-vs-mod
- build_linux
- build_darwin
- build_windows
- build_freebsd
- build_openbsd
- build_solaris
- save_darwin_binary
- save_linux_binary
- save_windows_binary