Skip to content

Add tests

Add tests #16

Workflow file for this run

name: CI
on: [push, pull_request]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
env:
NETBOX_CONFIGURATION: netbox.configuration_lifecycle
strategy:
matrix:
python-version: ['3.11'] # '3.8', '3.9', '3.10',
node-version: ['14.x']
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: Check out NetBox
uses: actions/checkout@v4
with:
repository: 'netbox-community/netbox'
ref: 'master'
path: 'netbox'
- name: Check out repo
uses: actions/checkout@v4
with:
path: 'netbox-lifecycle'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies & set up configuration
run: |
python -m pip install --upgrade pip
pip install -r netbox/requirements.txt
pip install pycodestyle coverage tblib
pip install -e netbox-lifecycle
- name: Copy configuration
run: |
cp netbox-lifecycle/contrib/configuration_lifecycle.py netbox/netbox/netbox/configuration_lifecycle.py
- name: Collect static files
run: python netbox/netbox/manage.py collectstatic --no-input
- name: Check for missing migrations
run: python netbox/netbox/manage.py makemigrations --check
- name: Check PEP8 compliance
run: pycodestyle --ignore=W504,E501 netbox-lifecycle/netbox_lifecycle
- name: Run tests
run: coverage run --source="netbox-lifecycle/netbox_lifecycle/" netbox/netbox/manage.py test netbox-lifecycle/netbox_lifecycle/ --parallel
- name: Show coverage report
run: coverage report --skip-covered --omit '*/migrations/*,*/tests/*'