-
Notifications
You must be signed in to change notification settings - Fork 2
48 lines (46 loc) · 1.3 KB
/
lint.yml
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
name: Check format and static typing
on:
push:
branches:
- main
paths:
- '**.py'
- '.github/workflows/lint.yml'
pull_request:
branches:
- main
paths:
- '**.py'
- '.github/workflows/lint.yml'
types:
- opened
- reopened
- synchronize
- ready_for_review
jobs:
format-check:
name: Check code format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install ruff and mypy
run: |
pip install ruff mypy typing_extensions types-Deprecated types-beautifulsoup4 types-jsonschema pandas-stubs
- name: Get all changed python files
id: changed-python-files
uses: tj-actions/changed-files@v44
with:
files: |
**.py
- name: Check format using ruff
if: steps.changed-python-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-python-files.outputs.all_changed_files }}
run: |
ruff check ${ALL_CHANGED_FILES}
- name: Check static typing using mypy
if: steps.changed-python-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-python-files.outputs.all_changed_files }}
run: |
mypy ${ALL_CHANGED_FILES}