-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (90 loc) · 3.19 KB
/
Copy pathtest-netbox-main.yaml
File metadata and controls
103 lines (90 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2025 Marcin Zieba <marcinpsk@gmail.com>
name: Weekly test against NetBox main
on:
schedule:
- cron: '0 6 * * 1' # Every Monday at 06:00 UTC
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
test-netbox-main:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.12", "3.13", "3.14"]
services:
redis:
image: redis:7
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
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@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
path: netbox-InterfaceNameRules-plugin
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Checkout NetBox main
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
repository: "netbox-community/netbox"
path: netbox
ref: main
- 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
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': '5432',
'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' # checkov:skip=CKV_SECRET_6: CI-only test fixture
API_TOKEN_PEPPERS = {0: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'} # checkov:skip=CKV_SECRET_6: CI-only test fixture
PLUGINS = ['netbox_interface_name_rules']
EOF
- name: Run tests
working-directory: netbox/netbox
env:
NETBOX_CONFIGURATION: netbox.configuration
run: |
python manage.py test netbox_interface_name_rules --verbosity=2