Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Build and test last two stable Go versions (1.16 and 1.17) #216

Merged
merged 5 commits into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 59 additions & 93 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,16 @@ jobs:
- go_unit_test
- go_e2e_test

go113_build:
docker:
- image: circleci/golang:1.13
steps:
- checkout
- go_build

go114_build:
# previous stable Go version
go116_build:
docker:
- image: circleci/golang:1.14
- image: circleci/golang:1.16
steps:
- checkout
- go_build
go114_test:
go116_test:
docker:
- image: circleci/golang:1.14
- image: circleci/golang:1.16
parameters:
test_results:
type: string
Expand All @@ -83,27 +77,28 @@ jobs:
- checkout
- go_unit_test

go115_build:
# latest stable Go version
go117_build:
docker:
- image: circleci/golang:1.15
- image: circleci/golang:1.17
steps:
- checkout
- go_build
go115_test:
go117_test:
docker:
- image: circleci/golang:1.15
- image: circleci/golang:1.17
parameters:
test_results:
type: string
default: /tmp/test-results
steps:
- checkout
- go_unit_test
go116_test_main:
go117_test_main:
environment:
TFEXEC_E2ETEST_VERSIONS: refs/heads/main
docker:
- image: circleci/golang:1.16
- image: circleci/golang:1.17
parameters:
test_results:
type: string
Expand All @@ -112,61 +107,52 @@ jobs:
- checkout
- go_unit_test
- go_e2e_test
go115_vet:
go117_vet:
docker:
- image: circleci/golang:1.15
- image: circleci/golang:1.17
steps:
- checkout
- run: go vet ./...
go115_fmt:
go117_fmt:
docker:
- image: circleci/golang:1.15
- image: circleci/golang:1.17
steps:
- checkout
- run: gofmt -s -l .
go115_release:
go117_release:
docker:
- image: circleci/golang:1.15
- 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
go116_build:
docker:
- image: circleci/golang:1.16
steps:
- checkout
- go_build

workflows:
version: 2
pr:
jobs:
- winbuildtest
- macosbuildtest

# build only for these versions
- go113_build

- go114_build
- go114_test:
- go116_build
- go116_test:
requires:
- go114_build

- go115_build
- go115_test:
- go116_build
- go117_build
- go117_test:
requires:
- go115_build
- go116_test_main:
- go117_build
- go117_test_main:
requires:
- go115_build
- go115_vet:
- go117_build
- go117_vet:
requires:
- go115_build
- go115_fmt:
- go117_build
- go117_fmt:
requires:
- go115_build
- go117_build
release:
jobs:
- winbuildtest:
Expand All @@ -179,85 +165,71 @@ workflows:
branches:
only:
- main

# build only for these versions
- go113_build:
filters:
branches:
only:
- main

- go114_build:
- go116_build:
filters:
branches:
only:
- main
- go114_test:
- go116_test:
requires:
- go114_build
- go116_build
filters:
branches:
only:
- main

- go115_build:
- go117_build:
filters:
branches:
only:
- main
- go115_test:
- go117_test:
requires:
- go115_build
- go117_build
filters:
branches:
only:
- main
- go116_test_main:

- go117_test_main:
requires:
- go116_build
- go117_build
filters:
branches:
only:
- main
- go115_vet:
- go117_vet:
requires:
- go115_build
- go117_build
filters:
branches:
only:
- main
- go115_fmt:
- go117_fmt:
requires:
- go115_build
filters:
branches:
only:
- main
- go116_build:
- go117_build
filters:
branches:
only:
- main

- trigger-release:
filters:
branches:
only:
- main
type: approval

- go115_release:
- go117_release:
filters:
branches:
only:
- main
requires:
- trigger-release
- go113_build
- go114_test
- go115_test
- go116_test_main
- go115_vet
- go115_fmt
- go117_test_main
- go117_vet
- go117_fmt
- winbuildtest
- macosbuildtest
nightly:
Expand All @@ -275,36 +247,31 @@ workflows:
- slack/notify:
event: fail
template: basic_fail_1
- go113_build:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
- go114_build:
- go116_build:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
- go114_test:
- go116_test:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
requires:
- go114_build
- go115_build:
- go116_build
- go117_build:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
- go115_test:
- go117_test:
post-steps:
- slack/notify:
event: fail
template: basic_fail_1
requires:
- go115_build
- go116_test_main:
- go117_build
- go117_test_main:
post-steps:
- slack/notify:
event: fail
Expand All @@ -327,9 +294,8 @@ workflows:
]
}
requires:
- go115_build
- go115_test
- go114_test
- go113_build
- go116_build
- go116_test
- go117_build
- winbuildtest
- macosbuildtest
2 changes: 1 addition & 1 deletion tfexec/add_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func TestAddCmd(t *testing.T) {
td := testTempDir(t)
td := t.TempDir()

tf, err := NewTerraform(td, tfVersion(t, testutil.Latest_v1_1))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion tfexec/apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func TestApplyCmd(t *testing.T) {
td := testTempDir(t)
td := t.TempDir()

tf, err := NewTerraform(td, tfVersion(t, testutil.Latest_v1))
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions tfexec/cmdstring.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
// +build go1.13

package tfexec

import (
"os/exec"
)

// cmdString handles go 1.12 as stringer was only added to exec.Cmd in 1.13
kmoe marked this conversation as resolved.
Show resolved Hide resolved
func cmdString(c *exec.Cmd) string {
return c.String()
}
19 changes: 0 additions & 19 deletions tfexec/cmdstring_go112.go

This file was deleted.

2 changes: 1 addition & 1 deletion tfexec/destroy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func TestDestroyCmd(t *testing.T) {
td := testTempDir(t)
td := t.TempDir()

tf, err := NewTerraform(td, tfVersion(t, testutil.Latest012))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion tfexec/fmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func TestFormat(t *testing.T) {
td := testTempDir(t)
td := t.TempDir()

tf, err := NewTerraform(td, tfVersion(t, "0.7.6"))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion tfexec/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func TestGetCmd(t *testing.T) {
td := testTempDir(t)
td := t.TempDir()

tf, err := NewTerraform(td, tfVersion(t, testutil.Latest012))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion tfexec/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func TestImportCmd(t *testing.T) {
td := testTempDir(t)
td := t.TempDir()

tf, err := NewTerraform(td, tfVersion(t, testutil.Latest012))
if err != nil {
Expand Down
Loading