|
7 | 7 | pull_request: |
8 | 8 | branches: [ "main" ] |
9 | 9 |
|
| 10 | +# 🛑 Concurrency: Cancel previous runs on the same branch |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
10 | 15 | jobs: |
11 | 16 | test: |
| 17 | + name: Test (Python ${{ matrix.python-version }}) |
12 | 18 | runs-on: ubuntu-latest |
| 19 | + timeout-minutes: 5 # ⚡ Fail fast if hanging |
| 20 | + |
| 21 | + strategy: |
| 22 | + fail-fast: false |
| 23 | + matrix: |
| 24 | + python-version: ["3.10", "3.11", "3.12"] |
13 | 25 |
|
14 | 26 | steps: |
15 | 27 | - uses: actions/checkout@v3 |
16 | 28 |
|
17 | | - - name: Set up Python 3.10 |
18 | | - uses: actions/setup-python@v3 |
| 29 | + - name: Set up Python ${{ matrix.python-version }} |
| 30 | + uses: actions/setup-python@v4 |
19 | 31 | with: |
20 | | - python-version: "3.10" |
| 32 | + python-version: ${{ matrix.python-version }} |
| 33 | + cache: 'pip' # ⚡ Cache pip dependencies automatically |
21 | 34 |
|
22 | 35 | - name: Install dependencies |
23 | 36 | run: | |
24 | 37 | python -m pip install --upgrade pip |
25 | | - pip install pytest requests aiohttp |
26 | | - # Install project requirements if any (currently standard lib mostly) |
27 | | - # pip install -r requirements.txt |
| 38 | + pip install -r requirements.txt |
| 39 | + pip install pylint pytest-xdist # xdist for parallel tests |
| 40 | +
|
| 41 | + - name: Lint (Syntax Check) |
| 42 | + run: | |
| 43 | + # Only check for fatal errors (E) and syntax warnings (W) |
| 44 | + # We assume 'bad.py' files might have issues, so we treat this as advisory or selective |
| 45 | + # For now, let's just check valid python syntax |
| 46 | + python -m compileall . -q |
28 | 47 |
|
29 | | - - name: Run Tests |
| 48 | + - name: Run Tests (Parallel) |
30 | 49 | run: | |
31 | | - pytest tests/ |
| 50 | + # ⚡ Run tests in parallel (-n auto) |
| 51 | + pytest -n auto tests/ |
0 commit comments