blob: c1bd2ba79ad85a011bd784e92291ac4d4e3b5f57 [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: 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
go116_build:
docker:
- image: circleci/golang:1.16
steps:
- checkout
- go_build
go116_test:
docker:
- image: circleci/golang:1.16
parameters:
test_results:
type: string
default: /tmp/test-results
steps:
- checkout
- go_unit_test
# latest stable Go version
go117_build:
docker:
- image: circleci/golang:1.17
steps:
- checkout
- go_build
go117_test:
docker:
- image: circleci/golang:1.17
parameters:
test_results:
type: string
default: /tmp/test-results
steps:
- checkout
- go_unit_test
go117_test_main:
environment:
TFEXEC_E2ETEST_VERSIONS: refs/heads/main
docker:
- image: circleci/golang:1.17
parameters:
test_results:
type: string
default: /tmp/test-results
steps:
- checkout
- go_unit_test
- go_e2e_test
go117_vet:
docker:
- image: circleci/golang:1.17
steps:
- checkout
- run: go vet ./...
go117_fmt:
docker:
- image: circleci/golang:1.17
steps:
- checkout
- run: gofmt -s -l .
go117_release:
docker:
- image: circleci/golang:1.17
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
- go116_build
- go116_test:
requires:
- go116_build
- go117_build
- go117_test:
requires:
- go117_build
- go117_test_main:
requires:
- go117_build
- go117_vet:
requires:
- go117_build
- go117_fmt:
requires:
- go117_build
release:
jobs:
- winbuildtest:
filters:
branches:
only:
- main
- macosbuildtest:
filters:
branches:
only:
- main
- go116_build:
filters:
branches:
only:
- main
- go116_test:
requires:
- go116_build
filters:
branches:
only:
- main
- go117_build:
filters:
branches:
only:
- main
- go117_test:
requires:
- go117_build
filters:
branches:
only:
- main
- go117_test_main:
requires:
- go117_build
filters:
branches:
only:
- main
- go117_vet:
requires:
- go117_build
filters:
branches:
only:
- main
- go117_fmt:
requires:
- go117_build
filters:
branches:
only:
- main
- trigger-release:
filters:
branches:
only:
- main
type: approval
- go117_release:
filters:
branches:
only:
- main
requires:
- trigger-release
- go117_test_main
- go117_vet
- go117_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
- go116_build:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
- go116_test:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
requires:
- go116_build
- go117_build:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
- go117_test:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
requires:
- go117_build
- go117_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:
- go116_build
- go116_test
- go117_build
- winbuildtest
- macosbuildtest