Skip to content

Commit 1833b8e

Browse files
committed
Manage versioning of Task tool dependency
The "Task" task runner tool is used to perform all common development and maintenance operations for the project. Previously, the version of Task was not well managed. The GitHub Actions workflows used the latest version of Task, only constrained by major version. This meant that the GitHub Actions workflows could break at any time through a new release of Task that contained regressions or breaking changes. The contributors used whichever version of Task happened to be installed on their machine. This meant that they might get different results from that produced by the environment of the GitHub Actions workflows. The better solution is to take the same approach for managing the Task dependency as is done for the project's other dependencies: * Install a specific version of Task according to a single source of versioning data. * Use the Dependabot service to get automated update pull requests. Since Task is a Go module-based project, this can be accomplished by using the Go modules system, which has explicit support for tool dependencies as of the Go 1.24 release.
1 parent dfcca84 commit 1833b8e

File tree

84 files changed

+1207
-632
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1207
-632
lines changed

.github/workflows/check-ci-sync.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ on:
1111
push:
1212
paths:
1313
- ".github/workflows/*.ya?ml"
14+
- "go.mod"
15+
- "go.sum"
1416
- "Taskfile.ya?ml"
1517
- "workflow-templates/*.ya?ml"
1618
pull_request:
1719
paths:
1820
- ".github/workflows/*.ya?ml"
21+
- "go.mod"
22+
- "go.sum"
1923
- "Taskfile.ya?ml"
2024
- "workflow-templates/*.ya?ml"
2125
schedule:
@@ -33,17 +37,17 @@ jobs:
3337
- name: Checkout repository
3438
uses: actions/checkout@v5
3539

36-
- name: Install Task
37-
uses: arduino/setup-task@v2
40+
- name: Install Go
41+
uses: actions/setup-go@v5
3842
with:
39-
repo-token: ${{ secrets.GITHUB_TOKEN }}
40-
version: 3.x
43+
go-version-file: go.mod
4144

4245
- name: Sync files
4346
run: |
44-
task \
45-
--silent \
46-
ci:sync
47+
go tool \
48+
github.com/go-task/task/v3/cmd/task \
49+
--silent \
50+
ci:sync
4751
4852
- name: Check file duplicates sync
4953
run: |

.github/workflows/check-clang-format.yml

Lines changed: 52 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
- "other/clang-format-configuration/testdata/**"
1010
- "other/clang-format-configuration/.clang-format"
1111
- ".npmrc"
12+
- "go.mod"
13+
- "go.sum"
1214
- "package.json"
1315
- "package-lock.json"
1416
- "Taskfile.ya?ml"
@@ -19,6 +21,8 @@ on:
1921
- "other/clang-format-configuration/testdata/**"
2022
- "other/clang-format-configuration/.clang-format"
2123
- ".npmrc"
24+
- "go.mod"
25+
- "go.sum"
2226
- "package.json"
2327
- "package-lock.json"
2428
- "Taskfile.ya?ml"
@@ -43,22 +47,22 @@ jobs:
4347
- name: Checkout repository
4448
uses: actions/checkout@v5
4549

50+
- name: Install Go
51+
uses: actions/setup-go@v5
52+
with:
53+
go-version-file: go.mod
54+
4655
- name: Setup Node.js
4756
uses: actions/setup-node@v4
4857
with:
4958
node-version-file: package.json
5059

51-
- name: Install Task
52-
uses: arduino/setup-task@v2
53-
with:
54-
repo-token: ${{ secrets.GITHUB_TOKEN }}
55-
version: 3.x
56-
5760
- name: Validate ClangFormat configuration files
5861
run: |
59-
task \
60-
--silent \
61-
clang-format:validate
62+
go tool \
63+
github.com/go-task/task/v3/cmd/task \
64+
--silent \
65+
clang-format:validate
6266
6367
check-config:
6468
runs-on: ubuntu-latest
@@ -68,17 +72,19 @@ jobs:
6872
- name: Checkout repository
6973
uses: actions/checkout@v5
7074

71-
- name: Install Task
72-
uses: arduino/setup-task@v2
75+
- name: Install Go
76+
uses: actions/setup-go@v5
7377
with:
74-
repo-token: ${{ secrets.GITHUB_TOKEN }}
75-
version: 3.x
78+
go-version-file: go.mod
7679

7780
- name: Set environment variables
7881
run: |
7982
# See: https://docs.github.com/actions/reference/workflows-and-actions/workflow-commands#setting-an-environment-variable
8083
if [[ "${{ github.event.inputs.clang-format-version }}" == "" ]]; then
81-
echo "CLANG_FORMAT_VERSION=$(task clang-format:get-version)" >>"$GITHUB_ENV"
84+
echo "CLANG_FORMAT_VERSION=$(
85+
go tool \
86+
github.com/go-task/task/v3/cmd/task clang-format:get-version
87+
)" >>"$GITHUB_ENV"
8288
else
8389
echo "CLANG_FORMAT_VERSION=${{ github.event.inputs.clang-format-version }}" >>"$GITHUB_ENV"
8490
fi
@@ -110,10 +116,11 @@ jobs:
110116
- name: Check ClangFormat configuration file
111117
id: check
112118
run: |
113-
task \
114-
--silent \
115-
clang-format:check-config \
116-
CLANG_FORMAT_VERSION="${{ env.CLANG_FORMAT_VERSION }}"
119+
go tool \
120+
github.com/go-task/task/v3/cmd/task \
121+
--silent \
122+
clang-format:check-config \
123+
CLANG_FORMAT_VERSION="${{ env.CLANG_FORMAT_VERSION }}"
117124
118125
- name: Save effective configuration file to a workflow artifact
119126
if: >
@@ -133,17 +140,19 @@ jobs:
133140
- name: Checkout repository
134141
uses: actions/checkout@v5
135142

136-
- name: Install Task
137-
uses: arduino/setup-task@v2
143+
- name: Install Go
144+
uses: actions/setup-go@v5
138145
with:
139-
repo-token: ${{ secrets.GITHUB_TOKEN }}
140-
version: 3.x
146+
go-version-file: go.mod
141147

142148
- name: Set environment variables
143149
run: |
144150
# See: https://docs.github.com/actions/reference/workflows-and-actions/workflow-commands#setting-an-environment-variable
145151
if [[ "${{ github.event.inputs.clang-format-version }}" == "" ]]; then
146-
echo "CLANG_FORMAT_VERSION=$(task clang-format:get-version)" >>"$GITHUB_ENV"
152+
echo "CLANG_FORMAT_VERSION=$(
153+
go tool \
154+
github.com/go-task/task/v3/cmd/task clang-format:get-version
155+
)" >>"$GITHUB_ENV"
147156
else
148157
echo "CLANG_FORMAT_VERSION=${{ github.event.inputs.clang-format-version }}" >>"$GITHUB_ENV"
149158
fi
@@ -175,10 +184,11 @@ jobs:
175184
- name: Check ClangFormat output
176185
id: check
177186
run: |
178-
task \
179-
clang-format:check-output \
180-
CLANG_FORMAT_VERSION="${{ env.CLANG_FORMAT_VERSION }}" \
181-
WORKING_FOLDER="${{ env.WORKING_FOLDER }}"
187+
go tool \
188+
github.com/go-task/task/v3/cmd/task \
189+
clang-format:check-output \
190+
CLANG_FORMAT_VERSION="${{ env.CLANG_FORMAT_VERSION }}" \
191+
WORKING_FOLDER="${{ env.WORKING_FOLDER }}"
182192
183193
- name: Save formatted test data to a workflow artifact
184194
if: >
@@ -198,17 +208,17 @@ jobs:
198208
- name: Checkout repository
199209
uses: actions/checkout@v5
200210

201-
- name: Install Task
202-
uses: arduino/setup-task@v2
211+
- name: Install Go
212+
uses: actions/setup-go@v5
203213
with:
204-
repo-token: ${{ secrets.GITHUB_TOKEN }}
205-
version: 3.x
214+
go-version-file: go.mod
206215

207216
- name: Check ClangFormat test data
208217
run: |
209-
task \
210-
--silent \
211-
clang-format:check-testdata
218+
go tool \
219+
github.com/go-task/task/v3/cmd/task \
220+
--silent \
221+
clang-format:check-testdata
212222
213223
convert:
214224
runs-on: ubuntu-latest
@@ -228,18 +238,18 @@ jobs:
228238
with:
229239
node-version-file: package.json
230240

231-
- name: Install Task
232-
uses: arduino/setup-task@v2
241+
- name: Install Go
242+
uses: actions/setup-go@v5
233243
with:
234-
repo-token: ${{ secrets.GITHUB_TOKEN }}
235-
version: 3.x
244+
go-version-file: go.mod
236245

237246
- name: Convert the ClangFormat configuration
238247
run: |
239-
task \
240-
--silent \
241-
clang-format:convert \
242-
OUTPUT_PATH="${{ env.CONVERSION_OUTPUT_PATH }}"
248+
go tool \
249+
github.com/go-task/task/v3/cmd/task \
250+
--silent \
251+
clang-format:convert \
252+
OUTPUT_PATH="${{ env.CONVERSION_OUTPUT_PATH }}"
243253
244254
- name: Save conversion to a workflow artifact
245255
uses: actions/upload-artifact@v4

.github/workflows/check-community-health-sync.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ on:
1111
push:
1212
paths:
1313
- ".github/workflows/check-community-health-sync.ya?ml"
14+
- "go.mod"
15+
- "go.sum"
1416
- "Taskfile.ya?ml"
1517
- ".github/ISSUE_TEMPLATE/**"
1618
- "docs/**"
@@ -19,6 +21,8 @@ on:
1921
pull_request:
2022
paths:
2123
- ".github/workflows/check-community-health-sync.ya?ml"
24+
- "go.mod"
25+
- "go.sum"
2226
- "Taskfile.ya?ml"
2327
- ".github/ISSUE_TEMPLATE/**"
2428
- "docs/**"
@@ -39,17 +43,17 @@ jobs:
3943
- name: Checkout repository
4044
uses: actions/checkout@v5
4145

42-
- name: Install Task
43-
uses: arduino/setup-task@v2
46+
- name: Install Go
47+
uses: actions/setup-go@v5
4448
with:
45-
repo-token: ${{ secrets.GITHUB_TOKEN }}
46-
version: 3.x
49+
go-version-file: go.mod
4750

4851
- name: Sync files
4952
run: |
50-
task \
51-
--silent \
52-
github:sync
53+
go tool \
54+
github.com/go-task/task/v3/cmd/task \
55+
--silent \
56+
github:sync
5357
5458
- name: Check file duplicates sync
5559
run: |

.github/workflows/check-config-sync.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ jobs:
2525
- name: Checkout repository
2626
uses: actions/checkout@v5
2727

28-
- name: Install Task
29-
uses: arduino/setup-task@v2
28+
- name: Install Go
29+
uses: actions/setup-go@v5
3030
with:
31-
repo-token: ${{ secrets.GITHUB_TOKEN }}
32-
version: 3.x
31+
go-version-file: go.mod
3332

3433
- name: Sync files
3534
run: |
36-
task \
37-
--silent \
38-
config:sync
35+
go tool \
36+
github.com/go-task/task/v3/cmd/task \
37+
--silent \
38+
config:sync
3939
4040
- name: Check file duplicates sync
4141
run: |

.github/workflows/check-dependabot.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ on:
55
push:
66
paths:
77
- ".github/workflows/check-dependabot.yml"
8+
- "go.mod"
9+
- "go.sum"
810
- "package.json"
911
- "package-lock.json"
1012
- "Taskfile.ya?ml"
1113
- "**/dependabot.ya?ml"
1214
pull_request:
1315
paths:
1416
- ".github/workflows/check-dependabot.yml"
17+
- "go.mod"
18+
- "go.sum"
1519
- "package.json"
1620
- "package-lock.json"
1721
- "Taskfile.ya?ml"
@@ -31,16 +35,17 @@ jobs:
3135
- name: Checkout repository
3236
uses: actions/checkout@v5
3337

38+
- name: Install Go
39+
uses: actions/setup-go@v5
40+
with:
41+
go-version-file: go.mod
42+
3443
- name: Setup Node.js
3544
uses: actions/setup-node@v4
3645
with:
3746
node-version-file: package.json
3847

39-
- name: Install Task
40-
uses: arduino/setup-task@v2
41-
with:
42-
repo-token: ${{ secrets.GITHUB_TOKEN }}
43-
version: 3.x
44-
4548
- name: Validate Dependabot configuration files
46-
run: task dependabot:validate
49+
run: |
50+
go tool \
51+
github.com/go-task/task/v3/cmd/task dependabot:validate

.github/workflows/check-eslint.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
- ".github/workflows/check-eslint.yml"
88
- "workflow-templates/assets/check-javascript/.eslintrc.yml"
99
- ".npmrc"
10+
- "go.mod"
11+
- "go.sum"
1012
- "package.json"
1113
- "package-lock.json"
1214
- "Taskfile.ya?ml"
@@ -15,6 +17,8 @@ on:
1517
- ".github/workflows/check-eslint.yml"
1618
- "workflow-templates/assets/check-javascript/.eslintrc.yml"
1719
- ".npmrc"
20+
- "go.mod"
21+
- "go.sum"
1822
- "package.json"
1923
- "package-lock.json"
2024
- "Taskfile.ya?ml"
@@ -33,19 +37,19 @@ jobs:
3337
- name: Checkout repository
3438
uses: actions/checkout@v5
3539

40+
- name: Install Go
41+
uses: actions/setup-go@v5
42+
with:
43+
go-version-file: go.mod
44+
3645
- name: Setup Node.js
3746
uses: actions/setup-node@v4
3847
with:
3948
node-version-file: package.json
4049

41-
- name: Install Task
42-
uses: arduino/setup-task@v2
43-
with:
44-
repo-token: ${{ secrets.GITHUB_TOKEN }}
45-
version: 3.x
46-
4750
- name: Validate workflows
4851
run: |
49-
task \
50-
--silent \
51-
eslint:validate
52+
go tool \
53+
github.com/go-task/task/v3/cmd/task \
54+
--silent \
55+
eslint:validate

0 commit comments

Comments
 (0)