-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (51 loc) · 1.65 KB
/
code_quality.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# This is the name of the workflow, it appears in the GitHub Actions tab
name: Code Quality
# The name for workflow runs generated from this workflow
run-name: Code Quality Run on ${{ github.ref }} by @${{ github.actor }}
# This specifies the events that will trigger the workflow to run
on: [push, pull_request]
# Jobs define the actual tasks that the workflow will execute
jobs:
code_quality_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup Python environment
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Generate requirements.txt from Poetry
run: |
poetry export -f requirements.txt --output requirements.txt --without-hashes
# Install Python dependencies
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Ruff
uses: astral-sh/ruff-action@v1
with:
args: 'check --fix'
# Check code formatting using isort
- name: Run isort
uses: isort/isort-action@v1
- name: Auto-format Python code with Black
run: |
black .
# Check code formatting using Black
- name: Run Black
uses: psf/black@stable
with:
options: "--check --verbose"
# Use Ruff to run additional quality checks
- name: Run Ruff
uses: astral-sh/ruff-action@v1
with:
args: 'format --check'
- name: Run MyPy
run: |
mypy --config-file=pyproject.toml --pretty .