forked from kubeflow/pipelines-components
-
Notifications
You must be signed in to change notification settings - Fork 10
72 lines (62 loc) · 2.17 KB
/
python-lint.yml
File metadata and controls
72 lines (62 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
name: Python Lint
on:
pull_request:
paths:
- '**/*.py'
- 'pyproject.toml'
- 'uv.lock'
- '.github/workflows/python-lint.yml'
- '.github/actions/setup-python-ci/**'
- '.github/scripts/check_imports/**'
push:
jobs:
python-lint:
name: python-lint
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
steps:
- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Setup Python & deps
uses: ./.github/actions/setup-python-ci
with:
python-version: "3.11"
extra: lint
- name: Check uv.lock is in sync
run: uv lock --check
- name: Determine changed Python files
id: changed-python
uses: ./.github/actions/detect-changed-assets
with:
filter: '\.py$'
skip-deleted-files: true
- name: Run ruff format check (changed files)
if: steps.changed-python.outputs.filtered-changed-files != ''
env:
CHANGED_FILES: ${{ steps.changed-python.outputs.filtered-changed-files }}
run: |
uv run ruff format --force-exclude --check $CHANGED_FILES
- name: Run ruff lint (changed files)
if: steps.changed-python.outputs.filtered-changed-files != ''
env:
CHANGED_FILES: ${{ steps.changed-python.outputs.filtered-changed-files }}
run: |
uv run ruff check --force-exclude $CHANGED_FILES
- name: Determine changed components/pipelines Python files
id: changed-components-pipelines
uses: ./.github/actions/detect-changed-assets
with:
filter: '^(components|pipelines)/.*\.py$'
- name: Run custom import guard
if: steps.changed-components-pipelines.outputs.filtered-changed-files != ''
env:
CHANGED_FILES: ${{ steps.changed-components-pipelines.outputs.filtered-changed-files }}
run: |
uv run python .github/scripts/check_imports/check_imports.py \
--config .github/scripts/check_imports/import_exceptions.yaml \
-- $CHANGED_FILES