Skip to content

Commit 312f544

Browse files
committed
ci: ⚙️ add GitHub Actions workflow for Python
1 parent 28dbd8e commit 312f544

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Python CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.10", "3.11"]
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
28+
pip install ruff pytest
29+
30+
- name: Lint with Ruff
31+
run: |
32+
# Stop the build if there are Python syntax errors or undefined names
33+
ruff check . --select=E9,F63,F7,F82 --output-format=github
34+
# Default linting (ignoring rule violations to just show warnings)
35+
ruff check . --exit-zero
36+
37+
- name: Test with pytest
38+
run: |
39+
if [ -d "tests" ]; then
40+
pytest tests/ || echo "No tests found or tests failed - continuing for now"
41+
else
42+
echo "No tests directory found."
43+
fi

0 commit comments

Comments
 (0)