From e9426807b2973a93e3bf81e37ab5afe3842c02b1 Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 31 Mar 2022 23:13:14 -0700 Subject: [PATCH 1/2] Deprecate `arduino/actions/libraries/spell-check` action Since the time Arduino created this action, the developers of the excellent codespell spell checker tool it uses created their own action (`codespell-project/actions-codespell`). Since that action meets all of Arduino's needs, the decision was made that there is no reason for Arduino to maintain an alternative spell check action. Arduino has been using the excellent `codespell-project/actions-codespell` action in the CI systems of most of the firmware repositories for the last year. The status of the `arduino/actions/libraries/spell-check` action is now communicated to users of the action and visitors to this repository by: - A warning in the top level readme - A warning in the action level readme - A warning printed in workflow run summary and logs --- README.md | 4 ++++ libraries/spell-check/README.md | 8 ++++++++ libraries/spell-check/entrypoint.sh | 2 ++ 3 files changed, 14 insertions(+) diff --git a/README.md b/README.md index a0d0414c..8d60ad39 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,10 @@ action in a Google Sheets spreadsheet. * [libraries/spell-check](./libraries/spell-check) checks the files of your repository for commonly misspelled words. + * **WARNING**: The `arduino/actions/libraries/spell-check` action + contained in this repository is deprecated. The recommended alternative is + [the `codespell-project/actions-codespell` action](https://github.com/codespell-project/actions-codespell). + * [arduino/setup-task](https://github.com/arduino/setup-task) makes [Task](https://taskfile.dev/#/) available to your workflows. diff --git a/libraries/spell-check/README.md b/libraries/spell-check/README.md index 328f3f44..ef2ee41e 100644 --- a/libraries/spell-check/README.md +++ b/libraries/spell-check/README.md @@ -2,6 +2,14 @@ Uses [codespell](https://github.com/codespell-project/codespell) to check files for commonly misspelled words. +## DEPRECATION NOTICE + +**WARNING: the action is unmaintained and unsupported** + +This unmaintained copy is kept only to provide provisional support for existing workflows, but will be removed soon. + +The recommended alternative is [the `codespell-project/actions-codespell` action](https://github.com/codespell-project/actions-codespell) + ## Inputs ### `ignore-words-list` diff --git a/libraries/spell-check/entrypoint.sh b/libraries/spell-check/entrypoint.sh index 8959f437..00dc8dc7 100755 --- a/libraries/spell-check/entrypoint.sh +++ b/libraries/spell-check/entrypoint.sh @@ -3,6 +3,8 @@ readonly IGNORE_WORDS_LIST="$1" readonly SKIP_PATHS="$2" +echo "::warning::This action is deprecated. The recommended alternative is `codespell-project/actions-codespell`." + CODE_SPELL_ARGS=("--skip=${SKIP_PATHS},.git") if test -f "$IGNORE_WORDS_LIST"; then From fc0a2787379ad45300de9a11a421bf03cf1ac95e Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 31 Mar 2022 23:22:23 -0700 Subject: [PATCH 2/2] Switch to standardized spell checking infrastructure The repository previously used the `arduino/actions/libraries/spell-check` action. That action is now deprecated so it is replaced by the standardized spell checking infrastructure for Arduino tooling projects. The excellent codespell tool continues to be used, so there will be no difference in spell checking configuration or results. --- .codespellrc | 9 ++++++ .github/workflows/spell-check-task.yml | 41 ++++++++++++++++++++++++++ .github/workflows/spell-check.yml | 17 ----------- Taskfile.yml | 25 ++++++++++++++++ libraries/spell-check/entrypoint.sh | 2 +- poetry.lock | 22 ++++++++++++++ pyproject.toml | 15 ++++++++++ 7 files changed, 113 insertions(+), 18 deletions(-) create mode 100644 .codespellrc create mode 100644 .github/workflows/spell-check-task.yml delete mode 100644 .github/workflows/spell-check.yml create mode 100644 Taskfile.yml create mode 100644 poetry.lock create mode 100644 pyproject.toml diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..7c2693f9 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,9 @@ +# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check/.codespellrc +# See: https://github.com/codespell-project/codespell#using-a-config-file +[codespell] +# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: +ignore-words-list = afterall,clude +skip = ./.git,./.licenses,__pycache__,node_modules,./go.mod,./go.sum,./package-lock.json,./poetry.lock,./yarn.lock,./libraries/spell-check/test/testdata,./setup-taskfile/package-lock.json +builtin = clear,informal,en-GB_to_en-US +check-filenames = +check-hidden = diff --git a/.github/workflows/spell-check-task.yml b/.github/workflows/spell-check-task.yml new file mode 100644 index 00000000..3529024e --- /dev/null +++ b/.github/workflows/spell-check-task.yml @@ -0,0 +1,41 @@ +# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/spell-check-task.md +name: Spell Check + +env: + # See: https://github.com/actions/setup-python/tree/v2#available-versions-of-python + PYTHON_VERSION: "3.9" + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + pull_request: + schedule: + # Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates. + - cron: "0 8 * * TUE" + workflow_dispatch: + repository_dispatch: + +jobs: + spellcheck: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install Python + uses: actions/setup-python@v3 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install Poetry + run: pip install poetry + + - name: Install Task + uses: arduino/setup-task@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + version: 3.x + + - name: Spell check + run: task general:check-spelling diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml deleted file mode 100644 index e3f91d74..00000000 --- a/.github/workflows/spell-check.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Spell Check - -on: [push, pull_request] - -jobs: - spellcheck: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Spell check - uses: ./libraries/spell-check - with: - ignore-words-list: etc/codespell-ignore-words-list.txt - skip-paths: ./libraries/spell-check/test/testdata,./setup-taskfile/node_modules,./setup-taskfile/package-lock.json diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 00000000..ec99cecd --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,25 @@ +# See: https://taskfile.dev/#/usage +version: "3" + +tasks: + # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml + general:check-spelling: + desc: Check for commonly misspelled words + deps: + - task: poetry:install-deps + cmds: + - poetry run codespell + + # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml + general:correct-spelling: + desc: Correct commonly misspelled words where possible + deps: + - task: poetry:install-deps + cmds: + - poetry run codespell --write-changes + + # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml + poetry:install-deps: + desc: Install dependencies managed by Poetry + cmds: + - poetry install --no-root diff --git a/libraries/spell-check/entrypoint.sh b/libraries/spell-check/entrypoint.sh index 00dc8dc7..2f7cf625 100755 --- a/libraries/spell-check/entrypoint.sh +++ b/libraries/spell-check/entrypoint.sh @@ -3,7 +3,7 @@ readonly IGNORE_WORDS_LIST="$1" readonly SKIP_PATHS="$2" -echo "::warning::This action is deprecated. The recommended alternative is `codespell-project/actions-codespell`." +echo "::warning::This action is deprecated. The recommended alternative is codespell-project/actions-codespell." CODE_SPELL_ARGS=("--skip=${SKIP_PATHS},.git") diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 00000000..bc1cb2a8 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,22 @@ +[[package]] +name = "codespell" +version = "2.1.0" +description = "Codespell" +category = "dev" +optional = false +python-versions = ">=3.5" + +[package.extras] +dev = ["check-manifest", "flake8", "pytest", "pytest-cov", "pytest-dependency"] +hard-encoding-detection = ["chardet"] + +[metadata] +lock-version = "1.1" +python-versions = "^3.9" +content-hash = "9b82f653df8b27353719532dec8326a8882ac694180086bb6c404dbd6863f4f7" + +[metadata.files] +codespell = [ + {file = "codespell-2.1.0-py3-none-any.whl", hash = "sha256:b864c7d917316316ac24272ee992d7937c3519be4569209c5b60035ac5d569b5"}, + {file = "codespell-2.1.0.tar.gz", hash = "sha256:19d3fe5644fef3425777e66f225a8c82d39059dcfe9edb3349a8a2cf48383ee5"}, +] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..c70ea171 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,15 @@ +[tool.poetry] +name = "actions" +version = "0.0.0" +description = "" +authors = ["Your Name "] + +[tool.poetry.dependencies] +python = "^3.9" + +[tool.poetry.dev-dependencies] +codespell = "^2.1.0" + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api"