From 43fd09e6530b0b208556a4503b19a328e42e61e0 Mon Sep 17 00:00:00 2001 From: Randolph Sapp Date: Fri, 16 May 2025 15:14:24 -0500 Subject: [PATCH 1/3] ci(docker): add vale to the main docker image Add vale to the main image so we can reuse this container for vale's ci workflow to save some time. Signed-off-by: Randolph Sapp --- docker/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index d3e046b10..11701d20d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -13,6 +13,7 @@ RUN apk add --no-cache \ ripgrep \ shadow \ su-exec \ + vale \ zip \ && echo "**** create abc user and make our folders ****" \ && useradd -u 1000 -U -d /config -s /bin/false abc \ From 778feb703b0e941d72f870a1190b176d15fe0b26 Mon Sep 17 00:00:00 2001 From: Randolph Sapp Date: Fri, 16 May 2025 11:49:49 -0500 Subject: [PATCH 2/3] ci(vale): switch style dir, add vocab Use the recommended config directories for the official workflow [1]. Add a vocab accept list for some common terms I see currently being flagged. This will need to be extended. [1] https://github.com/errata-ai/vale-action?tab=readme-ov-file#repository-structure Signed-off-by: Randolph Sapp --- .../config/vocabularies/PSDK/accept.txt | 24 +++++++++++++++++++ .../config/vocabularies/PSDK/reject.txt | 0 .gitignore | 8 ++++++- .vale.ini | 5 ++++ CONTRIBUTING.md | 16 +++++++++++++ 5 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .github/styles/config/vocabularies/PSDK/accept.txt create mode 100644 .github/styles/config/vocabularies/PSDK/reject.txt diff --git a/.github/styles/config/vocabularies/PSDK/accept.txt b/.github/styles/config/vocabularies/PSDK/accept.txt new file mode 100644 index 000000000..9a712c7bf --- /dev/null +++ b/.github/styles/config/vocabularies/PSDK/accept.txt @@ -0,0 +1,24 @@ +BeagleBone +Broadcom +GStreamer +Jacinto +Khronos +OpenCL +OpenGL +OpenVX +PVRCarbon +PVRTune +Sitara +UniFlash +Vulkan +Yocto +Zink +[Cc]odec +[Dd]unfell +[Ee]thernet +[Ff]ramebuffer +[Kk]irkstone +[Mm]ulticast +[Ss]carthgap +[Tt]oolchain +balenaEtcher diff --git a/.github/styles/config/vocabularies/PSDK/reject.txt b/.github/styles/config/vocabularies/PSDK/reject.txt new file mode 100644 index 000000000..e69de29bb diff --git a/.gitignore b/.gitignore index 462b73df7..761bc0cea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,10 @@ +# python artifacts *.swp *.pyc + +# build artifacts build/ -.vale/ + +# vale configs and intermediary data +.github/styles/* +!.github/styles/config diff --git a/.vale.ini b/.vale.ini index 8ee6fb3b2..d37b4a017 100644 --- a/.vale.ini +++ b/.vale.ini @@ -1,6 +1,11 @@ +StylesPath = .github/styles MinAlertLevel = suggestion Packages = RedHat +Vocab = PSDK + [*.{md,rst}] BasedOnStyles = RedHat +RedHat.PascalCamelCase = NO +RedHat.GitLinks = NO diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ad00468d8..f63fbf011 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -180,6 +180,22 @@ Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com All other files inherit the generic CC-BY-SA-4.0 license and do not require an explicit license / copyright notice. +## Vale grammar, spelling and prose checking + +This project currently uses [Vale](https://vale.sh/) for grammar spelling and +prose checking. We operate on a loose version of [Red Hat's documentation style +guidelines](https://github.com/redhat-documentation/vale-at-red-hat). + +If there are words it detects as misspellings, add those words to the custom +vocabulary entry in +[accept.txt](.github/styles/config/vocabularies/PSDK/accept.txt). If there are +words you see that you think do not constitute usage here, add those words to +the [reject.txt](.github/styles/config/vocabularies/PSDK/reject.txt). Ensure the +contents of these files are alphabetically sorted after any modifications. + +Information about the formatting of these files is available +[upstream](https://vale.sh/docs/keys/vocab#file-format). + ## Fighting workflows The workflows are here to help, but occasionally they can raise false positives. From 6dff3215bf866a26101e0b8d01ddf3b067e202a9 Mon Sep 17 00:00:00 2001 From: Randolph Sapp Date: Fri, 16 May 2025 14:17:48 -0500 Subject: [PATCH 3/3] ci(vale): add a pr check workflow for vale Add a pull request driven workflow for vale. This is based on the upstream action documentation [1], but limit it to changed files only to keep feedback snappy. This currently uses a fork I made of the upstream action that's capable of using the locally installed version of vale. This allows us to use our container as is, which is faster than reinstalling tools and makes issues more easily reproducible. This is only required until the upstream PR is accepted [2]. This does not enable this action as a blocking check just yet. There is still an upstream bug that makes all feedback throw a failure, which is a little too aggressive right now. Still need to tune things a bit. [1] https://github.com/errata-ai/vale-action [2] https://github.com/errata-ai/vale-action/pull/149 Signed-off-by: Randolph Sapp --- .github/workflows/vale.yml | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/vale.yml diff --git a/.github/workflows/vale.yml b/.github/workflows/vale.yml new file mode 100644 index 000000000..ef4678739 --- /dev/null +++ b/.github/workflows/vale.yml @@ -0,0 +1,40 @@ +--- +name: "vale" + +on: [pull_request] + +defaults: + run: + shell: bash + +jobs: + vale: + name: vale + runs-on: ubuntu-latest + container: + image: ghcr.io/staticrocket/processor-sdk-doc:latest + options: --entrypoint /bin/bash + + steps: + - name: Prepare GitHub workdir + run: | + mkdir -p /github/home/ + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v46 + with: + files: | + **.rst + **.md + + - name: Run vale checks on modified files + uses: StaticRocket/vale-action@d377866f2e3305ae80ef6ce6516370a7ec4ea55a + if: steps.changed-files.outputs.any_changed == 'true' + with: + fail_on_error: false # to be changed when upstream addresses 84 + files: ${{ steps.changed-files.outputs.all_changed_files }} + version: none