|
@@ -39,6 +39,9 @@ jobs:
|
|
|
python: ${{ steps.filter.outputs.python }}
|
|
python: ${{ steps.filter.outputs.python }}
|
|
|
frontend: ${{ steps.filter.outputs.frontend }}
|
|
frontend: ${{ steps.filter.outputs.frontend }}
|
|
|
docs: ${{ steps.filter.outputs.docs }}
|
|
docs: ${{ steps.filter.outputs.docs }}
|
|
|
|
|
+ # Release PRs (feature into main, or a release-vX.Y.Z branch) always run the test suite
|
|
|
|
|
+ # and install the [c] psycopg build users get.
|
|
|
|
|
+ release_pr: ${{ (github.head_ref == 'feature' && github.base_ref == 'main') || startsWith(github.head_ref, 'release-v') }}
|
|
|
steps:
|
|
steps:
|
|
|
- name: Check out repo
|
|
- name: Check out repo
|
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
@@ -50,13 +53,17 @@ jobs:
|
|
|
filters: |
|
|
filters: |
|
|
|
python:
|
|
python:
|
|
|
- 'netbox/**/*.py'
|
|
- 'netbox/**/*.py'
|
|
|
|
|
+ - 'netbox/**/migrations/**'
|
|
|
- 'requirements*.txt'
|
|
- 'requirements*.txt'
|
|
|
- 'pyproject.toml'
|
|
- 'pyproject.toml'
|
|
|
|
|
+ - '.github/workflows/ci.yml'
|
|
|
frontend:
|
|
frontend:
|
|
|
- 'netbox/project-static/**'
|
|
- 'netbox/project-static/**'
|
|
|
|
|
+ - '.github/workflows/ci.yml'
|
|
|
docs:
|
|
docs:
|
|
|
- 'docs/**'
|
|
- 'docs/**'
|
|
|
- 'mkdocs.yml'
|
|
- 'mkdocs.yml'
|
|
|
|
|
+ - '.github/workflows/ci.yml'
|
|
|
|
|
|
|
|
lint:
|
|
lint:
|
|
|
name: Lint (Python)
|
|
name: Lint (Python)
|
|
@@ -78,10 +85,13 @@ jobs:
|
|
|
name: >-
|
|
name: >-
|
|
|
Tests (Python ${{ matrix.python-version }}${{ matrix.coverage && ', coverage' || '' }})
|
|
Tests (Python ${{ matrix.python-version }}${{ matrix.coverage && ', coverage' || '' }})
|
|
|
needs: changes
|
|
needs: changes
|
|
|
- if: needs.changes.result == 'success' && needs.changes.outputs.python == 'true'
|
|
|
|
|
|
|
+ if: >-
|
|
|
|
|
+ needs.changes.result == 'success'
|
|
|
|
|
+ && (needs.changes.outputs.python == 'true' || needs.changes.outputs.release_pr == 'true')
|
|
|
runs-on: ubuntu-latest
|
|
runs-on: ubuntu-latest
|
|
|
env:
|
|
env:
|
|
|
NETBOX_CONFIGURATION: netbox.configuration_testing
|
|
NETBOX_CONFIGURATION: netbox.configuration_testing
|
|
|
|
|
+ RELEASE_PR: ${{ needs.changes.outputs.release_pr }}
|
|
|
strategy:
|
|
strategy:
|
|
|
matrix:
|
|
matrix:
|
|
|
python-version: ['3.12', '3.13', '3.14']
|
|
python-version: ['3.12', '3.13', '3.14']
|
|
@@ -116,6 +126,22 @@ jobs:
|
|
|
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
|
with:
|
|
with:
|
|
|
python-version: ${{ matrix.python-version }}
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
|
+ cache: pip
|
|
|
|
|
+ cache-dependency-path: |
|
|
|
|
|
+ requirements.txt
|
|
|
|
|
+ .github/workflows/ci.yml
|
|
|
|
|
+
|
|
|
|
|
+ - name: Select the psycopg implementation
|
|
|
|
|
+ run: |
|
|
|
|
|
+ if [ "$RELEASE_PR" = true ]; then
|
|
|
|
|
+ echo "PSYCOPG_IMPL=c" >> "$GITHUB_ENV"
|
|
|
|
|
+ else
|
|
|
|
|
+ # Prebuilt wheels skip compiling against libpq.
|
|
|
|
|
+ sed -i 's/^psycopg\[c,pool\]==/psycopg[binary,pool]==/' requirements.txt
|
|
|
|
|
+ grep -q '^psycopg\[binary,pool\]==' requirements.txt \
|
|
|
|
|
+ || { echo "::error::requirements.txt no longer pins psycopg[c,pool]=="; exit 1; }
|
|
|
|
|
+ echo "PSYCOPG_IMPL=binary" >> "$GITHUB_ENV"
|
|
|
|
|
+ fi
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
- name: Install dependencies
|
|
|
run: |
|
|
run: |
|
|
@@ -133,11 +159,11 @@ jobs:
|
|
|
|
|
|
|
|
- name: Run tests
|
|
- name: Run tests
|
|
|
if: ${{ ! matrix.coverage }}
|
|
if: ${{ ! matrix.coverage }}
|
|
|
- run: python netbox/manage.py test netbox/ --parallel
|
|
|
|
|
|
|
+ run: python netbox/manage.py test netbox/ --parallel --timing
|
|
|
|
|
|
|
|
- name: Run tests with coverage
|
|
- name: Run tests with coverage
|
|
|
if: ${{ matrix.coverage }}
|
|
if: ${{ matrix.coverage }}
|
|
|
- run: coverage run netbox/manage.py test netbox/ --parallel
|
|
|
|
|
|
|
+ run: coverage run netbox/manage.py test netbox/ --parallel --timing
|
|
|
|
|
|
|
|
- name: Combine coverage data
|
|
- name: Combine coverage data
|
|
|
if: ${{ matrix.coverage }}
|
|
if: ${{ matrix.coverage }}
|
|
@@ -196,9 +222,15 @@ jobs:
|
|
|
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
|
with:
|
|
with:
|
|
|
python-version: '3.12'
|
|
python-version: '3.12'
|
|
|
|
|
+ cache: pip
|
|
|
|
|
+ cache-dependency-path: |
|
|
|
|
|
+ requirements.txt
|
|
|
|
|
+ .github/workflows/ci.yml
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
- name: Install dependencies
|
|
|
run: |
|
|
run: |
|
|
|
|
|
+ # Shares the 3.12 test job's pip cache entry.
|
|
|
|
|
+ sed -i 's/^psycopg\[c,pool\]==/psycopg[binary,pool]==/' requirements.txt
|
|
|
python -m pip install --upgrade pip
|
|
python -m pip install --upgrade pip
|
|
|
pip install -r requirements.txt
|
|
pip install -r requirements.txt
|
|
|
|
|
|