blob: 6147861b66182bd952403b50f19df1047b7dc132 [file] [log] [blame]
version: 2.1
orbs:
win: circleci/windows@5.0
slack: circleci/slack@4.2.0
commands:
win_install_go:
steps:
- 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_unit_test:
steps:
- run:
command: go test -race $(go list ./... | grep -v /tfexec/internal/e2etest)
go_e2e_test:
steps:
- run:
no_output_timeout: 30m
command: go test -race -timeout=30m -v ./tfexec/internal/e2etest
jobs:
# combined due to slowness of Go install
macosbuildtest:
macos:
xcode: "13.4.1"
steps:
- macos_install_go
- checkout
- go_build
- go_unit_test
- go_e2e_test
# combined due to slowness of Go install
winbuildtest:
executor:
name: win/default
steps:
- win_install_go
- checkout
- go_build
- go_unit_test
- go_e2e_test
# previous stable Go version
go118_build:
docker:
- image: cimg/go:1.18
steps:
- checkout
- go_build
go118_test:
docker:
- image: cimg/go:1.18
parameters:
test_results:
type: string
default: /tmp/test-results
steps:
- checkout
- go_unit_test
# latest stable Go version
go119_build:
docker:
- image: cimg/go:1.19
steps:
- checkout
- go_build
go119_test:
docker:
- image: cimg/go:1.19
parameters:
test_results:
type: string
default: /tmp/test-results
steps:
- checkout
- go_unit_test
go119_test_main:
environment:
TFEXEC_E2ETEST_VERSIONS: refs/heads/main
docker:
- image: cimg/go:1.19
parameters:
test_results:
type: string
default: /tmp/test-results
steps:
- checkout
- go_unit_test
- go_e2e_test
go119_vet:
docker:
- image: cimg/go:1.19
steps:
- checkout
- run: go vet ./...
go119_fmt:
docker:
- image: cimg/go:1.19
steps:
- checkout
- run: gofmt -s -l .
go119_release:
docker:
- image: cimg/go:1.9
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
- go118_build
- go118_test:
requires:
- go118_build
- go119_build
- go119_test:
requires:
- go119_build
- go119_test_main:
requires:
- go119_build
- go119_vet:
requires:
- go119_build
- go119_fmt:
requires:
- go119_build
release:
jobs:
- winbuildtest:
filters:
branches:
only:
- main
- macosbuildtest:
filters:
branches:
only:
- main
- go118_build:
filters:
branches:
only:
- main
- go118_test:
requires:
- go118_build
filters:
branches:
only:
- main
- go119_build:
filters:
branches:
only:
- main
- go119_test:
requires:
- go119_build
filters:
branches:
only:
- main
- go119_test_main:
requires:
- go119_build
filters:
branches:
only:
- main
- go119_vet:
requires:
- go119_build
filters:
branches:
only:
- main
- go119_fmt:
requires:
- go119_build
filters:
branches:
only:
- main
- trigger-release:
filters:
branches:
only:
- main
type: approval
- go119_release:
filters:
branches:
only:
- main
requires:
- trigger-release
- go119_test_main
- go119_vet
- go119_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
- go118_build:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
- go118_test:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
requires:
- go118_build
- go119_build:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
- go119_test:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
requires:
- go119_build
- go119_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:
- go118_build
- go118_test
- go119_build
- winbuildtest
- macosbuildtest