diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..3d06008b --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,32 @@ +name: API Lint +on: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + name: Install Python + with: + python-version: '3.8' + + - name: Pip cache + id: pip-cache + uses: actions/cache@v2 + with: + path: ${{ env.pythonLocation }} + key: api-lint-${{ runner.os }}-${{ env.pythonLocation }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements-dev.txt') }} + + - name: Install deps + if: steps.pip-cache.outputs.cache-hit != 'true' + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + python -m pip install -r requirements-dev.txt + + - name: Run linting + run: | + sh ./scripts/lint.sh diff --git a/requirements.in/base.txt b/requirements.in/base.txt index 6410748f..27d5d28b 100644 --- a/requirements.in/base.txt +++ b/requirements.in/base.txt @@ -1,4 +1,4 @@ -django<4.0 +django>=4.0<5.0 msgpack pynacl fastapi diff --git a/requirements.txt b/requirements.txt index 7b51da49..62b63440 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --output-file=requirements.txt requirements.in/base.txt @@ -18,7 +18,7 @@ cffi==1.15.1 # via pynacl click==8.1.3 # via uvicorn -django==3.2.16 +django==4.1.13 # via -r requirements.in/base.txt fastapi==0.88.0 # via -r requirements.in/base.txt @@ -38,8 +38,6 @@ pynacl==1.5.0 # via -r requirements.in/base.txt python-dotenv==0.21.0 # via uvicorn -pytz==2022.6 - # via django pyyaml==6.0.1 # via uvicorn redis==4.4.0 diff --git a/scripts/lint.sh b/scripts/lint.sh new file mode 100755 index 00000000..848eba3e --- /dev/null +++ b/scripts/lint.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -ex + +mypy . +npx -q pyright@1.1.172 . +ruff check . +ruff format --check .