Skip to content

Commit

Permalink
website: Update GitHub Actions example for setup-go@v4 and using go.m…
Browse files Browse the repository at this point in the history
…od version (#169)

Reference: https://github.com/actions/setup-go#getting-go-version-from-the-gomod-file

This prevents developers from needing to continually update their testing workflow with Go upgrades, which can be pointed at the minimum Go version as defined by their Go module.
  • Loading branch information
bflad authored Aug 28, 2023
1 parent 18deced commit d6717ae
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions website/docs/plugin/testing/acceptance-tests/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Create a [GitHub Actions workflow](https://docs.github.com/en/actions/using-work

Use the [`matrix`](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix) strategy for more advanced configuration, such as running acceptance testing against multiple Terraform CLI versions.

The following example workflow runs acceptance testing for the provider using the latest patch versions of Go 1.19 and Terraform CLI 1.3:
The following example workflow runs acceptance testing for the provider using the latest patch versions of the Go version in the `go.mod` file and Terraform CLI 1.5:

```yaml
name: Terraform Provider Tests
Expand All @@ -157,12 +157,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: '1.19'
go-version-file: 'go.mod'
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: '1.3.*'
terraform_version: '1.5.*'
terraform_wrapper: false
- run: go test -v -cover ./...
env:
Expand All @@ -172,14 +172,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: '1.19'
go-version-file: 'go.mod'
- run: go test -v -cover ./...
```
The following example workflow runs acceptance testing for the provider using the latest patch versions of Go 1.19 and Terraform CLI 0.12 through 1.3:
The following example workflow runs acceptance testing for the provider using the latest patch versions of Go version in the `go.mod` file and Terraform CLI 0.12 through 1.5:

```yaml
name: Terraform Provider Tests
Expand Down Expand Up @@ -210,11 +210,13 @@ jobs:
- '1.1.*'
- '1.2.*'
- '1.3.*'
- '1.4.*'
- '1.5.*'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: '1.19'
go-version-file: 'go.mod'
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ matrix.terraform-version }}
Expand All @@ -227,9 +229,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: '1.19'
go-version-file: 'go.mod'
- run: go test -v -cover ./...
```

Expand Down

0 comments on commit d6717ae

Please sign in to comment.