Skip to content

Commit a908868

Browse files
committed
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.
1 parent 297c8da commit a908868

File tree

5 files changed

+29
-5
lines changed

5 files changed

+29
-5
lines changed

workflow-templates/deploy-cobra-mkdocs-versioned-poetry.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Install the [`deploy-cobra-mkdocs-versioned-poetry.yml`](deploy-cobra-mkdocs-ver
2727
- Install to: repository root (or merge into the existing `Taskfile.yml`).
2828
- [`Taskfile.yml`](assets/check-prettier-formatting-task/Taskfile.yml) - documentation formatting task.
2929
- Merge into `Taskfile.yml`
30+
- [`Taskfile.yml`](assets/poetry-task/Taskfile.yml) - Python package dependency management tasks.
31+
- Merge into `Taskfile.yml`
3032
- [`docsgen`](assets/cobra/docsgen) - command line reference generator.
3133
- Install to: `docsgen/`
3234

workflow-templates/deploy-cobra-mkdocs-versioned-poetry.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ jobs:
8282
- name: Create all generated documentation content
8383
run: task docs:generate
8484

85-
- name: Install Python dependencies
86-
run: poetry install --no-root
85+
- name: Install Dependencies
86+
run: |
87+
task \
88+
poetry:install-deps
8789
8890
- name: Determine versioning parameters
8991
id: determine-versioning

workflow-templates/deploy-mkdocs-poetry.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Install the [`deploy-mkdocs-poetry.yml`](deploy-mkdocs-poetry.yml) GitHub Action
1212

1313
### Assets
1414

15+
- [`Taskfile.yml`](assets/poetry-task/Taskfile.yml) - Python package dependency management tasks.
16+
- Install to: repository root (or merge into the existing `Taskfile.yml`).
1517
- [`mkdocs.yml`](assets/mkdocs/mkdocs.yml) - base MkDocs configuration file.
1618
- Install to: repository root
1719
- [`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).

workflow-templates/deploy-mkdocs-poetry.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- "mkdocs.ya?ml"
1313
- "poetry.lock"
1414
- "pyproject.toml"
15+
- "Taskfile.ya?ml"
1516
- "docs/**"
1617
workflow_dispatch:
1718
repository_dispatch:
@@ -31,11 +32,19 @@ jobs:
3132
with:
3233
python-version-file: pyproject.toml
3334

35+
- name: Install Task
36+
uses: arduino/setup-task@v2
37+
with:
38+
repo-token: ${{ secrets.GITHUB_TOKEN }}
39+
version: 3.x
40+
3441
- name: Install Poetry
3542
run: pip install poetry
3643

3744
- name: Install Dependencies
38-
run: poetry install --no-root
45+
run: |
46+
task \
47+
poetry:install-deps
3948
4049
- name: Deploy website
4150
run: poetry run mkdocs gh-deploy

workflow-templates/deploy-mkdocs-versioned-poetry.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- ".github/workflows/deploy-mkdocs-versioned-poetry.ya?ml"
1414
- "mkdocs.ya?ml"
1515
- "poetry.lock"
16+
- "Taskfile.ya?ml"
1617
- "pyproject.toml"
1718
# Run on branch or tag creation (will be filtered by the publish-determination job).
1819
create:
@@ -58,13 +59,21 @@ jobs:
5859
with:
5960
python-version-file: pyproject.toml
6061

62+
- name: Install Task
63+
uses: arduino/setup-task@v2
64+
with:
65+
repo-token: ${{ secrets.GITHUB_TOKEN }}
66+
version: 3.x
67+
6168
- name: Install Poetry
6269
run: |
6370
python -m pip install --upgrade pip
6471
python -m pip install poetry
6572
66-
- name: Install Python dependencies
67-
run: poetry install --no-root
73+
- name: Install Dependencies
74+
run: |
75+
task \
76+
poetry:install-deps
6877
6978
- name: Determine versioning parameters
7079
id: determine-versioning

0 commit comments

Comments
 (0)