diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c8ed0ae --- /dev/null +++ b/.github/workflows/ci.yml @@ -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/ diff --git a/.github/workflows/unitest.yml b/.github/workflows/unitest.yml deleted file mode 100644 index 6759ecd..0000000 --- a/.github/workflows/unitest.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Unit Tests - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - test: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.10", "3.11"] - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pytest pytest-asyncio - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - pip install -e . - - - name: Run tests - run: | - pytest diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..eb733ff --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,7 @@ +-r requirements.txt +black +djlint +pre-commit +pylint +pytest +pytest-asyncio diff --git a/requirements.txt b/requirements.txt index 2688a88..e147ebf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,6 @@ -black click>=8.0.0 -djlint fastapi-analytics fastapi[standard] -pre-commit -pytest -pytest-asyncio python-dotenv slowapi starlette