This repository has been archived by the owner on Nov 19, 2023. It is now read-only.
feat: adding support for request validation #1299
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
linting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11.2" | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: | | |
.venv | |
~/.cache/pre-commit | |
key: venv-3 # increment to reset | |
- run: | | |
python -m venv .venv --upgrade-deps | |
source .venv/bin/activate | |
pip install pre-commit | |
if: steps.cache.outputs.cache-hit != 'true' | |
- run: | | |
source .venv/bin/activate | |
pre-commit run --all-files | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ "3.7.14", "3.8.14" , "3.9.14", "3.10.7", "3.11.2" ] | |
django-version: [ "3.2", "4.0", "4.1" ] | |
exclude: | |
# Django v4 dropped 3.7 support | |
- django-version: 4.0 | |
python-version: 3.7.14 | |
- django-version: 4.1 | |
python-version: 3.7.14 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "${{ matrix.python-version }}" | |
- uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: false | |
version: 1.3.2 | |
- uses: actions/cache@v3 | |
id: cache-venv | |
with: | |
path: .venv | |
key: ${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}-6 | |
- run: | | |
python -m venv .venv | |
source .venv/bin/activate | |
pip install wheel setuptools pip -U | |
poetry install --no-interaction --no-root --extras drf-spectacular --extras drf-yasg | |
if: steps.cache-venv.outputs.cache-hit != 'true' | |
- run: | | |
source .venv/bin/activate | |
pip install "Django==${{ matrix.django-version }}" | |
- run: | | |
source .venv/bin/activate | |
coverage run -m pytest | |
coverage xml | |
coverage report | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-xml | |
path: coverage.xml | |
if: matrix.python-version == '3.10.7' && matrix.django-version == '4.1' | |
coverage: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: coverage-xml | |
- uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} |