Skip to content

Commit 3b9994e

Browse files
Split requirements files, integrate pre-commit hooks, and add pip cache to CI workflow
1 parent 18444c3 commit 3b9994e

File tree

4 files changed

+54
-38
lines changed

4 files changed

+54
-38
lines changed

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: true
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
16+
python-version: ["3.10", "3.11", "3.12", "3.13"]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Cache pip
27+
uses: actions/cache@v4
28+
with:
29+
path: ~/.cache/pip
30+
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements*.txt') }}
31+
restore-keys: |
32+
${{ runner.os }}-pip-
33+
34+
- name: Install dependencies
35+
run: |
36+
pip install --upgrade pip
37+
pip install -r requirements-dev.txt
38+
39+
- name: Run tests
40+
run: |
41+
pytest
42+
43+
# Run pre-commit only on Python 3.13 + ubuntu.
44+
- name: Run pre-commit hooks
45+
if: ${{ matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' }}
46+
run: |
47+
pre-commit run --all-files

.github/workflows/unitest.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

requirements-dev.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-r requirements.txt
2+
black
3+
djlint
4+
pre-commit
5+
pylint
6+
pytest
7+
pytest-asyncio

requirements.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
black
21
click>=8.0.0
3-
djlint
42
fastapi-analytics
53
fastapi[standard]
6-
pre-commit
7-
pytest
8-
pytest-asyncio
94
python-dotenv
105
slowapi
116
starlette

0 commit comments

Comments
 (0)