CI #92
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: | |
schedule: | |
- cron: 0 0 * * 0 | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Setup Python 3.10 | |
id: setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: poetry | |
- run: poetry install | |
if: steps.setup-python.outputs.cache-hit != 'true' | |
- uses: psf/black@stable | |
- name: Lint with flake8 | |
run: | | |
poetry run flake8 . --count --max-line-length=120 --show-source --statistics | |
test: | |
strategy: | |
matrix: | |
include: | |
- container_tag: v3.5 | |
netbox_docker_tag: 2.6.1 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Setup Python 3.10 | |
id: setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: poetry | |
- run: poetry install | |
if: steps.setup-python.outputs.cache-hit != 'true' | |
- name: Ensure playwright browsers are installed | |
run: poetry run playwright install --with-deps | |
- name: Checkout netbox-community/netbox-docker | |
uses: actions/checkout@v3 | |
with: | |
repository: netbox-community/netbox-docker | |
path: netbox-docker | |
ref: ${{ matrix.netbox_docker_tag }} | |
- name: Run poetry build | |
run: poetry build | |
- name: Run test_setup.sh | |
run: ./tests/test_setup.sh | |
env: | |
NETBOX_CONTAINER_TAG: ${{ matrix.container_tag }} | |
- name: Run pytest | |
run: | | |
poetry run pytest -v | |
- name: Show Docker logs | |
if: ${{ always() }} | |
run: docker-compose logs | |
working-directory: ./netbox-docker/ |