Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/check-certificates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ jobs:
)"
fi

DAYS_BEFORE_EXPIRATION="$(
(($(date --utc --date="$EXPIRATION_DATE" +%s) - $(date --utc +%s)) / 60 / 60 / 24)
)"
DAYS_BEFORE_EXPIRATION="$((
($(date --utc --date="$EXPIRATION_DATE" +%s) - $(date --utc +%s)) / 60 / 60 / 24
))"

# Display the expiration information in the log.
echo "Certificate expiration date: $EXPIRATION_DATE"
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/check-npm-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,44 @@ jobs:
--color \
--exit-code \
"${{ matrix.project.path }}/package-lock.json"

check-config:
name: check-config (${{ matrix.project.path }})
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

strategy:
fail-fast: false
matrix:
project:
- path: .

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: "${{ matrix.project.path }}/package.json"

- name: Install Task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Fix problems in npm configuration file
run: |
task npm:fix-config \
PROJECT_PATH="${{ matrix.project.path }}"

- name: Check if fixes are needed in npm configuration file
run: |
git diff \
--color \
--exit-code \
"${{ matrix.project.path }}/.npmrc"
3 changes: 3 additions & 0 deletions .github/workflows/check-prettier-formatting-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
- "Taskfile.ya?ml"
- "**/.prettierignore"
- "**/.prettierrc*"
# Prettier-covered file patterns are defined by:
# https://github.com/github-linguist/linguist/blob/main/lib/linguist/languages.yml
#
# CSS
- "**.css"
- "**.wxss"
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/check-shell-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ jobs:
linters: gcc
# Due to a quirk of the "liskin/gh-problem-matcher-wrap" action, the entire command must be on a single line
# (instead of being broken into multiple lines for readability).
run: |
task --silent shell:check SCRIPT_PATH="${{ matrix.script }}" SHELLCHECK_FORMAT=${{ matrix.configuration.format }}
run: task --silent shell:check SCRIPT_PATH="${{ matrix.script }}" SHELLCHECK_FORMAT=${{ matrix.configuration.format }}

formatting:
name: formatting (${{ matrix.script }})
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/deploy-cobra-mkdocs-versioned-poetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ jobs:
run: task docs:generate

- name: Install Dependencies
run: task poetry:install-deps
run: |
task poetry:install-deps \
POETRY_GROUPS=dev

- name: Determine versioning parameters
id: determine-versioning
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/sync-labels-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ jobs:
- name: Pass configuration files to next job via workflow artifact
uses: actions/upload-artifact@v4
with:
path: |
*.yaml
*.yml
path: ${{ matrix.filename }}
if-no-files-found: error
name: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}${{ matrix.filename }}

Expand Down
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# See: https://docs.npmjs.com/cli/configuring-npm/npmrc

engine-strict = true
engine-strict=true
90 changes: 57 additions & 33 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ vars:
|| \
echo '"ERROR: Unable to discover Go packages"' \
)
# Last version of ajv-cli with support for the JSON schema "Draft 4" specification
SCHEMA_DRAFT_4_AJV_CLI_VERSION: 3.3.0
# build vars
COMMIT:
sh: |
Expand Down Expand Up @@ -142,6 +140,7 @@ tasks:
vars:
GO_MODULE_PATH: ./ruledocsgen
- task: markdown:fix
- task: npm:fix-config
- task: python:format
- task: shell:format
vars:
Expand Down Expand Up @@ -180,6 +179,7 @@ tasks:
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/deploy-cobra-mkdocs-versioned-poetry/Taskfile.yml
docs:generate:
desc: Create all generated documentation content
run: when_changed
deps:
- task: go:cli-docs
- task: go:rule-docs
Expand Down Expand Up @@ -234,6 +234,8 @@ tasks:
desc: Check for commonly misspelled words
deps:
- task: poetry:install-deps
vars:
POETRY_GROUPS: dev
cmds:
- poetry run codespell

Expand All @@ -242,6 +244,8 @@ tasks:
desc: Correct commonly misspelled words where possible
deps:
- task: poetry:install-deps
vars:
POETRY_GROUPS: dev
cmds:
- |
poetry run \
Expand Down Expand Up @@ -378,6 +382,8 @@ tasks:
- task: go:build
- task: go:rule-docs:build
- task: poetry:install-deps
vars:
POETRY_GROUPS: dev
cmds:
- |
poetry run \
Expand Down Expand Up @@ -477,12 +483,26 @@ tasks:
markdownlint-cli \
"**/*.md"

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-npm-task/Taskfile.yml
npm:fix-config:
desc: |
Fix problems with the npm configuration file.
Environment variable parameters:
- PROJECT_PATH: Path of the npm-managed project (default: {{.DEFAULT_NPM_PROJECT_PATH}}).
dir: "{{default .DEFAULT_NPM_PROJECT_PATH .PROJECT_PATH}}"
cmds:
- |
npm config \
--location project \
fix

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/npm-task/Taskfile.yml
npm:install-deps:
desc: |
Install dependencies managed by npm.
Environment variable parameters:
- PROJECT_PATH: Path of the npm-managed project (default: {{.DEFAULT_NPM_PROJECT_PATH}}).
run: when_changed
dir: |
"{{default .DEFAULT_NPM_PROJECT_PATH .PROJECT_PATH}}"
cmds:
Expand All @@ -494,6 +514,8 @@ tasks:
Validate npm configuration files against their JSON schema.
Environment variable parameters:
- PROJECT_PATH: Path of the npm-managed project (default: {{.DEFAULT_NPM_PROJECT_PATH}}).
deps:
- task: npm:install-deps
vars:
# Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/package.json
SCHEMA_URL: https://json.schemastore.org/package.json
Expand Down Expand Up @@ -537,10 +559,6 @@ tasks:
sh: task utility:mktemp-file TEMPLATE="stylelintrc-schema-XXXXXXXXXX.json"
INSTANCE_PATH: >-
{{default .DEFAULT_NPM_PROJECT_PATH .PROJECT_PATH}}/package.json
PROJECT_FOLDER:
sh: pwd
WORKING_FOLDER:
sh: task utility:mktemp-folder TEMPLATE="dependabot-validate-XXXXXXXXXX"
cmds:
- wget --quiet --output-document="{{.SCHEMA_PATH}}" {{.SCHEMA_URL}}
- wget --quiet --output-document="{{.AVA_SCHEMA_PATH}}" {{.AVA_SCHEMA_URL}}
Expand All @@ -553,20 +571,23 @@ tasks:
- wget --quiet --output-document="{{.SEMANTIC_RELEASE_SCHEMA_PATH}}" {{.SEMANTIC_RELEASE_SCHEMA_URL}}
- wget --quiet --output-document="{{.STYLELINTRC_SCHEMA_PATH}}" {{.STYLELINTRC_SCHEMA_URL}}
- |
cd "{{.WORKING_FOLDER}}" # Workaround for https://github.com/npm/cli/issues/3210
npx ajv-cli@{{.SCHEMA_DRAFT_4_AJV_CLI_VERSION}} validate \
--all-errors \
-s "{{.SCHEMA_PATH}}" \
-r "{{.AVA_SCHEMA_PATH}}" \
-r "{{.BASE_SCHEMA_PATH}}" \
-r "{{.ESLINTRC_SCHEMA_PATH}}" \
-r "{{.JSCPD_SCHEMA_PATH}}" \
-r "{{.NPM_BADGES_SCHEMA_PATH}}" \
-r "{{.PARTIAL_ESLINT_PLUGINS_PATH}}" \
-r "{{.PRETTIERRC_SCHEMA_PATH}}" \
-r "{{.SEMANTIC_RELEASE_SCHEMA_PATH}}" \
-r "{{.STYLELINTRC_SCHEMA_PATH}}" \
-d "{{.PROJECT_FOLDER}}/{{.INSTANCE_PATH}}"
npx \
--package=ajv-cli \
--package=ajv-formats \
ajv validate \
--all-errors \
--strict=false \
-s "{{.SCHEMA_PATH}}" \
-r "{{.AVA_SCHEMA_PATH}}" \
-r "{{.BASE_SCHEMA_PATH}}" \
-r "{{.ESLINTRC_SCHEMA_PATH}}" \
-r "{{.JSCPD_SCHEMA_PATH}}" \
-r "{{.NPM_BADGES_SCHEMA_PATH}}" \
-r "{{.PARTIAL_ESLINT_PLUGINS_PATH}}" \
-r "{{.PRETTIERRC_SCHEMA_PATH}}" \
-r "{{.SEMANTIC_RELEASE_SCHEMA_PATH}}" \
-r "{{.STYLELINTRC_SCHEMA_PATH}}" \
-d "{{.INSTANCE_PATH}}"

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
poetry:install:
Expand Down Expand Up @@ -621,11 +642,17 @@ tasks:

# 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
desc: |
Install dependencies managed by Poetry.
Environment variable parameters:
- POETRY_GROUPS: Poetry dependency groups to install (default: install all dependencies).
run: when_changed
deps:
- task: poetry:install
cmds:
- poetry install --no-root
- |
poetry install \
{{if .POETRY_GROUPS}} --only {{.POETRY_GROUPS}} {{end}}

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
poetry:update-deps:
Expand All @@ -640,6 +667,8 @@ tasks:
desc: Format Python files
deps:
- task: poetry:install-deps
vars:
POETRY_GROUPS: dev
cmds:
- |
poetry run \
Expand All @@ -651,6 +680,8 @@ tasks:
desc: Lint Python code
deps:
- task: poetry:install-deps
vars:
POETRY_GROUPS: dev
cmds:
- |
poetry run \
Expand Down Expand Up @@ -730,17 +761,6 @@ tasks:
vars:
RAW_PATH: "{{.RAW_PATH}}"

# Make a temporary folder named according to the passed TEMPLATE variable and print the path passed to stdout
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/windows-task/Taskfile.yml
utility:mktemp-folder:
vars:
RAW_PATH:
sh: mktemp --directory --tmpdir "{{.TEMPLATE}}"
cmds:
- task: utility:normalize-path
vars:
RAW_PATH: "{{.RAW_PATH}}"

# Print a normalized version of the path to stdout.
# Environment variable parameters:
# - RAW_PATH: the path to be normalized.
Expand Down Expand Up @@ -769,6 +789,8 @@ tasks:
deps:
- task: docs:generate
- task: poetry:install-deps
vars:
POETRY_GROUPS: dev
cmds:
- |
poetry run \
Expand All @@ -781,6 +803,8 @@ tasks:
deps:
- task: docs:generate
- task: poetry:install-deps
vars:
POETRY_GROUPS: dev
cmds:
- |
poetry run \
Expand Down
Loading
Loading