Skip to content

Commit 6c95286

Browse files
authored
Merge pull request #205 from arduino/sync-infrastructure
Sync infrastructure assets from upstream "templates"
2 parents adfadc1 + 7814917 commit 6c95286

23 files changed

+4509
-96
lines changed

.codespellrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[codespell]
44
# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here:
55
ignore-words-list = easly,pullrequest
6-
skip = ./.git,./.licenses,./go.mod,./go.sum,./package-lock.json,./poetry.lock,./yarn.lock
6+
skip = ./.git,./.licenses,node_modules,./go.mod,./go.sum,./package-lock.json,./poetry.lock,./yarn.lock
77
builtin = clear,informal,en-GB_to_en-US
88
check-filenames =
99
check-hidden =

.github/workflows/check-general-formatting-task.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-general-formatting-task.md
22
name: Check General Formatting
33

4-
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
4+
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
55
on:
6+
create:
67
push:
78
pull_request:
89
schedule:
@@ -12,13 +13,41 @@ on:
1213
repository_dispatch:
1314

1415
jobs:
16+
run-determination:
17+
runs-on: ubuntu-latest
18+
permissions: {}
19+
outputs:
20+
result: ${{ steps.determination.outputs.result }}
21+
steps:
22+
- name: Determine if the rest of the workflow should run
23+
id: determination
24+
run: |
25+
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
26+
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
27+
if [[
28+
"${{ github.event_name }}" != "create" ||
29+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
30+
]]; then
31+
# Run the other jobs.
32+
RESULT="true"
33+
else
34+
# There is no need to run the other jobs.
35+
RESULT="false"
36+
fi
37+
38+
echo "result=$RESULT" >> $GITHUB_OUTPUT
39+
1540
check:
41+
needs: run-determination
42+
if: needs.run-determination.outputs.result == 'true'
1643
runs-on: ubuntu-latest
44+
permissions:
45+
contents: read
1746

1847
steps:
1948
- name: Set environment variables
2049
run: |
21-
# See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
50+
# See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
2251
echo "EC_INSTALL_PATH=${{ runner.temp }}/editorconfig-checker" >> "$GITHUB_ENV"
2352
2453
- name: Checkout repository
@@ -46,7 +75,7 @@ jobs:
4675
# Give the binary a standard name
4776
mv "${{ env.EC_INSTALL_PATH }}/bin/ec-linux-amd64" "${{ env.EC_INSTALL_PATH }}/bin/ec"
4877
# Add installation to PATH:
49-
# See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
78+
# See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path
5079
echo "${{ env.EC_INSTALL_PATH }}/bin" >> "$GITHUB_PATH"
5180
5281
- name: Check formatting

.github/workflows/check-go-dependencies-task.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ on:
3737
jobs:
3838
run-determination:
3939
runs-on: ubuntu-latest
40+
permissions: {}
4041
outputs:
4142
result: ${{ steps.determination.outputs.result }}
4243
steps:
@@ -56,19 +57,27 @@ jobs:
5657
RESULT="false"
5758
fi
5859
59-
echo "::set-output name=result::$RESULT"
60+
echo "result=$RESULT" >> $GITHUB_OUTPUT
6061
6162
check-cache:
6263
needs: run-determination
6364
if: needs.run-determination.outputs.result == 'true'
6465
runs-on: ubuntu-latest
66+
permissions:
67+
contents: read
6568

6669
steps:
6770
- name: Checkout repository
6871
uses: actions/checkout@v3
6972
with:
7073
submodules: recursive
7174

75+
# This is required to allow jonabc/setup-licensed to install licensed via Ruby gem.
76+
- name: Install Ruby
77+
uses: ruby/setup-ruby@v1
78+
with:
79+
ruby-version: ruby # Install latest version
80+
7281
- name: Install licensed
7382
uses: jonabc/setup-licensed@v1
7483
with:
@@ -112,13 +121,21 @@ jobs:
112121
needs: run-determination
113122
if: needs.run-determination.outputs.result == 'true'
114123
runs-on: ubuntu-latest
124+
permissions:
125+
contents: read
115126

116127
steps:
117128
- name: Checkout repository
118129
uses: actions/checkout@v3
119130
with:
120131
submodules: recursive
121132

133+
# This is required to allow jonabc/setup-licensed to install licensed via Ruby gem.
134+
- name: Install Ruby
135+
uses: ruby/setup-ruby@v1
136+
with:
137+
ruby-version: ruby # Install latest version
138+
122139
- name: Install licensed
123140
uses: jonabc/setup-licensed@v1
124141
with:

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

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ env:
55
# See: https://github.com/actions/setup-go/tree/main#supported-version-syntax
66
GO_VERSION: "1.17"
77

8-
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
8+
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
99
on:
1010
create:
1111
push:
@@ -23,14 +23,15 @@ on:
2323
- "**/go.sum"
2424
- "**.go"
2525
schedule:
26-
# Run every Tuesday at 8 AM UTC to catch breakage caused by changes to tools.
27-
- cron: "0 8 * * TUE"
26+
# Run periodically to catch breakage caused by external changes.
27+
- cron: "0 7 * * WED"
2828
workflow_dispatch:
2929
repository_dispatch:
3030

3131
jobs:
3232
run-determination:
3333
runs-on: ubuntu-latest
34+
permissions: {}
3435
outputs:
3536
result: ${{ steps.determination.outputs.result }}
3637
steps:
@@ -39,9 +40,9 @@ jobs:
3940
run: |
4041
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
4142
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
42-
if [[ \
43-
"${{ github.event_name }}" != "create" || \
44-
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX \
43+
if [[
44+
"${{ github.event_name }}" != "create" ||
45+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
4546
]]; then
4647
# Run the other jobs.
4748
RESULT="true"
@@ -50,13 +51,15 @@ jobs:
5051
RESULT="false"
5152
fi
5253
53-
echo "::set-output name=result::$RESULT"
54+
echo "result=$RESULT" >> $GITHUB_OUTPUT
5455
5556
check-errors:
5657
name: check-errors (${{ matrix.module.path }})
5758
needs: run-determination
5859
if: needs.run-determination.outputs.result == 'true'
5960
runs-on: ubuntu-latest
61+
permissions:
62+
contents: read
6063

6164
strategy:
6265
fail-fast: false
@@ -90,6 +93,8 @@ jobs:
9093
needs: run-determination
9194
if: needs.run-determination.outputs.result == 'true'
9295
runs-on: ubuntu-latest
96+
permissions:
97+
contents: read
9398

9499
strategy:
95100
fail-fast: false
@@ -126,6 +131,8 @@ jobs:
126131
needs: run-determination
127132
if: needs.run-determination.outputs.result == 'true'
128133
runs-on: ubuntu-latest
134+
permissions:
135+
contents: read
129136

130137
strategy:
131138
fail-fast: false
@@ -162,6 +169,8 @@ jobs:
162169
needs: run-determination
163170
if: needs.run-determination.outputs.result == 'true'
164171
runs-on: ubuntu-latest
172+
permissions:
173+
contents: read
165174

166175
strategy:
167176
fail-fast: false
@@ -198,6 +207,8 @@ jobs:
198207
needs: run-determination
199208
if: needs.run-determination.outputs.result == 'true'
200209
runs-on: ubuntu-latest
210+
permissions:
211+
contents: read
201212

202213
strategy:
203214
fail-fast: false

.github/workflows/check-license.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ env:
66
# SPDX identifier: https://spdx.org/licenses/
77
EXPECTED_LICENSE_TYPE: AGPL-3.0
88

9-
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
9+
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
1010
on:
11+
create:
1112
push:
1213
paths:
1314
- ".github/workflows/check-license.ya?ml"
@@ -25,12 +26,43 @@ on:
2526
- "[lL][iI][cC][eE][nN][cCsS][eE]*"
2627
- "[oO][fF][lL]*"
2728
- "[pP][aA][tT][eE][nN][tT][sS]*"
29+
schedule:
30+
# Run periodically to catch breakage caused by external changes.
31+
- cron: "0 6 * * WED"
2832
workflow_dispatch:
2933
repository_dispatch:
3034

3135
jobs:
36+
run-determination:
37+
runs-on: ubuntu-latest
38+
permissions: {}
39+
outputs:
40+
result: ${{ steps.determination.outputs.result }}
41+
steps:
42+
- name: Determine if the rest of the workflow should run
43+
id: determination
44+
run: |
45+
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
46+
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
47+
if [[
48+
"${{ github.event_name }}" != "create" ||
49+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
50+
]]; then
51+
# Run the other jobs.
52+
RESULT="true"
53+
else
54+
# There is no need to run the other jobs.
55+
RESULT="false"
56+
fi
57+
58+
echo "result=$RESULT" >> $GITHUB_OUTPUT
59+
3260
check-license:
61+
needs: run-determination
62+
if: needs.run-determination.outputs.result == 'true'
3363
runs-on: ubuntu-latest
64+
permissions:
65+
contents: read
3466

3567
steps:
3668
- name: Checkout repository

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

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-markdown-task.md
22
name: Check Markdown
33

4-
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
4+
env:
5+
# See: https://github.com/actions/setup-node/#readme
6+
NODE_VERSION: 16.x
7+
8+
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
59
on:
10+
create:
611
push:
712
paths:
813
- ".github/workflows/check-markdown-task.ya?ml"
914
- ".markdown-link-check.json"
15+
- "package.json"
16+
- "package-lock.json"
1017
- "Taskfile.ya?ml"
1118
- "**/.markdownlint*"
1219
- "**.mdx?"
@@ -17,6 +24,8 @@ on:
1724
paths:
1825
- ".github/workflows/check-markdown-task.ya?ml"
1926
- ".markdown-link-check.json"
27+
- "package.json"
28+
- "package-lock.json"
2029
- "Taskfile.ya?ml"
2130
- "**/.markdownlint*"
2231
- "**.mdx?"
@@ -30,13 +39,46 @@ on:
3039
repository_dispatch:
3140

3241
jobs:
42+
run-determination:
43+
runs-on: ubuntu-latest
44+
permissions: {}
45+
outputs:
46+
result: ${{ steps.determination.outputs.result }}
47+
steps:
48+
- name: Determine if the rest of the workflow should run
49+
id: determination
50+
run: |
51+
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
52+
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
53+
if [[
54+
"${{ github.event_name }}" != "create" ||
55+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
56+
]]; then
57+
# Run the other jobs.
58+
RESULT="true"
59+
else
60+
# There is no need to run the other jobs.
61+
RESULT="false"
62+
fi
63+
64+
echo "result=$RESULT" >> $GITHUB_OUTPUT
65+
3366
lint:
67+
needs: run-determination
68+
if: needs.run-determination.outputs.result == 'true'
3469
runs-on: ubuntu-latest
70+
permissions:
71+
contents: read
3572

3673
steps:
3774
- name: Checkout repository
3875
uses: actions/checkout@v3
3976

77+
- name: Setup Node.js
78+
uses: actions/setup-node@v3
79+
with:
80+
node-version: ${{ env.NODE_VERSION }}
81+
4082
- name: Initialize markdownlint-cli problem matcher
4183
uses: xt0rted/markdownlint-problem-matcher@v2
4284

@@ -50,12 +92,21 @@ jobs:
5092
run: task markdown:lint
5193

5294
links:
95+
needs: run-determination
96+
if: needs.run-determination.outputs.result == 'true'
5397
runs-on: ubuntu-latest
98+
permissions:
99+
contents: read
54100

55101
steps:
56102
- name: Checkout repository
57103
uses: actions/checkout@v3
58104

105+
- name: Setup Node.js
106+
uses: actions/setup-node@v3
107+
with:
108+
node-version: ${{ env.NODE_VERSION }}
109+
59110
- name: Install Task
60111
uses: arduino/setup-task@v1
61112
with:

0 commit comments

Comments
 (0)