126 lines (123 loc) · 4.03 KB
/
ci-go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Continuous integration handling for Go
name: ci-go
on:
pull_request:
paths:
- .github/workflows/ci-go.yml
- .golangci.yml
- .go-version
- go.mod
- '**.go'
permissions:
contents: read
jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: go-version
# Reference: https://github.com/actions/setup-go/issues/23
run: echo "::set-output name=version::$(cat ./.go-version)"
- uses: actions/setup-go@v3
with:
go-version: ${{ steps.go-version.outputs.version }}
- run: go mod download
- uses: golangci/golangci-lint-action@v3.2.0
terraform-provider-corner-tfprotov5:
defaults:
run:
working-directory: terraform-provider-corner
name: tfprotov5 (${{ matrix.os}}, Terraform ${{ matrix.terraform}})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
path: terraform-provider-corner
repository: hashicorp/terraform-provider-corner
- id: go-version
# Reference: https://github.com/actions/setup-go/issues/23
run: echo "::set-output name=version::$(cat ./.go-version)"
working-directory: .
- uses: actions/setup-go@v3
with:
go-version: ${{ steps.go-version.outputs.version }}
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- run: go mod edit -replace github.com/hashicorp/terraform-plugin-go=../
- run: go mod tidy
- run: go test -v ./internal/protocolprovider
- run: go test -v ./internal/sdkv2provider
env:
TF_ACC: '1'
- run: go test -v ./internal/tf5muxprovider
- run: go test -v ./internal/tf6to5provider
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
terraform:
- '0.12.*'
- '0.13.*'
- '0.14.*'
- '0.15.*'
- '1.0.*'
- '1.1.*'
terraform-provider-corner-tfprotov6:
defaults:
run:
working-directory: terraform-provider-corner
name: tfprotov6 (${{ matrix.os}}, Terraform ${{ matrix.terraform}})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
path: terraform-provider-corner
repository: hashicorp/terraform-provider-corner
- id: go-version
# Reference: https://github.com/actions/setup-go/issues/23
run: echo "::set-output name=version::$(cat ./.go-version)"
working-directory: .
- uses: actions/setup-go@v3
with:
go-version: ${{ steps.go-version.outputs.version }}
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- run: go mod edit -replace github.com/hashicorp/terraform-plugin-go=../
- run: go mod tidy
- run: go test -v ./internal/frameworkprovider
- run: go test -v ./internal/protocolv6provider
- # Terraform CLI 1.1.5+ is required for upgrading sdk/v2
if: matrix.terraform != '1.0.*'
run: go test -v ./internal/tf5to6provider
- run: go test -v ./internal/tf6muxprovider
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
terraform:
- '1.0.*'
- '1.1.*'
test:
name: test (Go v${{ matrix.go-version }})
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.18', '1.17' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- run: go mod download
- run: go test -coverprofile=coverage.out ./...
- run: go tool cover -html=coverage.out -o coverage.html
- uses: actions/upload-artifact@v3
with:
name: go-${{ matrix.go-version }}-coverage
path: coverage.html