Skip to content

Commit a749529

Browse files
authored
Merge pull request #110 from per1234/sync-infrastructure
Sync infrastructure assets from upstream "templates"
2 parents 8ef4106 + 85fddde commit a749529

25 files changed

+4449
-1502
lines changed

.codespellrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check/.codespellrc
2+
# See: https://github.com/codespell-project/codespell#using-a-config-file
3+
[codespell]
4+
# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here:
5+
ignore-words-list = afterall,clude
6+
skip = ./.git,./.licenses,.pytest_cache,__pycache__,node_modules,./go.mod,./go.sum,./package-lock.json,./poetry.lock,./yarn.lock
7+
builtin = clear,informal,en-GB_to_en-US
8+
check-filenames =
9+
check-hidden =

.flake8

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-python/.flake8
2+
# See: https://flake8.pycqa.org/en/latest/user/configuration.html
3+
# The code style defined in this file is the official standardized style to be used in all Arduino tooling projects and
4+
# should not be modified.
5+
6+
[flake8]
7+
doctests = True
8+
# W503 and W504 are mutually exclusive. PEP 8 recommends line break before.
9+
ignore = E501,W503
10+
max-complexity = 10
11+
max-line-length = 120
12+
select = E,W,F,C,N

.github/dependabot.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,29 @@
22
version: 2
33

44
updates:
5-
# Configure check for outdated GitHub Actions actions in workflows.
5+
# Configure check for outdated GitHub Actions actions in workflows and action metadata.
66
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/dependabot/README.md
77
# See: https://docs.github.com/en/code-security/supply-chain-security/keeping-your-actions-up-to-date-with-dependabot
88
- package-ecosystem: github-actions
9-
directory: / # Check the repository's workflows under /.github/workflows/
9+
assignees:
10+
- per1234
11+
directory: /
12+
schedule:
13+
interval: daily
14+
labels:
15+
- "topic: infrastructure"
16+
- package-ecosystem: npm
17+
assignees:
18+
- per1234
19+
directory: /
1020
schedule:
1121
interval: daily
1222
labels:
1323
- "topic: infrastructure"
1424
- package-ecosystem: pip
15-
directory: /compilesketches/
25+
assignees:
26+
- per1234
27+
directory: /
1628
schedule:
1729
interval: daily
1830
labels:
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-action-metadata-task.md
2+
name: Check Action Metadata
3+
4+
env:
5+
# See: https://github.com/actions/setup-node/#readme
6+
NODE_VERSION: 16.x
7+
8+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
9+
on:
10+
create:
11+
push:
12+
paths:
13+
- ".github/workflows/check-action-metadata-task.ya?ml"
14+
- "action.ya?ml"
15+
- "package.json"
16+
- "package-lock.json"
17+
- "Taskfile.ya?ml"
18+
pull_request:
19+
paths:
20+
- ".github/workflows/check-action-metadata-task.ya?ml"
21+
- "action.ya?ml"
22+
- "package.json"
23+
- "package-lock.json"
24+
- "Taskfile.ya?ml"
25+
schedule:
26+
# Run every Tuesday at 8 AM UTC to catch breakage from changes to the JSON schema.
27+
- cron: "0 8 * * TUE"
28+
workflow_dispatch:
29+
repository_dispatch:
30+
31+
jobs:
32+
run-determination:
33+
runs-on: ubuntu-latest
34+
outputs:
35+
result: ${{ steps.determination.outputs.result }}
36+
steps:
37+
- name: Determine if the rest of the workflow should run
38+
id: determination
39+
run: |
40+
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
41+
# 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
45+
]]; then
46+
# Run the other jobs.
47+
RESULT="true"
48+
else
49+
# There is no need to run the other jobs.
50+
RESULT="false"
51+
fi
52+
53+
echo "result=$RESULT" >> $GITHUB_OUTPUT
54+
55+
validate:
56+
needs: run-determination
57+
if: needs.run-determination.outputs.result == 'true'
58+
runs-on: ubuntu-latest
59+
60+
steps:
61+
- name: Checkout repository
62+
uses: actions/checkout@v3
63+
64+
- name: Setup Node.js
65+
uses: actions/setup-node@v3
66+
with:
67+
node-version: ${{ env.NODE_VERSION }}
68+
69+
- name: Install Task
70+
uses: arduino/setup-task@v1
71+
with:
72+
repo-token: ${{ secrets.GITHUB_TOKEN }}
73+
version: 3.x
74+
75+
- name: Validate action.yml
76+
run: task --silent action:validate
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-python-task.md
2+
name: Check Python
3+
4+
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
5+
on:
6+
create:
7+
push:
8+
paths:
9+
- ".github/workflows/check-python-task.ya?ml"
10+
- "**/.flake8"
11+
- "**/poetry.lock"
12+
- "**/pyproject.toml"
13+
- "**/setup.cfg"
14+
- ".python-version"
15+
- "Taskfile.ya?ml"
16+
- "**/tox.ini"
17+
- "**.py"
18+
pull_request:
19+
paths:
20+
- ".github/workflows/check-python-task.ya?ml"
21+
- "**/.flake8"
22+
- "**/poetry.lock"
23+
- "**/pyproject.toml"
24+
- "**/setup.cfg"
25+
- ".python-version"
26+
- "Taskfile.ya?ml"
27+
- "**/tox.ini"
28+
- "**.py"
29+
schedule:
30+
# Run periodically to catch breakage caused by external changes.
31+
- cron: "0 8 * * WED"
32+
workflow_dispatch:
33+
repository_dispatch:
34+
35+
jobs:
36+
run-determination:
37+
runs-on: ubuntu-latest
38+
outputs:
39+
result: ${{ steps.determination.outputs.result }}
40+
steps:
41+
- name: Determine if the rest of the workflow should run
42+
id: determination
43+
run: |
44+
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
45+
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
46+
if [[
47+
"${{ github.event_name }}" != "create" ||
48+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
49+
]]; then
50+
# Run the other jobs.
51+
RESULT="true"
52+
else
53+
# There is no need to run the other jobs.
54+
RESULT="false"
55+
fi
56+
57+
echo "result=$RESULT" >> $GITHUB_OUTPUT
58+
59+
lint:
60+
needs: run-determination
61+
if: needs.run-determination.outputs.result == 'true'
62+
runs-on: ubuntu-latest
63+
64+
steps:
65+
- name: Checkout repository
66+
uses: actions/checkout@v3
67+
68+
- name: Install Python
69+
uses: actions/setup-python@v4
70+
with:
71+
python-version-file: .python-version
72+
73+
- name: Install Poetry
74+
run: |
75+
pipx install \
76+
--python "$(which python)" \
77+
poetry
78+
79+
- name: Install Task
80+
uses: arduino/setup-task@v1
81+
with:
82+
repo-token: ${{ secrets.GITHUB_TOKEN }}
83+
version: 3.x
84+
85+
- name: Run flake8
86+
uses: liskin/gh-problem-matcher-wrap@v2
87+
with:
88+
linters: flake8
89+
run: task python:lint
90+
91+
formatting:
92+
needs: run-determination
93+
if: needs.run-determination.outputs.result == 'true'
94+
runs-on: ubuntu-latest
95+
96+
steps:
97+
- name: Checkout repository
98+
uses: actions/checkout@v3
99+
100+
- name: Install Python
101+
uses: actions/setup-python@v4
102+
with:
103+
python-version-file: .python-version
104+
105+
- name: Install Poetry
106+
run: |
107+
pipx install \
108+
--python "$(which python)" \
109+
poetry
110+
111+
- name: Install Task
112+
uses: arduino/setup-task@v1
113+
with:
114+
repo-token: ${{ secrets.GITHUB_TOKEN }}
115+
version: 3.x
116+
117+
- name: Format Python code
118+
run: task python:format
119+
120+
- name: Check formatting
121+
run: git diff --color --exit-code

.github/workflows/lint-python.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/spell-check-task.md
2+
name: Spell Check
3+
4+
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
5+
on:
6+
create:
7+
push:
8+
pull_request:
9+
schedule:
10+
# Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates.
11+
- cron: "0 8 * * TUE"
12+
workflow_dispatch:
13+
repository_dispatch:
14+
15+
jobs:
16+
run-determination:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
result: ${{ steps.determination.outputs.result }}
20+
steps:
21+
- name: Determine if the rest of the workflow should run
22+
id: determination
23+
run: |
24+
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
25+
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
26+
if [[
27+
"${{ github.event_name }}" != "create" ||
28+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
29+
]]; then
30+
# Run the other jobs.
31+
RESULT="true"
32+
else
33+
# There is no need to run the other jobs.
34+
RESULT="false"
35+
fi
36+
37+
echo "result=$RESULT" >> $GITHUB_OUTPUT
38+
39+
spellcheck:
40+
needs: run-determination
41+
if: needs.run-determination.outputs.result == 'true'
42+
runs-on: ubuntu-latest
43+
44+
steps:
45+
- name: Checkout repository
46+
uses: actions/checkout@v3
47+
48+
- name: Install Python
49+
uses: actions/setup-python@v4
50+
with:
51+
python-version-file: .python-version
52+
53+
- name: Install Poetry
54+
run: |
55+
pipx install \
56+
--python "$(which python)" \
57+
poetry
58+
59+
- name: Install Task
60+
uses: arduino/setup-task@v1
61+
with:
62+
repo-token: ${{ secrets.GITHUB_TOKEN }}
63+
version: 3.x
64+
65+
- name: Spell check
66+
run: task general:check-spelling

0 commit comments

Comments
 (0)