Skip to content

Use task to install Python package dependencies in website deployment workflows #602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions workflow-templates/check-go-task.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
4 changes: 0 additions & 4 deletions workflow-templates/check-python-task.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Expand Down
4 changes: 2 additions & 2 deletions workflow-templates/deploy-cobra-mkdocs-versioned-poetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/`

Expand All @@ -38,8 +40,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.
Expand Down
6 changes: 4 additions & 2 deletions workflow-templates/deploy-cobra-mkdocs-versioned-poetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions workflow-templates/deploy-mkdocs-poetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
11 changes: 10 additions & 1 deletion workflow-templates/deploy-mkdocs-poetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
- "mkdocs.ya?ml"
- "poetry.lock"
- "pyproject.toml"
- "Taskfile.ya?ml"
- "docs/**"
workflow_dispatch:
repository_dispatch:
Expand All @@ -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
13 changes: 11 additions & 2 deletions workflow-templates/deploy-mkdocs-versioned-poetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion workflow-templates/release-go-crosscompile-task.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 0 additions & 6 deletions workflow-templates/test-go-integration-task.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 0 additions & 2 deletions workflow-templates/test-go-task.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
4 changes: 0 additions & 4 deletions workflow-templates/test-python-poetry-task.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading