-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from DanSheps/develop
Add tests
- Loading branch information
Showing
15 changed files
with
342 additions
and
14 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: CI | ||
on: [push, pull_request] | ||
permissions: | ||
contents: read | ||
jobs: | ||
build: | ||
name: Check Build | ||
runs-on: ubuntu-latest | ||
env: | ||
NETBOX_CONFIGURATION: netbox.configuration_lifecycle | ||
strategy: | ||
matrix: | ||
python-version: ['3.8', '3.9', '3.10', '3.11'] | ||
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/*' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
################################################################### | ||
# This file serves as a base configuration for testing purposes # | ||
# only. It is not intended for production use. # | ||
################################################################### | ||
|
||
ALLOWED_HOSTS = ['*'] | ||
|
||
DATABASE = { | ||
'NAME': 'netbox', | ||
'USER': 'netbox', | ||
'PASSWORD': 'netbox', | ||
'HOST': 'localhost', | ||
'PORT': '', | ||
'CONN_MAX_AGE': 300, | ||
} | ||
|
||
PLUGINS = [ | ||
'netbox_lifecycle', | ||
] | ||
|
||
REDIS = { | ||
'tasks': { | ||
'HOST': 'localhost', | ||
'PORT': 6379, | ||
'USERNAME': '', | ||
'PASSWORD': '', | ||
'DATABASE': 0, | ||
'SSL': False, | ||
}, | ||
'caching': { | ||
'HOST': 'localhost', | ||
'PORT': 6379, | ||
'USERNAME': '', | ||
'PASSWORD': '', | ||
'DATABASE': 1, | ||
'SSL': False, | ||
} | ||
} | ||
|
||
SECRET_KEY = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' | ||
|
||
DEFAULT_PERMISSIONS = {} | ||
|
||
LOGGING = { | ||
'version': 1, | ||
'disable_existing_loggers': True | ||
} |
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
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
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
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
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
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
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
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
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
Empty file.
Oops, something went wrong.