Skip to content

Commit db75bcc

Browse files
committed
Update infrastructure for spell checking project contents
Arduino tooling projects use a standardized infrastructure. A centralized collection of reusable infrastructure assets is maintained in a dedicated repository: https://github.com/arduino/tooling-project-assets Since the time this project's infrastructure was installed, some advancements have been made in the upstream "template" assets. The project's infrastructure is hereby brought up to date with the state of the art upstream assets. The significant changes: - Migration to the use of the Task task runner to allow contributors to easily run the same operations locally as is done by the CI system on GitHub. - Use of Poetry and Dependabot for controlled management of the dependencies.
1 parent 8356c72 commit db75bcc

8 files changed

+118
-20
lines changed

Diff for: .codespellrc

+9
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 =

Diff for: .github/workflows/spell-check-task.yml

+66
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

Diff for: .github/workflows/spell-check.yml

-16
This file was deleted.

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Check Action Metadata status](https://github.com/arduino/compile-sketches/actions/workflows/check-action-metadata-task.yml/badge.svg)](https://github.com/arduino/compile-sketches/actions/workflows/check-action-metadata-task.yml)
44
[![Tests](https://github.com/arduino/compile-sketches/workflows/Test%20Python%20code/badge.svg)](https://github.com/arduino/compile-sketches/actions?workflow=Test+Python+code)
55
[![Check Python status](https://github.com/arduino/compile-sketches/actions/workflows/check-python-task.yml/badge.svg)](https://github.com/arduino/compile-sketches/actions/workflows/check-python-task.yml)
6-
[![Spell Check](https://github.com/arduino/compile-sketches/workflows/Spell%20Check/badge.svg)](https://github.com/arduino/compile-sketches/actions?workflow=Spell+Check)
6+
[![Spell Check status](https://github.com/arduino/compile-sketches/actions/workflows/spell-check-task.yml/badge.svg)](https://github.com/arduino/compile-sketches/actions/workflows/spell-check-task.yml)
77
[![codecov](https://codecov.io/gh/arduino/compile-sketches/branch/main/graph/badge.svg?token=Uv6f1ebMZ4)](https://codecov.io/gh/arduino/compile-sketches)
88

99
This action checks whether [Arduino](https://www.arduino.cc/) sketches compile and produces a report of data from the compilations.

Diff for: Taskfile.yml

+22
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ tasks:
66
desc: Check for problems with the project
77
deps:
88
- task: action:validate
9+
- task: general:check-spelling
910
- task: python:lint
1011

1112
fix:
1213
desc: Make automated corrections to the project's files
1314
deps:
15+
- task: general:correct-spelling
1416
- task: python:format
1517

1618
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-action-metadata-task/Taskfile.yml
@@ -35,6 +37,26 @@ tasks:
3537
-s "{{.ACTION_METADATA_SCHEMA_PATH}}" \
3638
-d "action.yml"
3739
40+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml
41+
general:check-spelling:
42+
desc: Check for commonly misspelled words
43+
deps:
44+
- task: poetry:install-deps
45+
vars:
46+
POETRY_GROUPS: dev
47+
cmds:
48+
- poetry run codespell
49+
50+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml
51+
general:correct-spelling:
52+
desc: Correct commonly misspelled words where possible
53+
deps:
54+
- task: poetry:install-deps
55+
vars:
56+
POETRY_GROUPS: dev
57+
cmds:
58+
- poetry run codespell --write-changes
59+
3860
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/npm-task/Taskfile.yml
3961
npm:install-deps:
4062
desc: Install dependencies managed by npm

Diff for: etc/codespell-ignore-words-list.txt

-2
This file was deleted.

Diff for: poetry.lock

+19-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ semver = "2.13.0"
1616

1717
[tool.poetry.group.dev.dependencies]
1818
black = "23.1.0"
19+
codespell = "2.2.4"
1920
coverage = "7.2.2"
2021
pytest = "7.2.2"
2122
pytest-mock = "3.10.0"

0 commit comments

Comments
 (0)