Skip to content

Add NetBox v4.2 to CI matrix #375

Add NetBox v4.2 to CI matrix

Add NetBox v4.2 to CI matrix #375

Workflow file for this run

---
name: CI
"on":
push:
branches:
- "*"
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v3
- uses: astral-sh/ruff-action@v3
with:
args: format --check
test:
strategy:
matrix:
include:
- netbox: v4.0
- netbox: v4.1
- netbox: v4.2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install poetry
run: pipx install poetry
- name: Load cached venv
id: cache-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock', '.github/workflows/ci.yml') }}
- name: Run poetry install
run: poetry install
if: steps.cache-poetry-dependencies.outputs.cache-hit != 'true'
- name: Run poetry build
run: poetry build
- name: Build the Docker image
env:
CONTAINER_TAG: ${{ matrix.netbox }}
run: |
WHL_FILE=$(ls ./dist/ | grep .whl)
cp "./dist/$WHL_FILE" ./tests/docker/
cd ./tests/docker/
docker compose build --build-arg "FROM=netboxcommunity/netbox:$CONTAINER_TAG" --build-arg "WHL_FILE=$WHL_FILE"
- name: Start netbox
working-directory: ./tests/docker/
run: docker compose up -d
- name: Run pytest
run: |
poetry run pytest -v
- name: Show Docker logs
if: ${{ always() }}
working-directory: ./tests/docker/
run: docker compose logs