148 Allow NetBox Scripts to run when a Branch is selected #65
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
name: Lint and tests | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- "!release" | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: false | |
permissions: | |
contents: write | |
checks: write | |
pull-requests: write | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
pip install .[dev] | |
pip install .[test] | |
- name: Build documentation | |
run: mkdocs build | |
- name: Run pycodestyle | |
run: | | |
pycodestyle --ignore=W504,E501 netbox_branching/ | |
tests: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
python-version: [ "3.10", "3.11", "3.12" ] | |
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 netbox-branching | |
uses: actions/checkout@v4 | |
with: | |
path: netbox-branching | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Checkout netbox | |
uses: actions/checkout@v4 | |
with: | |
repository: "netbox-community/netbox" | |
path: netbox | |
- name: Install netbox-branching | |
working-directory: netbox-branching | |
run: | | |
# Include tests directory for test | |
sed -i 's/exclude-package-data/#exclude-package-data/g' pyproject.toml | |
python -m pip install --upgrade pip | |
pip install . | |
pip install .[test] | |
- name: Install dependencies & configure plugin | |
working-directory: netbox | |
run: | | |
ln -s $(pwd)/../netbox-branching/testing/configuration.py netbox/netbox/configuration.py | |
ln -s $(pwd)/../netbox-branching/testing/local_settings.py netbox/netbox/local_settings.py | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt -U | |
- name: Run tests | |
working-directory: netbox | |
run: | | |
python netbox/manage.py test netbox_branching.tests --keepdb |