blob: 1e0c08d59631ed16da0f4a46619f4ad644383cb2 [file] [log] [blame]
version: 2.1
orbs:
win: circleci/windows@2.2.0
slack: circleci/slack@4.2.0
commands:
win_install_go:
steps:
- run:
command: choco install golang --version 1.14.6 --yes
- run:
command: go version
macos_install_go:
steps:
- run:
# Ensure we have the latest Homebrew revision
# which downloads from GitHub, not Bintray
command: brew update
- run:
command: brew install golang
- run:
command: go version
go_build:
steps:
- run: go build ./...
go_test:
steps:
- run:
no_output_timeout: 15m
command: go test -timeout=15m -v ./...
jobs:
# combined due to slowness of Go install
macosbuildtest:
macos:
xcode: "12.0.0"
steps:
- macos_install_go
- checkout
- go_build
- go_test
# combined due to slowness of Go install
winbuildtest:
executor:
name: win/default
steps:
- win_install_go
- checkout
- go_build
- go_test
go113_build:
docker:
- image: circleci/golang:1.13
steps:
- checkout
- go_build
go114_build:
docker:
- image: circleci/golang:1.14
steps:
- checkout
- go_build
go114_test:
docker:
- image: circleci/golang:1.14
parameters:
test_results:
type: string
default: /tmp/test-results
steps:
- checkout
- go_test
go115_build:
docker:
- image: circleci/golang:1.15
steps:
- checkout
- go_build
go115_test:
docker:
- image: circleci/golang:1.15
parameters:
test_results:
type: string
default: /tmp/test-results
steps:
- checkout
- go_test
go115_test_main:
environment:
TFEXEC_E2ETEST_VERSIONS: refs/heads/main
docker:
- image: circleci/golang:1.15
parameters:
test_results:
type: string
default: /tmp/test-results
steps:
- checkout
- go_test
go115_vet:
docker:
- image: circleci/golang:1.15
steps:
- checkout
- run: go vet ./...
go115_fmt:
docker:
- image: circleci/golang:1.15
steps:
- checkout
- run: gofmt -s -l .
go115_release:
docker:
- image: circleci/golang:1.15
steps:
- add_ssh_keys:
fingerprints:
- db:cf:97:b8:d6:ac:86:74:96:e1:54:e4:bc:27:2b:d0
- checkout
- run: ./scripts/release/release.sh
workflows:
version: 2
pr:
jobs:
- winbuildtest
- macosbuildtest
# build only for these versions
- go113_build
- go114_build
- go114_test:
requires:
- go114_build
- go115_build
- go115_test:
requires:
- go115_build
- go115_test_main:
requires:
- go115_build
- go115_vet:
requires:
- go115_build
- go115_fmt:
requires:
- go115_build
release:
jobs:
- winbuildtest:
filters:
branches:
only:
- main
- macosbuildtest:
filters:
branches:
only:
- main
# build only for these versions
- go113_build:
filters:
branches:
only:
- main
- go114_build:
filters:
branches:
only:
- main
- go114_test:
requires:
- go114_build
filters:
branches:
only:
- main
- go115_build:
filters:
branches:
only:
- main
- go115_test:
requires:
- go115_build
filters:
branches:
only:
- main
- go115_test_main:
requires:
- go115_build
filters:
branches:
only:
- main
- go115_vet:
requires:
- go115_build
filters:
branches:
only:
- main
- go115_fmt:
requires:
- go115_build
filters:
branches:
only:
- main
- trigger-release:
filters:
branches:
only:
- main
type: approval
- go115_release:
filters:
branches:
only:
- main
requires:
- trigger-release
- go113_build
- go114_test
- go115_test
- go115_test_main
- go115_vet
- go115_fmt
- winbuildtest
- macosbuildtest
nightly:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- main
jobs:
- winbuildtest
- macosbuildtest:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
- go113_build:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
- go114_build:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
- go114_test:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
requires:
- go114_build
- go115_build:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
- go115_test:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
requires:
- go115_build
- go115_test_main:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
- slack/notify:
event: pass
custom: |
{
"blocks": [
{
"type": "section",
"fields": [
{
"type": "plain_text",
"text": ":terraform-da: The nightly test run passed. :terraformda:",
"emoji": true
}
]
}
]
}
requires:
- go115_build
- go115_test
- go114_test
- go113_build
- winbuildtest
- macosbuildtest