packer-cn/.circleci/config.yml

134 lines
3.1 KiB
YAML

defaults: &golang
docker:
- image: circleci/golang:1.12
working_directory: /go/src/github.com/hashicorp/packer
steps:
- checkout
- run: go build -ldflags="-s -w" -o ./pkg/packer_$(go env GOOS)_$(go env GOARCH) .
- run: zip ./pkg/packer_$(go env GOOS)_$(go env GOARCH).zip ./pkg/packer_$(go env GOOS)_$(go env GOARCH)
- run: rm ./pkg/packer_$(go env GOOS)_$(go env GOARCH)
- persist_to_workspace:
root: .
paths:
- ./pkg/
# 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
check-fmt:
<<: *golang
steps:
- checkout
- run: make fmt-check
check-generate:
<<: *golang
steps:
- checkout
- run: make generate-check
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
store_artifacts:
<<: *golang
steps:
- attach_workspace:
at: .
- store_artifacts:
path: ./pkg/
destination: /
publish-github-tag-release:
docker:
- image: cibuilds/github:0.10
working_directory: /go/src/github.com/hashicorp/packer
steps:
- attach_workspace:
at: .
- run: |
ghr -prerelease -t ${GITHUB_TOKEN_AZR} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${CIRCLE_TAG} ./pkg/
workflows:
version: 2
build_and_check_vendor_vs_module:
jobs:
- build
- check-vendor-vs-mod
- check-fmt
- check-generate
- build_linux:
filters:
tags:
only: /.*/
- build_darwin:
filters:
tags:
only: /.*/
- build_windows:
filters:
tags:
only: /.*/
- build_freebsd:
filters:
tags:
only: /.*/
- build_openbsd:
filters:
tags:
only: /.*/
- build_solaris:
filters:
tags:
only: /.*/
- store_artifacts:
requires:
- build_linux
- build_darwin
- build_windows
- build_freebsd
- build_openbsd
- build_solaris
- publish-github-tag-release:
requires:
- build_linux
- build_darwin
- build_windows
- build_freebsd
- build_openbsd
- build_solaris
filters:
branches:
ignore: /.*/
tags:
only: nightly