Skip to content

Commit

Permalink
Split requirements files, integrate pre-commit hooks, and add pip cac…
Browse files Browse the repository at this point in the history
…he to CI workflow
  • Loading branch information
filipchristiansen committed Dec 28, 2024
1 parent 18444c3 commit 76eed0b
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 38 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Run tests
run: |
pytest
# Run pre-commit only on Python 3.13 + ubuntu.
- name: Run pre-commit hooks
if: ${{ matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' }}
run: |
pre-commit run --all-files
# Run pylint only on Python 3.13 + ubuntu.
- name: Run pylint
if: ${{ matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' }}
run: |
pylint src/
33 changes: 0 additions & 33 deletions .github/workflows/unitest.yml

This file was deleted.

7 changes: 7 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-r requirements.txt
black
djlint
pre-commit
pylint
pytest
pytest-asyncio
5 changes: 0 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
black
click>=8.0.0
djlint
fastapi-analytics
fastapi[standard]
pre-commit
pytest
pytest-asyncio
python-dotenv
slowapi
starlette
Expand Down

0 comments on commit 76eed0b

Please sign in to comment.