Repository navigation
112 lines (95 loc) · 3 KB
/
Copy pathpython-quality.yml
File metadata and controls
112 lines (95 loc) · 3 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Python Quality Checks
on:
pull_request:
branches: [dev, main]
paths:
- '**.py'
- 'pyproject.toml'
- '.github/workflows/python-quality.yml'
push:
branches: [dev, main]
paths:
- '**.py'
- 'pyproject.toml'
- '.github/workflows/python-quality.yml'
permissions:
contents: read
concurrency:
group: python-quality-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
RUFF_VERSION: '0.6.9'
jobs:
quality:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install ruff (pinned)
run: |
python -m pip install --upgrade pip
pip install "ruff==${RUFF_VERSION}"
- name: Syntax validation
run: |
set -e
echo "Validating Python syntax..."
find aso_skill scripts tests -name '*.py' -type f -print0 \
| xargs -0 -r python -m py_compile
echo "All Python files have valid syntax."
- name: Ruff lint
run: ruff check aso_skill scripts tests --output-format=github
- name: Ruff format check
run: ruff format --check aso_skill scripts tests
- name: File structure validation
run: |
set -e
root_py_files=$(find . -maxdepth 1 -name '*.py' -type f 2>/dev/null || true)
if [ -n "$root_py_files" ]; then
echo "ERROR: Python files found in repository root:"
echo "$root_py_files"
echo "Move them under aso_skill/, scripts/, or tests/."
exit 1
fi
echo "Repository structure OK."
- name: Character limit constants check
if: matrix.python-version == '3.13'
run: |
set -e
file=aso_skill/metadata.py
for needle in "'title': 30" "'subtitle': 30" "'title': 50"; do
if ! grep -q "$needle" "$file"; then
echo "ERROR: expected character limit not found in $file: $needle"
exit 1
fi
done
echo "Platform character limit constants validated."
- name: Install package and test dependencies
run: pip install -e ".[test]"
- name: Run pytest
run: pytest tests/ -v --tb=short
quality-summary:
name: Quality Summary
runs-on: ubuntu-latest
needs: quality
if: always()
steps:
- name: Check quality status
env:
RESULT: ${{ needs.quality.result }}
run: |
if [ "$RESULT" = success ]; then
echo "All Python quality checks passed."
exit 0
fi
echo "Python quality checks failed (result: $RESULT)."
exit 1