Merge pull request #35 from devon-mar/dependabot/pip/netaddr-0.10.1 #183
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: CI | |
"on": | |
push: | |
branches: | |
- "*" | |
pull_request: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- 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@v3 | |
with: | |
path: .venv | |
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }} | |
- 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 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- 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@v3 | |
with: | |
path: .venv | |
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }} | |
- 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 |