chore(deps): bump github/codeql-action from 4.35.2 to 4.35.3 in the g… #214
This file contains hidden or 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
| # SPDX-License-Identifier: Apache-2.0 | |
| # Copyright (C) 2025 Marcin Zieba <marcinpsk@gmail.com> | |
| name: Test with supported NetBox and Python versions | |
| on: | |
| push: | |
| branches: | |
| - main # Only direct pushes to main; branch pushes with open PRs are covered by the pull_request trigger | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test-netbox: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 6 | |
| matrix: | |
| python-version: ["3.12", "3.13", "3.14"] | |
| netbox-version: ["v4.3.7", "v4.4.10", "v4.5.3"] | |
| exclude: | |
| - python-version: "3.14" | |
| netbox-version: "v4.3.7" # strawberry-graphql incompatible with Python 3.14 on this NetBox version | |
| services: | |
| redis: | |
| image: redis:7 | |
| ports: | |
| - 6379:6379 | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: netbox | |
| POSTGRES_PASSWORD: netbox | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| path: netbox-InterfaceNameRules-plugin | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Checkout NetBox | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| repository: "netbox-community/netbox" | |
| path: netbox | |
| ref: ${{ matrix.netbox-version }} | |
| - name: Install NetBox and plugin | |
| working-directory: netbox-InterfaceNameRules-plugin | |
| run: | | |
| uv pip install --system -r ../netbox/requirements.txt | |
| uv pip install --system pytest pytest-django tblib coverage | |
| uv pip install --system -e . | |
| - name: Set up NetBox configuration | |
| working-directory: netbox | |
| run: | | |
| cat > netbox/netbox/configuration.py << 'EOF' | |
| ALLOWED_HOSTS = ['*'] | |
| DATABASE = { | |
| 'NAME': 'netbox', | |
| 'USER': 'netbox', | |
| 'PASSWORD': 'netbox', | |
| 'HOST': 'localhost', | |
| 'PORT': '', | |
| 'CONN_MAX_AGE': 300, | |
| 'ENGINE': 'django.db.backends.postgresql' | |
| } | |
| REDIS = { | |
| 'tasks': {'HOST': 'localhost', 'PORT': 6379, 'DATABASE': 0}, | |
| 'caching': {'HOST': 'localhost', 'PORT': 6379, 'DATABASE': 1} | |
| } | |
| SECRET_KEY = 'test-secret-key-not-for-production-1234567890123456' | |
| API_TOKEN_PEPPERS = {0: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'} | |
| PLUGINS = ['netbox_interface_name_rules'] | |
| EOF | |
| - name: Run tests with coverage | |
| working-directory: netbox/netbox | |
| env: | |
| NETBOX_CONFIGURATION: netbox.configuration | |
| COVERAGE_RCFILE: ../../netbox-InterfaceNameRules-plugin/pyproject.toml | |
| run: | | |
| coverage run manage.py test netbox_interface_name_rules --verbosity=2 | |
| coverage report | |
| - name: Generate coverage report | |
| if: matrix.python-version == '3.12' && matrix.netbox-version == 'v4.5.3' | |
| working-directory: netbox/netbox | |
| env: | |
| COVERAGE_RCFILE: ../../netbox-InterfaceNameRules-plugin/pyproject.toml | |
| run: | | |
| mkdir -p ../../coverage-report | |
| coverage json -o ../../coverage-report/coverage.json | |
| coverage html -d ../../coverage-report/htmlcov | |
| coverage xml -o ../../coverage-report/coverage.xml | |
| - name: Upload coverage report | |
| if: matrix.python-version == '3.12' && matrix.netbox-version == 'v4.5.3' | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: coverage-report | |
| path: coverage-report/ | |
| retention-days: 7 | |
| - name: Upload coverage to Codecov | |
| if: matrix.python-version == '3.12' && matrix.netbox-version == 'v4.5.3' | |
| uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 | |
| with: | |
| files: coverage-report/coverage.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: false |