Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 36c2dcb

Browse files
authored
Merge pull request #949 from per1234/check-poetry
Add infrastructure for checking Poetry configuration files
2 parents 3865576 + 786f70b commit 36c2dcb

File tree

5 files changed

+146
-3
lines changed

5 files changed

+146
-3
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-poetry-task.md
2+
name: Check Poetry
3+
4+
on:
5+
create:
6+
push:
7+
paths:
8+
- ".github/workflows/check-poetry-task.ya?ml"
9+
- "go.mod"
10+
- "go.sum"
11+
- "poetry.lock"
12+
- "pyproject.toml"
13+
- "Taskfile.ya?ml"
14+
pull_request:
15+
paths:
16+
- ".github/workflows/check-poetry-task.ya?ml"
17+
- "go.mod"
18+
- "go.sum"
19+
- "poetry.lock"
20+
- "pyproject.toml"
21+
- "Taskfile.ya?ml"
22+
schedule:
23+
# Run periodically to catch breakage caused by external changes.
24+
- cron: "0 11 * * THU"
25+
workflow_dispatch:
26+
repository_dispatch:
27+
28+
jobs:
29+
run-determination:
30+
runs-on: ubuntu-latest
31+
permissions: {}
32+
outputs:
33+
result: ${{ steps.determination.outputs.result }}
34+
steps:
35+
- name: Determine if the rest of the workflow should run
36+
id: determination
37+
run: |
38+
RELEASE_BRANCH_REGEX="^refs/heads/((v[0-9]+)|([0-9]+\.[0-9]+\.x))$"
39+
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
40+
if [[
41+
"${{ github.event_name }}" != "create" ||
42+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
43+
]]; then
44+
# Run the other jobs.
45+
RESULT="true"
46+
else
47+
# There is no need to run the other jobs.
48+
RESULT="false"
49+
fi
50+
51+
echo "result=$RESULT" >>$GITHUB_OUTPUT
52+
53+
validate:
54+
needs: run-determination
55+
if: needs.run-determination.outputs.result == 'true'
56+
runs-on: ubuntu-latest
57+
permissions:
58+
contents: read
59+
60+
steps:
61+
- name: Checkout repository
62+
uses: actions/checkout@v5
63+
64+
- name: Install Go
65+
uses: actions/setup-go@v5
66+
with:
67+
go-version-file: go.mod
68+
69+
- name: Install Python
70+
uses: actions/setup-python@v5
71+
with:
72+
python-version-file: pyproject.toml
73+
74+
- name: Install Task
75+
uses: arduino/setup-task@v2
76+
with:
77+
repo-token: ${{ secrets.GITHUB_TOKEN }}
78+
version: 3.x
79+
80+
- name: Validate configuration
81+
run: |
82+
task \
83+
--silent \
84+
poetry:validate
85+
86+
check-sync:
87+
needs: run-determination
88+
if: needs.run-determination.outputs.result == 'true'
89+
runs-on: ubuntu-latest
90+
permissions:
91+
contents: read
92+
93+
steps:
94+
- name: Checkout repository
95+
uses: actions/checkout@v5
96+
97+
- name: Install Python
98+
uses: actions/setup-python@v5
99+
with:
100+
python-version-file: pyproject.toml
101+
102+
- name: Install Task
103+
uses: arduino/setup-task@v2
104+
with:
105+
repo-token: ${{ secrets.GITHUB_TOKEN }}
106+
version: 3.x
107+
108+
- name: Sync lockfile
109+
run: |
110+
task \
111+
--silent \
112+
poetry:sync
113+
114+
- name: Check if lockfile was out of sync
115+
run: |
116+
git diff \
117+
--color \
118+
--exit-code \
119+
poetry.lock

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
[![Publish Tester Build status](https://github.com/arduino/arduino-lint/actions/workflows/publish-go-tester-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/publish-go-tester-task.yml)
99
[![Publish Nightly Build status](https://github.com/arduino/arduino-lint/actions/workflows/publish-go-nightly-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/publish-go-nightly-task.yml)
1010
[![Check npm status](https://github.com/arduino/arduino-lint/actions/workflows/check-npm-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-npm-task.yml)
11+
[![Check Poetry status](https://github.com/arduino/arduino-lint/actions/workflows/check-poetry-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-poetry-task.yml)
1112
[![Check Python status](https://github.com/arduino/arduino-lint/actions/workflows/check-python-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-python-task.yml)
1213
[![Check Markdown status](https://github.com/arduino/arduino-lint/actions/workflows/check-markdown-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-markdown-task.yml)
1314
[![Spell Check status](https://github.com/arduino/arduino-lint/actions/workflows/spell-check-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/spell-check-task.yml)

‎Taskfile.yml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ tasks:
104104
GO_MODULE_PATH: ./ruledocsgen
105105
- task: markdown:lint
106106
- task: markdown:check-links
107+
- task: poetry:validate
107108
- task: python:lint
108109
- task: shell:check
109110
vars:
@@ -142,6 +143,7 @@ tasks:
142143
GO_MODULE_PATH: ./ruledocsgen
143144
- task: markdown:fix
144145
- task: npm:fix-config
146+
- task: poetry:sync
145147
- task: python:format
146148
- task: shell:format
147149
vars:
@@ -664,6 +666,16 @@ tasks:
664666
poetry install \
665667
{{if .POETRY_GROUPS}} --only {{.POETRY_GROUPS}} {{end}}
666668
669+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-poetry-task/Taskfile.yml
670+
poetry:sync:
671+
desc: Sync Poetry lockfile
672+
deps:
673+
- task: poetry:install
674+
cmds:
675+
- |
676+
poetry lock \
677+
--no-cache
678+
667679
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
668680
poetry:update-deps:
669681
desc: Update all dependencies managed by Poetry to their newest versions
@@ -672,6 +684,17 @@ tasks:
672684
cmds:
673685
- poetry update
674686

687+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-poetry-task/Taskfile.yml
688+
poetry:validate:
689+
desc: Validate Poetry configuration
690+
deps:
691+
- task: poetry:install
692+
cmds:
693+
- |
694+
poetry check \
695+
--lock \
696+
--strict
697+
675698
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-python-task/Taskfile.yml
676699
python:format:
677700
desc: Format Python files

‎poetry.lock‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ poetry = "2.1.4"
1414
[tool.poetry.dependencies]
1515
python = "~3.9"
1616

17-
[tool.poetry.dev-dependencies]
17+
[tool.poetry.group.dev.dependencies]
1818
black = "^25.1"
1919
codespell = "^2.4.1"
2020
flake8 = "^7.3.0"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /