89 lines
2.4 KiB
YAML
89 lines
2.4 KiB
YAML
name: Test with all supported NetBox versions
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- develop
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- develop
|
|
|
|
jobs:
|
|
test-netbox:
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
python-version: ["3.12", "3.13", "3.14"]
|
|
|
|
services:
|
|
redis:
|
|
image: redis
|
|
ports:
|
|
- 6379:6379
|
|
|
|
postgres:
|
|
image: postgres
|
|
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.0.2
|
|
with:
|
|
path: netbox-librenms-plugin
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Checkout NetBox
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
repository: "netbox-community/netbox"
|
|
path: netbox
|
|
ref: main
|
|
|
|
- name: Install NetBox LibreNMS Plugin
|
|
working-directory: netbox-librenms-plugin
|
|
run: |
|
|
pip install -e .
|
|
pip install pytest pytest-django pytest-cov
|
|
|
|
- name: Set up configuration
|
|
working-directory: netbox
|
|
run: |
|
|
ln -s "$(pwd)/../netbox-librenms-plugin/media/configuration.testing.py" netbox/netbox/configuration.py
|
|
|
|
python -m pip install --upgrade pip
|
|
python -m pip install tblib
|
|
pip install -r requirements.txt -U
|
|
|
|
- name: Run tests
|
|
working-directory: netbox/netbox
|
|
env:
|
|
NETBOX_CONFIGURATION: netbox.configuration
|
|
run: |
|
|
python -m pytest ../../netbox-librenms-plugin/netbox_librenms_plugin/tests/ -v \
|
|
--cov=netbox_librenms_plugin \
|
|
--cov-report=html:../../netbox-librenms-plugin/coverage_html \
|
|
--cov-report=term-missing
|
|
|
|
- name: Upload coverage report
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
if: matrix.python-version == '3.12'
|
|
with:
|
|
name: coverage-report
|
|
path: netbox-librenms-plugin/coverage_html/
|