@@ -41,59 +41,42 @@ jobs:
41
41
42
42
steps :
43
43
- name : " Fetch source code"
44
- uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
44
+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
45
45
46
46
- name : Determine Go version
47
47
id : go
48
48
uses : ./.github/actions/go-version
49
49
50
50
- name : Install Go toolchain
51
- uses : actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
51
+ uses : actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
52
52
with :
53
53
go-version : ${{ steps.go.outputs.version }}
54
-
55
- # NOTE: This cache is shared so the following step must always be
56
- # identical across the unit-tests, e2e-tests, and consistency-checks
57
- # jobs, or else weird things could happen.
58
- - name : Cache Go modules
59
- uses : actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
60
- with :
61
- path : " ~/go/pkg"
62
- key : go-mod-${{ hashFiles('go.sum') }}
63
- restore-keys : |
64
- go-mod-
54
+ cache-dependency-path : go.sum
65
55
66
56
- name : " Unit tests"
67
57
run : |
68
- go test ./...
58
+ # We run tests for all packages from all modules in this repository.
59
+ for dir in $(go list -m -f '{{.Dir}}' github.com/hashicorp/terraform/...); do
60
+ (cd $dir && go test -cover "./...")
61
+ done
69
62
70
63
race-tests :
71
64
name : " Race Tests"
72
65
runs-on : ubuntu-latest
73
66
74
67
steps :
75
68
- name : " Fetch source code"
76
- uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
69
+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
77
70
78
71
- name : Determine Go version
79
72
id : go
80
73
uses : ./.github/actions/go-version
81
74
82
75
- name : Install Go toolchain
83
- uses : actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
76
+ uses : actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
84
77
with :
85
78
go-version : ${{ steps.go.outputs.version }}
86
-
87
- # NOTE: This cache is shared so the following step must always be
88
- # identical across the unit-tests, e2e-tests, and consistency-checks
89
- # jobs, or else weird things could happen.
90
- - name : Cache Go modules
91
- uses : actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
92
- with :
93
- path : " ~/go/pkg"
94
- key : go-mod-${{ hashFiles('go.sum') }}
95
- restore-keys : |
96
- go-mod-
79
+ cache-dependency-path : go.sum
97
80
98
81
# The race detector add significant time to the unit tests, so only run
99
82
# it for select packages.
@@ -111,27 +94,17 @@ jobs:
111
94
112
95
steps :
113
96
- name : " Fetch source code"
114
- uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
97
+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
115
98
116
99
- name : Determine Go version
117
100
id : go
118
101
uses : ./.github/actions/go-version
119
102
120
103
- name : Install Go toolchain
121
- uses : actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
104
+ uses : actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
122
105
with :
123
106
go-version : ${{ steps.go.outputs.version }}
124
-
125
- # NOTE: This cache is shared so the following step must always be
126
- # identical across the unit-tests, e2e-tests, and consistency-checks
127
- # jobs, or else weird things could happen.
128
- - name : Cache Go modules
129
- uses : actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
130
- with :
131
- path : " ~/go/pkg"
132
- key : go-mod-${{ hashFiles('go.sum') }}
133
- restore-keys : |
134
- go-mod-
107
+ cache-dependency-path : go.sum
135
108
136
109
- name : " End-to-end tests"
137
110
run : |
@@ -143,7 +116,7 @@ jobs:
143
116
144
117
steps :
145
118
- name : " Fetch source code"
146
- uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
119
+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
147
120
with :
148
121
fetch-depth : 0 # We need to do comparisons against the main branch.
149
122
@@ -152,31 +125,13 @@ jobs:
152
125
uses : ./.github/actions/go-version
153
126
154
127
- name : Install Go toolchain
155
- uses : actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
128
+ uses : actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
156
129
with :
157
130
go-version : ${{ steps.go.outputs.version }}
158
-
159
- # NOTE: This cache is shared so the following step must always be
160
- # identical across the unit-tests, e2e-tests, and consistency-checks
161
- # jobs, or else weird things could happen.
162
- - name : Cache Go modules
163
- uses : actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
164
- with :
165
- path : " ~/go/pkg"
166
- key : go-mod-${{ hashFiles('go.sum') }}
167
- restore-keys : |
168
- go-mod-
169
-
170
- - name : " go.mod and go.sum consistency check"
171
- run : |
172
- go mod tidy
173
- if [[ -n "$(git status --porcelain)" ]]; then
174
- echo >&2 "ERROR: go.mod/go.sum are not up-to-date. Run 'go mod tidy' and then commit the updated files."
175
- exit 1
176
- fi
131
+ cache-dependency-path : go.sum
177
132
178
133
- name : Cache protobuf tools
179
- uses : actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
134
+ uses : actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
180
135
with :
181
136
path : " tools/protobuf-compile/.workdir"
182
137
key : protobuf-tools-${{ hashFiles('tools/protobuf-compile/protobuf-compile.go') }}
@@ -190,4 +145,4 @@ jobs:
190
145
echo >&2 "ERROR: Generated files are inconsistent. Run 'make generate' and 'make protobuf' locally and then commit the updated files."
191
146
git >&2 status --porcelain
192
147
exit 1
193
- fi
148
+ fi
0 commit comments