Skip to content

Commit 02431da

Browse files
authored
Merge pull request #221 from per1234/check-python
Sync Python checking CI workflow with template
2 parents 88e0a87 + 9cbc88e commit 02431da

File tree

7 files changed

+308
-304
lines changed

7 files changed

+308
-304
lines changed

Diff for: .flake8

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-python/.flake8
2+
# See: https://flake8.pycqa.org/en/latest/user/configuration.html
3+
# The code style defined in this file is the official standardized style to be used in all Arduino tooling projects and
4+
# should not be modified.
5+
16
[flake8]
27
doctests = True
3-
ignore =
4-
# W503 and W504 are mutually exclusive, so one or the other must be ignored.
5-
# PEP 8 recommends line break before, so we keep W504.
6-
W503
8+
# W503 and W504 are mutually exclusive. PEP 8 recommends line break before.
9+
ignore = W503
710
max-complexity = 10
811
max-line-length = 120
912
select = E,W,F,C,N

Diff for: .github/workflows/check-python-task.yml

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Check Python
2+
3+
env:
4+
# See: https://github.com/actions/setup-python/tree/v2#available-versions-of-python
5+
PYTHON_VERSION: "3.8"
6+
7+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
8+
on:
9+
push:
10+
paths:
11+
- ".github/workflows/check-python-task.ya?ml"
12+
- "**/.flake8"
13+
- "**/poetry.lock"
14+
- "**/pyproject.toml"
15+
- "**/setup.cfg"
16+
- "Taskfile.ya?ml"
17+
- "**/tox.ini"
18+
- "**.py"
19+
pull_request:
20+
paths:
21+
- ".github/workflows/check-python-task.ya?ml"
22+
- "**/.flake8"
23+
- "**/poetry.lock"
24+
- "**/pyproject.toml"
25+
- "**/setup.cfg"
26+
- "Taskfile.ya?ml"
27+
- "**/tox.ini"
28+
- "**.py"
29+
workflow_dispatch:
30+
repository_dispatch:
31+
32+
jobs:
33+
lint:
34+
runs-on: ubuntu-latest
35+
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v2
39+
40+
- name: Install Python
41+
uses: actions/setup-python@v2
42+
with:
43+
python-version: ${{ env.PYTHON_VERSION }}
44+
45+
- name: Install Poetry
46+
run: pip install poetry
47+
48+
- name: Install Task
49+
uses: arduino/setup-task@v1
50+
with:
51+
repo-token: ${{ secrets.GITHUB_TOKEN }}
52+
version: 3.x
53+
54+
- name: Run flake8
55+
uses: liskin/gh-problem-matcher-wrap@v1
56+
with:
57+
linters: flake8
58+
run: task python:lint
59+
60+
formatting:
61+
runs-on: ubuntu-latest
62+
63+
steps:
64+
- name: Checkout repository
65+
uses: actions/checkout@v2
66+
67+
- name: Install Python
68+
uses: actions/setup-python@v2
69+
with:
70+
python-version: ${{ env.PYTHON_VERSION }}
71+
72+
- name: Install Poetry
73+
run: pip install poetry
74+
75+
- name: Install Task
76+
uses: arduino/setup-task@v1
77+
with:
78+
repo-token: ${{ secrets.GITHUB_TOKEN }}
79+
version: 3.x
80+
81+
- name: Format Python code
82+
run: task python:format
83+
84+
- name: Check formatting
85+
run: git diff --color --exit-code

Diff for: .github/workflows/lint-python.yml

-40
This file was deleted.

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Tests Status](https://github.com/arduino/arduino-lint/workflows/Run%20tests/badge.svg)](https://github.com/arduino/arduino-lint/actions?workflow=Run+tests)
44
[![Check Go status](https://github.com/arduino/arduino-lint/actions/workflows/check-go-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-go-task.yml)
55
[![Nightly Status](https://github.com/arduino/arduino-lint/workflows/Nightly%20build/badge.svg)](https://github.com/arduino/arduino-lint/actions?workflow=Nightly+build)
6+
[![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)
67
[![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)
78
[![Docs Status](https://github.com/arduino/arduino-lint/workflows/Publish%20documentation/badge.svg)](https://github.com/arduino/arduino-lint/actions?workflow=Publish+documentation)
89
[![Codecov](https://codecov.io/gh/arduino/arduino-lint/branch/main/graph/badge.svg?token=nprqPQMbdh)](https://codecov.io/gh/arduino/arduino-lint)

Diff for: Taskfile.yml

+18-6
Original file line numberDiff line numberDiff line change
@@ -165,20 +165,32 @@ tasks:
165165
'
166166
fi
167167
168-
python:check:
168+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
169+
poetry:install-deps:
170+
desc: Install dependencies managed by Poetry
169171
cmds:
170-
- task: python:lint
172+
- poetry install --no-root
173+
174+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
175+
poetry:update-deps:
176+
desc: Update all dependencies managed by Poetry to their newest versions
177+
cmds:
178+
- poetry update
171179

180+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-python-task/Taskfile.yml
172181
python:lint:
173182
desc: Lint Python code
183+
deps:
184+
- task: poetry:install-deps
174185
cmds:
175-
- poetry install --no-root
176-
- poetry run flake8
186+
- poetry run flake8 --show-source
177187

188+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-python-task/Taskfile.yml
178189
python:format:
179-
desc: Automatically formats Python files
190+
desc: Format Python files
191+
deps:
192+
- task: poetry:install-deps
180193
cmds:
181-
- poetry install --no-root
182194
- poetry run black .
183195

184196
docs:generate:

0 commit comments

Comments
 (0)