Skip to content

Commit 84d5f62

Browse files
authored
Update .github/workflows/checks.yml on v1.8 to roughly match main branch (#36736)
* Make .github/workflows/checks.yml align with main@2d6eda28776ff34ed64ebfc176d9feb401a82b79 * Add vetcheck target to Makefile Ideally this commit would make the file align with main@2d6eda28776ff34ed64ebfc176d9feb401a82b79, but that would have meant including the new syncdeps target. This would require adding the syncdeps.sh script to the repo. * Remove sync deps from Makefile * Remove use of syncdeps
1 parent f0154ab commit 84d5f62

File tree

1 file changed

+18
-63
lines changed

1 file changed

+18
-63
lines changed

.github/workflows/checks.yml

+18-63
Original file line numberDiff line numberDiff line change
@@ -41,59 +41,42 @@ jobs:
4141

4242
steps:
4343
- name: "Fetch source code"
44-
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
44+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4545

4646
- name: Determine Go version
4747
id: go
4848
uses: ./.github/actions/go-version
4949

5050
- name: Install Go toolchain
51-
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
51+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
5252
with:
5353
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
6555

6656
- name: "Unit tests"
6757
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
6962
7063
race-tests:
7164
name: "Race Tests"
7265
runs-on: ubuntu-latest
7366

7467
steps:
7568
- name: "Fetch source code"
76-
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
69+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
7770

7871
- name: Determine Go version
7972
id: go
8073
uses: ./.github/actions/go-version
8174

8275
- name: Install Go toolchain
83-
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
76+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
8477
with:
8578
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
9780

9881
# The race detector add significant time to the unit tests, so only run
9982
# it for select packages.
@@ -111,27 +94,17 @@ jobs:
11194

11295
steps:
11396
- name: "Fetch source code"
114-
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
97+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
11598

11699
- name: Determine Go version
117100
id: go
118101
uses: ./.github/actions/go-version
119102

120103
- name: Install Go toolchain
121-
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
104+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
122105
with:
123106
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
135108

136109
- name: "End-to-end tests"
137110
run: |
@@ -143,7 +116,7 @@ jobs:
143116

144117
steps:
145118
- name: "Fetch source code"
146-
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
119+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
147120
with:
148121
fetch-depth: 0 # We need to do comparisons against the main branch.
149122

@@ -152,31 +125,13 @@ jobs:
152125
uses: ./.github/actions/go-version
153126

154127
- name: Install Go toolchain
155-
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
128+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
156129
with:
157130
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
177132

178133
- name: Cache protobuf tools
179-
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
134+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
180135
with:
181136
path: "tools/protobuf-compile/.workdir"
182137
key: protobuf-tools-${{ hashFiles('tools/protobuf-compile/protobuf-compile.go') }}
@@ -190,4 +145,4 @@ jobs:
190145
echo >&2 "ERROR: Generated files are inconsistent. Run 'make generate' and 'make protobuf' locally and then commit the updated files."
191146
git >&2 status --porcelain
192147
exit 1
193-
fi
148+
fi

0 commit comments

Comments
 (0)