Skip to content

Commit 8fda38b

Browse files
committed
ci: Upgrade Workflow (Matrix, Caching, Parallel Tests)
1 parent 556083c commit 8fda38b

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,45 @@ on:
77
pull_request:
88
branches: [ "main" ]
99

10+
# 🛑 Concurrency: Cancel previous runs on the same branch
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
1015
jobs:
1116
test:
17+
name: Test (Python ${{ matrix.python-version }})
1218
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"]
1325

1426
steps:
1527
- uses: actions/checkout@v3
1628

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
1931
with:
20-
python-version: "3.10"
32+
python-version: ${{ matrix.python-version }}
33+
cache: 'pip' # ⚡ Cache pip dependencies automatically
2134

2235
- name: Install dependencies
2336
run: |
2437
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
2847
29-
- name: Run Tests
48+
- name: Run Tests (Parallel)
3049
run: |
31-
pytest tests/
50+
# ⚡ Run tests in parallel (-n auto)
51+
pytest -n auto tests/

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ requests
22
simple_chalk
33
rich
44
pytest
5+
pytest-xdist
6+
pylint

0 commit comments

Comments
 (0)