From 297c8dae87cd575454083973592cb224d2e25f33 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 18 Jun 2025 11:11:10 -0700 Subject: [PATCH 1/2] Remove obsolete instructions re: setting framework versions in workflows Some GitHub Actions workflows must install the appropriate version of Go and Python. Previously the version was configured in the workflow, and so the template installation documentation included instructions for setting the project's version of the framework in the workflow. A new approach is now used to get Go and Python versioning information from a single source in the configuration file, so there is no longer any version configuration in the workflow, rendering those instructions obsolete. The instructions were not removed at the time the workflows were migrated to the new system. --- workflow-templates/check-go-task.md | 2 -- workflow-templates/check-python-task.md | 4 ---- workflow-templates/deploy-cobra-mkdocs-versioned-poetry.md | 2 -- workflow-templates/release-go-crosscompile-task.md | 1 - workflow-templates/test-go-integration-task.md | 6 ------ workflow-templates/test-go-task.md | 2 -- workflow-templates/test-python-poetry-task.md | 4 ---- 7 files changed, 21 deletions(-) diff --git a/workflow-templates/check-go-task.md b/workflow-templates/check-go-task.md index d59847f8..86eed575 100644 --- a/workflow-templates/check-go-task.md +++ b/workflow-templates/check-go-task.md @@ -19,8 +19,6 @@ Install the [`check-go-task.yml`](check-go-task.yml) GitHub Actions workflow to ### Configuration -Configure the version of Go used for development of the project in the `env.GO_VERSION` field of `check-go-task.yml`. - If the project contains Go modules in paths other than the root of the repository, add their paths to the [job matrices](https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix) of `check-go-task.yml` at: - `jobs.check-errors.strategy.matrix.module[].path` diff --git a/workflow-templates/check-python-task.md b/workflow-templates/check-python-task.md index f29ddbff..eebbb34c 100644 --- a/workflow-templates/check-python-task.md +++ b/workflow-templates/check-python-task.md @@ -45,10 +45,6 @@ Commit the resulting `pyproject.toml` and `poetry.lock` files. ### Configuration -#### Workflow - -Set the version of Python used by the project in the `env.PYTHON_VERSION` field of `check-python-task.yml`. - #### black Add the following to `pyproject.toml`: diff --git a/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.md b/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.md index c6bd578f..36930ce1 100644 --- a/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.md +++ b/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.md @@ -38,8 +38,6 @@ See the ["Deploy Website" workflow (versioned, MkDocs, Poetry) documentation](de #### Workflow -Configure the version of Go used for development of the project in the `env.GO_VERSION` field of `deploy-cobra-mkdocs-versioned-poetry.yml`. - #### Taskfile Set the `PROJECT_NAME` variable to the project name. diff --git a/workflow-templates/release-go-crosscompile-task.md b/workflow-templates/release-go-crosscompile-task.md index b4d32263..39fa61b6 100644 --- a/workflow-templates/release-go-crosscompile-task.md +++ b/workflow-templates/release-go-crosscompile-task.md @@ -35,7 +35,6 @@ The following project-specific variables must be set/configured in `release-go-c - `PROJECT_NAME` - `AWS_PLUGIN_TARGET` -- `GO_VERSION`: version of Go used for development of the project, use at least [GO 1.16 to be able to use 64-bit ARM architecture on macOS](https://tip.golang.org/doc/go1.16#ports) #### AWS IAM Role diff --git a/workflow-templates/test-go-integration-task.md b/workflow-templates/test-go-integration-task.md index b2b71bad..f8103f69 100644 --- a/workflow-templates/test-go-integration-task.md +++ b/workflow-templates/test-go-integration-task.md @@ -49,12 +49,6 @@ Commit the resulting `pyproject.toml` and `poetry.lock` files. ### Configuration -#### Workflow - -Configure the version of Go used for development of the project in the `env.GO_VERSION` field of `test-go-integration-task.yml`. - -Configure the version of Python used for development of the project in the `env.PYTHON_VERSION` field of `test-go-integration-task.yml`. - #### Test helpers Define the project's executable filename in the `executable_path` variable in `test_all.py`. diff --git a/workflow-templates/test-go-task.md b/workflow-templates/test-go-task.md index 48ff993f..48154663 100644 --- a/workflow-templates/test-go-task.md +++ b/workflow-templates/test-go-task.md @@ -21,8 +21,6 @@ Install the [`test-go-task.yml`](test-go-task.yml) GitHub Actions workflow to `. #### Workflow -Configure the version of Go used for development of the project in the `env.GO_VERSION` field of `test-go-task.yml`. - If the project contains Go modules in paths other than the root of the repository, add their paths to the [job matrix](https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix) in `check-go-task.yml` at `jobs.test.strategy.matrix.module[].path` and the [Codecov flag](https://docs.codecov.com/docs/flags) to group their data under at `jobs.test.strategy.matrix.module[].codecov-flags` Replace `TODO_REPO_OWNER/TODO_REPO_NAME` with the repository's name (e.g., `arduino/arduino-cli`) in the `codecov/codecov-action` action's `fail_ci_if_error` input in `test-go-task.yml`. diff --git a/workflow-templates/test-python-poetry-task.md b/workflow-templates/test-python-poetry-task.md index 7d802178..5a5c97ba 100644 --- a/workflow-templates/test-python-poetry-task.md +++ b/workflow-templates/test-python-poetry-task.md @@ -45,10 +45,6 @@ poetry add --dev "pytest@^8.4.1" Commit the resulting `pyproject.toml` and `poetry.lock` files. -### Configuration - -Configure the version of Python used for development of the project in the `env.PYTHON_VERSION` field of `test-go-integration-task.yml`. - ### Readme badge Markdown badge: From a908868fe2132ea20afc6d2cf0658f9693d95d1e Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 18 Jun 2025 11:30:16 -0700 Subject: [PATCH 2/2] Use task to install Python package dependencies in website deployment workflows The "Task" task runner is used to perform common development and maintenance operations in Arduino tooling projects. One such operation is the installation of Python package dependencies using Poetry. The project website deployment workflows rely on Python packages, and so contain a step to install them. Previously, this was done by invoking the Poetry command directly from the workflow. That is problematic because it means multiple copies of the command must be maintained, and the maintainer might easily overlook the need to do so for these workflows since we expect there to be only one instance of the command. The workflows are hereby changed to use the standardized approach to installing Python package dependencies. --- .../deploy-cobra-mkdocs-versioned-poetry.md | 2 ++ .../deploy-cobra-mkdocs-versioned-poetry.yml | 6 ++++-- workflow-templates/deploy-mkdocs-poetry.md | 2 ++ workflow-templates/deploy-mkdocs-poetry.yml | 11 ++++++++++- .../deploy-mkdocs-versioned-poetry.yml | 13 +++++++++++-- 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.md b/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.md index 36930ce1..0a37ace5 100644 --- a/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.md +++ b/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.md @@ -27,6 +27,8 @@ Install the [`deploy-cobra-mkdocs-versioned-poetry.yml`](deploy-cobra-mkdocs-ver - Install to: repository root (or merge into the existing `Taskfile.yml`). - [`Taskfile.yml`](assets/check-prettier-formatting-task/Taskfile.yml) - documentation formatting task. - Merge into `Taskfile.yml` +- [`Taskfile.yml`](assets/poetry-task/Taskfile.yml) - Python package dependency management tasks. + - Merge into `Taskfile.yml` - [`docsgen`](assets/cobra/docsgen) - command line reference generator. - Install to: `docsgen/` diff --git a/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.yml b/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.yml index 5e024b08..611c4b9b 100644 --- a/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.yml +++ b/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.yml @@ -82,8 +82,10 @@ jobs: - name: Create all generated documentation content run: task docs:generate - - name: Install Python dependencies - run: poetry install --no-root + - name: Install Dependencies + run: | + task \ + poetry:install-deps - name: Determine versioning parameters id: determine-versioning diff --git a/workflow-templates/deploy-mkdocs-poetry.md b/workflow-templates/deploy-mkdocs-poetry.md index df38903a..715abb87 100644 --- a/workflow-templates/deploy-mkdocs-poetry.md +++ b/workflow-templates/deploy-mkdocs-poetry.md @@ -12,6 +12,8 @@ Install the [`deploy-mkdocs-poetry.yml`](deploy-mkdocs-poetry.yml) GitHub Action ### Assets +- [`Taskfile.yml`](assets/poetry-task/Taskfile.yml) - Python package dependency management tasks. + - Install to: repository root (or merge into the existing `Taskfile.yml`). - [`mkdocs.yml`](assets/mkdocs/mkdocs.yml) - base MkDocs configuration file. - Install to: repository root - [`icon_mac_light.png`](assets/mkdocs/icon_mac_light.png) - Arduino logo for the website. **NOTE**: only for use in official Arduino projects. Community projects should use [the Community Logo](https://www.arduino.cc/en/Trademark/CommunityLogo). diff --git a/workflow-templates/deploy-mkdocs-poetry.yml b/workflow-templates/deploy-mkdocs-poetry.yml index 1c691c18..6dbec38b 100644 --- a/workflow-templates/deploy-mkdocs-poetry.yml +++ b/workflow-templates/deploy-mkdocs-poetry.yml @@ -12,6 +12,7 @@ on: - "mkdocs.ya?ml" - "poetry.lock" - "pyproject.toml" + - "Taskfile.ya?ml" - "docs/**" workflow_dispatch: repository_dispatch: @@ -31,11 +32,19 @@ jobs: with: python-version-file: pyproject.toml + - name: Install Task + uses: arduino/setup-task@v2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + version: 3.x + - name: Install Poetry run: pip install poetry - name: Install Dependencies - run: poetry install --no-root + run: | + task \ + poetry:install-deps - name: Deploy website run: poetry run mkdocs gh-deploy diff --git a/workflow-templates/deploy-mkdocs-versioned-poetry.yml b/workflow-templates/deploy-mkdocs-versioned-poetry.yml index 9ff19787..95332463 100644 --- a/workflow-templates/deploy-mkdocs-versioned-poetry.yml +++ b/workflow-templates/deploy-mkdocs-versioned-poetry.yml @@ -13,6 +13,7 @@ on: - ".github/workflows/deploy-mkdocs-versioned-poetry.ya?ml" - "mkdocs.ya?ml" - "poetry.lock" + - "Taskfile.ya?ml" - "pyproject.toml" # Run on branch or tag creation (will be filtered by the publish-determination job). create: @@ -58,13 +59,21 @@ jobs: with: python-version-file: pyproject.toml + - name: Install Task + uses: arduino/setup-task@v2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + version: 3.x + - name: Install Poetry run: | python -m pip install --upgrade pip python -m pip install poetry - - name: Install Python dependencies - run: poetry install --no-root + - name: Install Dependencies + run: | + task \ + poetry:install-deps - name: Determine versioning parameters id: determine-versioning