add tests for django_simple_nav.permissions
#91
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: | |
push: | |
branches: [main] | |
pull_request: | |
concurrency: | |
group: test-${{ github.head_ref }} | |
cancel-in-progress: true | |
env: | |
PYTHONUNBUFFERED: "1" | |
FORCE_COLOR: "1" | |
jobs: | |
test: | |
name: Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }} | |
runs-on: "ubuntu-latest" | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
django-version: ["3.2", "4.2", "5.0", "main"] | |
env: | |
NOX_SESSION: "tests(python='${{ matrix.python-version }}', django='${{ matrix.django-version }}')" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
allow-prereleases: true | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip nox | |
- name: Check if test session exists | |
run: | | |
if nox -l | grep -q "${{ env.NOX_SESSION }}"; then | |
echo "Session exists, proceeding with tests" | |
echo "RUN_TESTS=true" >> $GITHUB_ENV | |
else | |
echo "Session does not exist, skipping tests" | |
echo "RUN_TESTS=false" >> $GITHUB_ENV | |
fi | |
- name: Run tests | |
if: env.RUN_TESTS == 'true' | |
run: | | |
python -m nox --session "${{ env.NOX_SESSION }}" | |
tests: | |
runs-on: ubuntu-latest | |
needs: test | |
if: always() | |
steps: | |
- name: OK | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: Fail | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 | |
types: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: wntrblm/nox@main | |
with: | |
python-versions: "3.8" | |
- name: Run mypy | |
run: nox --session "mypy" | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: wntrblm/nox@main | |
with: | |
python-versions: "3.8" | |
- name: Run coverage | |
run: nox --session "coverage" |