From 90cbb2bec88cc11144e7fc81b59fb886cf3f8854 Mon Sep 17 00:00:00 2001 From: Sergei Petrosian Date: Fri, 7 Feb 2025 14:08:59 +0100 Subject: [PATCH] ci: Replace woke with codespell woke has been left with Noriko's and all other PRs not being reviewed for years, hence we have been using our fork. Replacing woke with codespell to detect non-inclusive language Codespell provides a built-in dictionary with recommended non-inclusive terms: https://github.com/codespell-project/codespell/blob/main/codespell_lib/data/dictionary_usage.txt Codespell supports using custom dictionaries so we can add to the list if we want. `ignore-multiline-regex` in the `.codespellrc` config allows for disabling codespell for a block of lines: ``` # codespell:ignore-begin ... codespell will not look at this text. # codespell:ignore-end ``` You can ignore words inline by adding a comment like `# codespell:ignore word`. You can ignore files and directories, or words by adding them to config file `.codespellrc`. linux-system-roles do NOT use codespell to check spelling in code. For more information about inclusive naming initiative, see https://inclusivenaming.org/about/ Signed-off-by: Sergei Petrosian --- .codespellrc | 4 +++ .github/workflows/ansible-test.yml | 2 +- .github/workflows/codespell.yml | 30 +++++++++++++++++++ .../detect_non_inclusive_language.yml | 30 +++++++++++++++++++ .github/workflows/tft.yml | 2 +- .github/workflows/woke.yml | 20 ------------- README.md | 2 +- 7 files changed, 67 insertions(+), 23 deletions(-) create mode 100644 .codespellrc create mode 100644 .github/workflows/codespell.yml create mode 100644 .github/workflows/detect_non_inclusive_language.yml delete mode 100644 .github/workflows/woke.yml diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..f7c80cf2 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,4 @@ +[codespell] +builtin = usage +ignore-multiline-regex = codespell:ignore-begin.*codespell:ignore-end +context=0 diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 4dbdaa2d..c9868a28 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -43,6 +43,6 @@ jobs: - name: Run ansible-test uses: ansible-community/ansible-test-gh-action@release/v1 with: - testing-type: sanity # wokeignore:rule=sanity + testing-type: sanity ansible-core-version: stable-2.17 collection-src-directory: ${{ github.workspace }}/.tox/ansible_collections/${{ env.LSR_ROLE2COLL_NAMESPACE }}/${{ env.LSR_ROLE2COLL_NAME }} diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 00000000..693b4c57 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,30 @@ +# Codespell configuration is within .codespellrc +--- +name: Codespell +on: # yamllint disable-line rule:truthy + - pull_request +permissions: + contents: read +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Get variable with regex values + id: regexvar + run: | + curl -L -s -o dictionary_usage.txt https://raw.githubusercontent.com/codespell-project/codespell/refs/heads/main/codespell_lib/data/dictionary_usage.txt + regexvar=$(sed 's/->.*//g' dictionary_usage.txt | sed 's/$/|/' | tr -d '\n' | sed 's/.$//') + rm dictionary_usage.txt + echo "regexvar=$regexvar" >> "$GITHUB_OUTPUT" + + - name: Show errors from codespell as annotation in GitHub Actions + uses: codespell-project/codespell-problem-matcher@v1 + + - name: Codespell + uses: spetrosi/actions-codespell@add-regex-input + with: + regex: ${{ steps.regexvar.outputs.regexvar }} diff --git a/.github/workflows/detect_non_inclusive_language.yml b/.github/workflows/detect_non_inclusive_language.yml new file mode 100644 index 00000000..4f35355a --- /dev/null +++ b/.github/workflows/detect_non_inclusive_language.yml @@ -0,0 +1,30 @@ +# Codespell configuration is within .codespellrc +--- +name: Detect non-inclusive language +on: # yamllint disable-line rule:truthy + - pull_request +permissions: + contents: read +jobs: + codespell: + name: Detect non-inclusive language + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Get variable with regex values + id: regexvar + run: | + curl -L -s -o dictionary_usage.txt https://raw.githubusercontent.com/codespell-project/codespell/refs/heads/main/codespell_lib/data/dictionary_usage.txt + regexvar=$(sed 's/->.*//g' dictionary_usage.txt | sed 's/$/|/' | tr -d '\n' | sed 's/.$//') + rm dictionary_usage.txt + echo "regexvar=$regexvar" >> "$GITHUB_OUTPUT" + + - name: Show errors from codespell as annotation in GitHub Actions + uses: codespell-project/codespell-problem-matcher@v1 + + - name: Detect non-inclusive language with codespell + uses: spetrosi/actions-codespell@add-regex-input + with: + regex: ${{ steps.regexvar.outputs.regexvar }} diff --git a/.github/workflows/tft.yml b/.github/workflows/tft.yml index 03174fa9..d5b94007 100644 --- a/.github/workflows/tft.yml +++ b/.github/workflows/tft.yml @@ -180,7 +180,7 @@ jobs: tf_scope: private api_key: ${{ secrets.TF_API_KEY_RH }} update_pull_request_status: false - tmt_hardware: '{ "memory": ">= ${{ needs.prepare_vars.outputs.memory }} MB" }' + tmt_hardware: '{ "memory": ">= ${{ needs.prepare_vars.outputs.memory }} MB", "network": [{"type": "eth"}, {"type": "eth"}] }' tmt_plan_filter: "tag:general,network" - name: Set final commit status diff --git a/.github/workflows/woke.yml b/.github/workflows/woke.yml deleted file mode 100644 index 4cded0d5..00000000 --- a/.github/workflows/woke.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -# yamllint disable rule:line-length -name: Woke -on: # yamllint disable-line rule:truthy - - pull_request -jobs: - woke: - name: Detect non-inclusive language - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Run lsr-woke-action - # Originally, uses: get-woke/woke-action@v0 - uses: linux-system-roles/lsr-woke-action@main - with: - woke-args: "-c https://raw.githubusercontent.com/linux-system-roles/tox-lsr/main/src/tox_lsr/config_files/woke.yml --count-only-error-for-failure" - # Cause the check to fail on any broke rules - fail-on-error: true diff --git a/README.md b/README.md index 0e4a4258..b1bdc5ae 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # linux-system-roles/network -[![ansible-lint.yml](https://github.com/linux-system-roles/network/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/ansible-lint.yml) [![ansible-test.yml](https://github.com/linux-system-roles/network/actions/workflows/ansible-test.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/ansible-test.yml) [![codeql.yml](https://github.com/linux-system-roles/network/actions/workflows/codeql.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/codeql.yml) [![integration.yml](https://github.com/linux-system-roles/network/actions/workflows/integration.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/integration.yml) [![markdownlint.yml](https://github.com/linux-system-roles/network/actions/workflows/markdownlint.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/markdownlint.yml) [![python-unit-test.yml](https://github.com/linux-system-roles/network/actions/workflows/python-unit-test.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/python-unit-test.yml) [![shellcheck.yml](https://github.com/linux-system-roles/network/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/shellcheck.yml) [![tft.yml](https://github.com/linux-system-roles/network/actions/workflows/tft.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/tft.yml) [![tft_citest_bad.yml](https://github.com/linux-system-roles/network/actions/workflows/tft_citest_bad.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/tft_citest_bad.yml) [![woke.yml](https://github.com/linux-system-roles/network/actions/workflows/woke.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/woke.yml) [![Coverage Status](https://coveralls.io/repos/github/linux-system-roles/network/badge.svg)](https://coveralls.io/github/linux-system-roles/network) [![Code Style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/linux-system-roles/network.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/linux-system-roles/network/context:python) +[![ansible-lint.yml](https://github.com/linux-system-roles/network/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/ansible-lint.yml) [![ansible-test.yml](https://github.com/linux-system-roles/network/actions/workflows/ansible-test.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/ansible-test.yml) [![codeql.yml](https://github.com/linux-system-roles/network/actions/workflows/codeql.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/codeql.yml) [![codespell.yml](https://github.com/linux-system-roles/network/actions/workflows/codespell.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/codespell.yml) [![detect_non_inclusive_language.yml](https://github.com/linux-system-roles/network/actions/workflows/detect_non_inclusive_language.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/detect_non_inclusive_language.yml) [![integration.yml](https://github.com/linux-system-roles/network/actions/workflows/integration.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/integration.yml) [![markdownlint.yml](https://github.com/linux-system-roles/network/actions/workflows/markdownlint.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/markdownlint.yml) [![python-unit-test.yml](https://github.com/linux-system-roles/network/actions/workflows/python-unit-test.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/python-unit-test.yml) [![shellcheck.yml](https://github.com/linux-system-roles/network/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/shellcheck.yml) [![tft.yml](https://github.com/linux-system-roles/network/actions/workflows/tft.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/tft.yml) [![tft_citest_bad.yml](https://github.com/linux-system-roles/network/actions/workflows/tft_citest_bad.yml/badge.svg)](https://github.com/linux-system-roles/network/actions/workflows/tft_citest_bad.yml) [![Coverage Status](https://coveralls.io/repos/github/linux-system-roles/network/badge.svg)](https://coveralls.io/github/linux-system-roles/network) [![Code Style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/linux-system-roles/network.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/linux-system-roles/network/context:python) ## Overview