-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1001 from netbox-community/devel
Release 3.13
- Loading branch information
Showing
360 changed files
with
5,306 additions
and
18,859 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,163 +1,143 @@ | ||
--- | ||
name: All CI related tasks | ||
|
||
# Run this workflow every time a new commit pushed to your repository | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
linting_unit_testing: | ||
linting: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run black | ||
uses: psf/black@stable | ||
|
||
- name: 'Yamllint' | ||
uses: karancode/yamllint-github-action@master | ||
|
||
#- name: Run isort | ||
# uses: jamescurtin/isort-action@master | ||
|
||
#- name: Run ruff | ||
# uses: chartboost/ruff-action@v1 | ||
|
||
unit_testing: | ||
runs-on: ubuntu-latest | ||
needs: linting | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10"] | ||
python-version: ["3.9", "3.10", "3.11"] | ||
|
||
steps: | ||
|
||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install and configure Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: false | ||
|
||
- name: Install Python packages | ||
run: poetry install | ||
|
||
- name: Build and install collection | ||
run: | | ||
ansible-galaxy collection build . | ||
ansible-galaxy collection install netbox*.tar.gz -p /home/runner/.ansible/collections | ||
- name: Run Black | ||
run: poetry run black . --check --diff | ||
- name: Run Ansible Sanity tests | ||
run: poetry run ansible-test sanity -v --requirements --python ${{ matrix.python-version }} --skip-test pep8 plugins/ | ||
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox | ||
|
||
- name: Run Ansible Unit tests | ||
run: poetry run ansible-test units -vvv --coverage --python ${{ matrix.python-version }} | ||
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox | ||
|
||
- name: Run Ansible Coverage | ||
run: poetry run ansible-test coverage report --all --omit "tests/*,hacking/*,docs/*" --show-missing | ||
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox | ||
integration: | ||
|
||
integration_testing: | ||
runs-on: ubuntu-latest | ||
needs: linting_unit_testing | ||
needs: unit_testing | ||
env: | ||
python-version: "3.9" | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- python-version: 3.8 | ||
VERSION: "v3.2" | ||
INTEGRATION_TESTS: "v3.2" | ||
- python-version: 3.8 | ||
VERSION: "v3.3" | ||
INTEGRATION_TESTS: "v3.3" | ||
- python-version: 3.8 | ||
VERSION: "v3.4" | ||
INTEGRATION_TESTS: "v3.4" | ||
include: | ||
- VERSION: "v3.3" | ||
NETBOX_DOCKER_VERSION: 2.3.0 | ||
- VERSION: "v3.4" | ||
NETBOX_DOCKER_VERSION: 2.5.3 | ||
- VERSION: "v3.5" | ||
NETBOX_DOCKER_VERSION: 2.6.1 | ||
# If we want to integration test wiht all supported Python: | ||
#python-version: ["3.9", "3.10", "3.11"] | ||
|
||
steps: | ||
|
||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Clone & Start netbox-docker containers - 3.2 | ||
env: | ||
VERSION: ${{ matrix.VERSION }} | ||
run: | | ||
cd .. | ||
git clone https://github.com/netbox-community/netbox-docker.git | ||
cd netbox-docker | ||
git checkout 1.6.1 | ||
tee docker-compose.override.yml <<EOF | ||
version: '3.4' | ||
services: | ||
netbox: | ||
image: netboxcommunity/netbox:v3.2 | ||
ports: | ||
- 32768:8080 | ||
EOF | ||
docker-compose up -d --quiet-pull | ||
docker container ls | ||
cd .. | ||
if: matrix.VERSION == 'v3.2' | ||
- name: Clone & Start netbox-docker containers - 3.3 | ||
env: | ||
VERSION: ${{ matrix.VERSION }} | ||
run: | | ||
cd .. | ||
git clone https://github.com/netbox-community/netbox-docker.git | ||
cd netbox-docker | ||
git checkout 2.2.0 | ||
tee docker-compose.override.yml <<EOF | ||
version: '3.4' | ||
services: | ||
netbox: | ||
image: netboxcommunity/netbox:v3.3 | ||
ports: | ||
- 32768:8080 | ||
EOF | ||
docker-compose up -d --quiet-pull | ||
docker container ls | ||
cd .. | ||
if: matrix.VERSION == 'v3.3' | ||
- name: Clone & Start netbox-docker containers - 3.4 | ||
env: | ||
VERSION: ${{ matrix.VERSION }} | ||
uses: actions/checkout@v3 | ||
|
||
- name: Clone & Start netbox-docker containers - ${{ matrix.VERSION }} | ||
run: | | ||
cd .. | ||
git clone https://github.com/netbox-community/netbox-docker.git | ||
cd netbox-docker | ||
git checkout 2.3.0 | ||
tee docker-compose.override.yml <<EOF | ||
version: '3.4' | ||
services: | ||
netbox: | ||
image: netboxcommunity/netbox:v3.4 | ||
ports: | ||
- 32768:8080 | ||
EOF | ||
docker-compose up -d --quiet-pull | ||
git checkout ${{ matrix.NETBOX_DOCKER_VERSION }} | ||
cp $GITHUB_WORKSPACE/tests/netbox-docker/${{ matrix.VERSION }}/docker-compose.override.yml docker-compose.override.yml | ||
docker-compose up -d --quiet-pull netbox netbox-worker postgres redis redis-cache | ||
docker container ls | ||
cd .. | ||
if: matrix.VERSION == 'v3.4' | ||
- name: Set up Python ${{ env.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.python-version }} | ||
|
||
- name: Install and configure Poetry | ||
uses: snok/[email protected] | ||
with: | ||
virtualenvs-create: false | ||
|
||
- name: Install Python packages | ||
run: poetry install | ||
|
||
- name: Build and install collection | ||
run: | | ||
ansible-galaxy collection install community.general -p /home/runner/.ansible/collections | ||
ansible-galaxy collection build . | ||
ansible-galaxy collection install netbox*.tar.gz -p /home/runner/.ansible/collections | ||
- name: Wait for NetBox to be available | ||
run: | | ||
docker container ls | ||
docker logs netbox-docker_netbox_1 | ||
timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:32768)" != "200" ]]; do echo "waiting for NetBox"; sleep 5; done' || false | ||
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox | ||
#if: matrix.VERSION == 'v3.3' | ||
|
||
- name: Pre-populate NetBox | ||
run: ./tests/integration/netbox-deploy.py | ||
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox | ||
- name: Allow scripts to be executed | ||
# Set runme.sh execute permissions stripped by ansible-galaxy. Should be fixed in Ansible 2.10 | ||
# https://github.com/ansible/ansible/issues/68415 | ||
# Run render_config.sh to pass environment variables to integration tests | ||
# https://www.ansible.com/blog/adding-integration-tests-to-ansible-content-collections | ||
run: | | ||
chmod +x tests/integration/targets/inventory-${{ matrix.INTEGRATION_TESTS }}/runme.sh | ||
chmod +x tests/integration/targets/inventory-${{ matrix.INTEGRATION_TESTS }}/compare_inventory_json.py | ||
chmod +x tests/integration/render_config.sh | ||
tests/integration/render_config.sh tests/integration/targets/inventory/runme_config.template > tests/integration/targets/inventory-${{ matrix.INTEGRATION_TESTS }}/runme_config | ||
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox | ||
|
||
- name: Run integration tests | ||
# Run regression and integration tests | ||
# Run the inventory test first, in case any of the other tests modify the data. | ||
run: | | ||
ansible-test integration -v --color --coverage --python ${{ matrix.python-version }} inventory-${{ matrix.INTEGRATION_TESTS }} | ||
ansible-test integration -v --color --coverage --python ${{ matrix.python-version }} regression-${{ matrix.INTEGRATION_TESTS }} | ||
ansible-test integration -v --color --coverage --python ${{ matrix.python-version }} ${{ matrix.INTEGRATION_TESTS }} | ||
ansible-test integration -v --color --coverage --python ${{ env.python-version }} inventory-${{ matrix.VERSION }} | ||
ansible-test integration -v --color --coverage --python ${{ env.python-version }} regression-${{ matrix.VERSION }} | ||
ansible-test integration -v --color --coverage --python ${{ env.python-version }} ${{ matrix.VERSION }} | ||
ansible-test coverage report --all --omit "tests/*,hacking/*,docs/*" --show-missing | ||
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
name: Deploy collection to Ansible Galaxy | ||
on: | ||
create: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
--- | ||
version: 2 | ||
#sphinx: | ||
# configuration: docs/conf.py | ||
|
||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.9" | ||
|
||
python: | ||
version: 3.8 | ||
install: | ||
- requirements: docs/requirements.txt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
|
||
yaml-files: | ||
- '*.yaml' | ||
- '*.yml' | ||
- '.yamllint' | ||
|
||
rules: | ||
anchors: enable | ||
braces: enable | ||
brackets: enable | ||
colons: enable | ||
commas: enable | ||
comments: disable | ||
comments-indentation: disable | ||
document-end: disable | ||
document-start: | ||
level: warning | ||
empty-lines: enable | ||
empty-values: enable | ||
float-values: disable | ||
hyphens: enable | ||
indentation: disable | ||
key-duplicates: enable | ||
key-ordering: disable | ||
line-length: disable | ||
new-line-at-end-of-file: enable | ||
new-lines: enable | ||
octal-values: disable | ||
quoted-strings: disable | ||
trailing-spaces: enable | ||
truthy: disable |
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
Oops, something went wrong.