Skip to content

Commit ea2c82a

Browse files
authored
Merge pull request #652 from per1234/manage-yq
Manage the "yq" tool dependency
2 parents 0756982 + 9c1e66f commit ea2c82a

23 files changed

+369
-57
lines changed

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ jobs:
8484
fi
8585
8686
echo "CLANG_FORMAT_INSTALL_PATH=${{ runner.temp }}/clang-format" >>"$GITHUB_ENV"
87-
echo "YQ_INSTALL_PATH=${{ runner.temp }}/yq" >>"$GITHUB_ENV"
8887
echo "WORKING_FOLDER=${{ runner.temp }}" >>"$GITHUB_ENV"
8988
9089
- name: Download ClangFormat
@@ -108,26 +107,6 @@ jobs:
108107
# See: https://docs.github.com/actions/reference/workflows-and-actions/workflow-commands#adding-a-system-path
109108
echo "${{ env.CLANG_FORMAT_INSTALL_PATH }}/clang_Linux_64bit" >>"$GITHUB_PATH"
110109
111-
- name: Download yq
112-
id: download-yq
113-
uses: MrOctopus/[email protected]
114-
with:
115-
repository: mikefarah/yq
116-
asset: yq_linux_amd64.tar.gz
117-
target: ${{ env.YQ_INSTALL_PATH }}
118-
119-
- name: Install yq
120-
run: |
121-
cd "${{ env.YQ_INSTALL_PATH }}"
122-
123-
tar \
124-
--extract \
125-
--file="${{ steps.download-yq.outputs.name }}"
126-
127-
# Add installation to PATH:
128-
# See: https://docs.github.com/actions/reference/workflows-and-actions/workflow-commands#adding-a-system-path
129-
echo "${{ env.YQ_INSTALL_PATH }}/yq" >>"$GITHUB_PATH"
130-
131110
- name: Check ClangFormat configuration file
132111
id: check
133112
run: |

.github/workflows/check-poetry-task.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ on:
66
push:
77
paths:
88
- ".github/workflows/check-poetry-task.ya?ml"
9+
- "go.mod"
10+
- "go.sum"
911
- "poetry.lock"
1012
- "pyproject.toml"
1113
- "Taskfile.ya?ml"
1214
pull_request:
1315
paths:
1416
- ".github/workflows/check-poetry-task.ya?ml"
17+
- "go.mod"
18+
- "go.sum"
1519
- "poetry.lock"
1620
- "pyproject.toml"
1721
- "Taskfile.ya?ml"
@@ -57,6 +61,11 @@ jobs:
5761
- name: Checkout repository
5862
uses: actions/checkout@v5
5963

64+
- name: Install Go
65+
uses: actions/setup-go@v5
66+
with:
67+
go-version-file: go.mod
68+
6069
- name: Install Python
6170
uses: actions/setup-python@v5
6271
with:

.github/workflows/check-python-task.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ on:
1111
- "**/poetry.lock"
1212
- "**/pyproject.toml"
1313
- "**/setup.cfg"
14+
- "go.mod"
15+
- "go.sum"
1416
- "Taskfile.ya?ml"
1517
- "**/tox.ini"
1618
- "**.py"
@@ -21,6 +23,8 @@ on:
2123
- "**/poetry.lock"
2224
- "**/pyproject.toml"
2325
- "**/setup.cfg"
26+
- "go.mod"
27+
- "go.sum"
2428
- "Taskfile.ya?ml"
2529
- "**/tox.ini"
2630
- "**.py"
@@ -66,6 +70,11 @@ jobs:
6670
- name: Checkout repository
6771
uses: actions/checkout@v5
6872

73+
- name: Install Go
74+
uses: actions/setup-go@v5
75+
with:
76+
go-version-file: go.mod
77+
6978
- name: Install Python
7079
uses: actions/setup-python@v5
7180
with:

.github/workflows/check-yaml-task.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
create:
77
push:
88
paths:
9+
- "go.mod"
10+
- "go.sum"
911
- ".yamllint*"
1012
- "poetry.lock"
1113
- "pyproject.toml"
@@ -22,6 +24,8 @@ on:
2224
- "**.syntax"
2325
pull_request:
2426
paths:
27+
- "go.mod"
28+
- "go.sum"
2529
- ".yamllint*"
2630
- "poetry.lock"
2731
- "pyproject.toml"
@@ -94,6 +98,11 @@ jobs:
9498
- name: Checkout repository
9599
uses: actions/checkout@v5
96100

101+
- name: Install Go
102+
uses: actions/setup-go@v5
103+
with:
104+
go-version-file: go.mod
105+
97106
- name: Install Python
98107
uses: actions/setup-python@v5
99108
with:

.github/workflows/test-python-poetry-task.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
push:
88
paths:
99
- ".github/workflows/test-python-poetry-task.ya?ml"
10+
- "go.mod"
11+
- "go.sum"
1012
- "Taskfile.ya?ml"
1113
- "poetry.lock"
1214
- "pyproject.toml"
@@ -15,6 +17,8 @@ on:
1517
pull_request:
1618
paths:
1719
- ".github/workflows/test-python-poetry-task.ya?ml"
20+
- "go.mod"
21+
- "go.sum"
1822
- "Taskfile.ya?ml"
1923
- "poetry.lock"
2024
- "pyproject.toml"
@@ -62,6 +66,11 @@ jobs:
6266
- name: Checkout repository
6367
uses: actions/checkout@v5
6468

69+
- name: Install Go
70+
uses: actions/setup-go@v5
71+
with:
72+
go-version-file: go.mod
73+
6574
- name: Install Python
6675
uses: actions/setup-python@v5
6776
with:

Taskfile.yml

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,11 @@ tasks:
259259
cmds:
260260
- |
261261
if
262-
! which yq \
262+
! which go \
263263
&>/dev/null
264264
then
265-
echo "ec not found or not in PATH. Please install: https://github.com/mikefarah/yq/#install"
265+
echo "Go not found or not in PATH."
266+
echo "Please install: https://go.dev/doc/install"
266267
exit 1
267268
fi
268269
@@ -282,22 +283,25 @@ tasks:
282283
# Correct invalid `BasedOnStyle` key value
283284
# The existing key is deleted before assigning it to a valid value in order to achieve consistent quoting style
284285
# (updating the empty string value in place causes the assigned value to be wrapped in quotes)
285-
yq \
286-
--inplace \
287-
'del(.BasedOnStyle)' \
288-
"{{.TARGET_PATH}}"
286+
go tool \
287+
github.com/mikefarah/yq/v4 \
288+
--inplace \
289+
'del(.BasedOnStyle)' \
290+
"{{.TARGET_PATH}}"
289291
290-
yq \
291-
--inplace \
292-
'.BasedOnStyle = "LLVM"' \
293-
"{{.TARGET_PATH}}"
292+
go tool \
293+
github.com/mikefarah/yq/v4 \
294+
--inplace \
295+
'.BasedOnStyle = "LLVM"' \
296+
"{{.TARGET_PATH}}"
294297
295298
- |
296299
# Fix the inconsistent key order
297-
yq \
298-
--inplace \
299-
'sort_keys(.)' \
300-
"{{.TARGET_PATH}}"
300+
go tool \
301+
github.com/mikefarah/yq/v4 \
302+
--inplace \
303+
'sort_keys(.)' \
304+
"{{.TARGET_PATH}}"
301305
302306
# Use ClangFormat to format the files under the path specified by TARGET_FOLDER recursively
303307
clang-format:format:
@@ -964,11 +968,11 @@ tasks:
964968
cmds:
965969
- |
966970
if
967-
! which yq \
971+
! which go \
968972
&>/dev/null
969973
then
970-
echo "yq not found or not in PATH."
971-
echo "Please install: https://github.com/mikefarah/yq/#install"
974+
echo "Go not found or not in PATH."
975+
echo "Please install: https://go.dev/doc/install"
972976
exit 1
973977
fi
974978
- |
@@ -977,10 +981,11 @@ tasks:
977981
&>/dev/null
978982
then
979983
python_constraint="$( \
980-
yq \
981-
--input-format toml \
982-
--output-format yaml \
983-
'.tool.poetry.dependencies.python' \
984+
go tool \
985+
github.com/mikefarah/yq/v4 \
986+
--input-format toml \
987+
--output-format yaml \
988+
'.tool.poetry.dependencies.python' \
984989
<pyproject.toml
985990
)"
986991
@@ -1005,10 +1010,11 @@ tasks:
10051010
)"
10061011
10071012
poetry_constraint="$( \
1008-
yq \
1009-
--input-format toml \
1010-
--output-format yaml \
1011-
'.tool.poetry.group.pipx.dependencies.poetry' \
1013+
go tool \
1014+
github.com/mikefarah/yq/v4 \
1015+
--input-format toml \
1016+
--output-format yaml \
1017+
'.tool.poetry.group.pipx.dependencies.poetry' \
10121018
<pyproject.toml
10131019
)"
10141020

docs/development.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
The following development tools must be available in your local environment:
88

9+
- [**Go**](https://go.dev/dl/) - programming language
10+
- The **Go** version in use is defined in the `go` directive of [`go.mod`](../go.mod).
11+
- [**gvm**](https://github.com/moovweb/gvm#installing) is recommended if you want to manage multiple installations of **Go** on your system.
912
- [**Node.js** / **npm**](https://nodejs.org/en/download/) - Node.js dependencies management tool
1013
- The **Node.js** version in use is defined by the `engines.node` key of [`package.json`](../package.json).
1114
- [**Python**](https://wiki.python.org/moin/BeginnersGuide/Download)

go.mod

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module github.com/arduino/tooling-project-assets
2+
3+
go 1.24.7
4+
5+
tool github.com/mikefarah/yq/v4
6+
7+
require (
8+
github.com/a8m/envsubst v1.4.3 // indirect
9+
github.com/alecthomas/participle/v2 v2.1.4 // indirect
10+
github.com/dimchansky/utfbom v1.1.1 // indirect
11+
github.com/elliotchance/orderedmap v1.8.0 // indirect
12+
github.com/fatih/color v1.18.0 // indirect
13+
github.com/go-ini/ini v1.67.0 // indirect
14+
github.com/goccy/go-json v0.10.5 // indirect
15+
github.com/goccy/go-yaml v1.18.0 // indirect
16+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
17+
github.com/jinzhu/copier v0.4.0 // indirect
18+
github.com/magiconair/properties v1.8.10 // indirect
19+
github.com/mattn/go-colorable v0.1.14 // indirect
20+
github.com/mattn/go-isatty v0.0.20 // indirect
21+
github.com/mikefarah/yq/v4 v4.47.2 // indirect
22+
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
23+
github.com/spf13/cobra v1.10.1 // indirect
24+
github.com/spf13/pflag v1.0.10 // indirect
25+
github.com/yuin/gopher-lua v1.1.1 // indirect
26+
go.yaml.in/yaml/v3 v3.0.4 // indirect
27+
golang.org/x/net v0.43.0 // indirect
28+
golang.org/x/sys v0.35.0 // indirect
29+
golang.org/x/text v0.28.0 // indirect
30+
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473 // indirect
31+
)

go.sum

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
github.com/a8m/envsubst v1.4.3 h1:kDF7paGK8QACWYaQo6KtyYBozY2jhQrTuNNuUxQkhJY=
2+
github.com/a8m/envsubst v1.4.3/go.mod h1:4jjHWQlZoaXPoLQUb7H2qT4iLkZDdmEQiOUogdUmqVU=
3+
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
4+
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
5+
github.com/alecthomas/participle/v2 v2.1.4 h1:W/H79S8Sat/krZ3el6sQMvMaahJ+XcM9WSI2naI7w2U=
6+
github.com/alecthomas/participle/v2 v2.1.4/go.mod h1:8tqVbpTX20Ru4NfYQgZf4mP18eXPTBViyMWiArNEgGI=
7+
github.com/alecthomas/repr v0.5.1 h1:E3G4t2QbHTSNpPKBgMTln5KLkZHLOcU7r37J4pXBuIg=
8+
github.com/alecthomas/repr v0.5.1/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
9+
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
10+
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
11+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
12+
github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U=
13+
github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE=
14+
github.com/elliotchance/orderedmap v1.8.0 h1:TrOREecvh3JbS+NCgwposXG5ZTFHtEsQiCGOhPElnMw=
15+
github.com/elliotchance/orderedmap v1.8.0/go.mod h1:wsDwEaX5jEoyhbs7x93zk2H/qv0zwuhg4inXhDkYqys=
16+
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
17+
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
18+
github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
19+
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
20+
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
21+
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
22+
github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=
23+
github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
24+
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
25+
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
26+
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
27+
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
28+
github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8=
29+
github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
30+
github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE=
31+
github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
32+
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
33+
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
34+
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
35+
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
36+
github.com/mikefarah/yq/v4 v4.47.2 h1:Jb5fHlvgK5eeaPbreG9UJs1E5w6l5hUzXjeaY6LTTWY=
37+
github.com/mikefarah/yq/v4 v4.47.2/go.mod h1:ulYbZUzGJsBDDwO5ohvk/KOW4vW5Iddd/DBeAY1Q09g=
38+
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
39+
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
40+
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A=
41+
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
42+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
43+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
44+
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
45+
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
46+
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
47+
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
48+
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
49+
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
50+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
51+
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
52+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
53+
github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M=
54+
github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
55+
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
56+
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
57+
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
58+
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
59+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
60+
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
61+
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
62+
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
63+
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
64+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
65+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
66+
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473 h1:6D+BvnJ/j6e222UW8s2qTSe3wGBtvo0MbVQG/c5k8RE=
67+
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473/go.mod h1:N1eN2tsCx0Ydtgjl4cqmbRCsY4/+z4cYDeqwZTk6zog=
68+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
69+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
70+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)