Skip to content

Merge pull request #41 from devon-mar/dependabot/pip/black-24.1.1 #202

Merge pull request #41 from devon-mar/dependabot/pip/black-24.1.1

Merge pull request #41 from devon-mar/dependabot/pip/black-24.1.1 #202

Workflow file for this run

---
name: CI
"on":
push:
branches:
- "*"
pull_request:
jobs:
lint:
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
uses: snok/[email protected]
with:
virtualenvs-create: true
virtualenvs-in-project: true
- 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'
- uses: psf/black@stable
- name: Lint with flake8
run: |
poetry run flake8 netbox_lists --count --max-line-length=120 --show-source --statistics
test:
strategy:
matrix:
include:
- netbox: v3.5
- netbox: v3.6
- netbox: v3.7
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
uses: snok/[email protected]
with:
virtualenvs-create: true
virtualenvs-in-project: true
- 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