Merge branch 'feature/ci-testing' #1
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: 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.0.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 | |
... |