-
Notifications
You must be signed in to change notification settings - Fork 1
94 lines (84 loc) · 2.44 KB
/
ci.yaml
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
---
name: Continuous Integration 🔄
on:
pull_request:
push:
branches:
- main
jobs:
pre-commit:
name: Run pre-commit hooks 🪝
runs-on: ubuntu-latest
steps:
- name: Set up repository 🧩
uses: actions/checkout@v4
- name: Set up Python 🐍
uses: actions/setup-python@v5
with:
python-version: "3.x"
cache: "pip"
- name: Run pre-commit hooks 🪝
uses: pre-commit/[email protected]
test-plugin-integration:
name: >-
Run tests 🧪 [NB ${{ matrix.netbox-version }} |
Py ${{ matrix.python-version }}]
needs:
- pre-commit
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
netbox-version: ["v4.1.0", "master"]
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 repository of the plugin 🧩
uses: actions/checkout@v4
with:
path: netbox_aci_plugin
- name: Checkout repository of NetBox ${{ matrix.netbox-version }} 📦
uses: actions/checkout@v4
with:
repository: "netbox-community/netbox"
ref: ${{ matrix.netbox-version }}
path: netbox
- name: Set up Python ${{ matrix.python-version }} 🐍
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Set up NetBox configuration for testing 🧪
working-directory: netbox
run: |
ln -s $(pwd)/../netbox_aci_plugin/.ci/configuration.testing.py \
netbox/netbox/configuration.py
- name: Install dependencies for NetBox 📦
working-directory: netbox
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -U
- name: Install Plugin in NetBox environment 🧩
working-directory: netbox_aci_plugin
run: |
pip install -e .
- name: Run Django tests 🧪
working-directory: netbox
run: |
python netbox/manage.py test netbox_aci_plugin.tests --parallel -v 2
...