Bump: Release v3.11.0 #1279
Workflow file for this run
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: "Collection code testing" | |
on: | |
pull_request: | |
branches-ignore: | |
- releases/** | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref }} | |
cancel-in-progress: true | |
jobs: | |
file-changes: | |
runs-on: ubuntu-latest | |
outputs: | |
code_v1: ${{ steps.filter.outputs.code_v1 }} | |
code_v3: ${{ steps.filter.outputs.code_v3 }} | |
dhcp_module: ${{ steps.filter.outputs.dhcp_module }} | |
docs: ${{ steps.filter.outputs.docs }} | |
python: ${{ steps.filter.outputs.python }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
code_v1: | |
- 'ansible_collections/arista/cvp/plugins/module_utils/schema_v1.py' | |
- 'ansible_collections/arista/cvp/plugins/module_utils/tools_inventory.py' | |
- 'ansible_collections/arista/cvp/plugins/module_utils/tools_tree.py' | |
- 'ansible_collections/arista/cvp/plugins/module_utils/tools.py' | |
- 'ansible_collections/arista/cvp/plugins/modules/cv_facts.py' | |
- 'ansible_collections/arista/cvp/plugins/modules/cv_configlet.py' | |
- 'ansible_collections/arista/cvp/plugins/modules/cv_container.py' | |
- 'ansible_collections/arista/cvp/plugins/modules/cv_device.py' | |
- 'ansible_collections/arista/cvp/plugins/modules/cv_task.py' | |
- '.github/workflows/*' | |
- 'ansible_collections/arista/cvp/molecule/*' | |
- 'ansible_collections/arista/cvp/molecule/**/*' | |
- '!ansible_collections/arista/cvp/galaxy.yml' | |
code_v3: | |
- 'ansible_collections/arista/cvp/plugins/module_utils/configlet_tools.py' | |
- 'ansible_collections/arista/cvp/plugins/module_utils/container_tools.py' | |
- 'ansible_collections/arista/cvp/plugins/module_utils/device_tools.py' | |
- 'ansible_collections/arista/cvp/plugins/module_utils/task_tools.py' | |
- 'ansible_collections/arista/cvp/plugins/module_utils/fact_tools.py' | |
- 'ansible_collections/arista/cvp/plugins/module_utils/image_tools.py' | |
- 'ansible_collections/arista/cvp/plugins/module_utils/tag_tools.py' | |
- 'ansible_collections/arista/cvp/plugins/module_utils/validate_tools.py' | |
- 'ansible_collections/arista/cvp/plugins/module_utils/response.py' | |
- 'ansible_collections/arista/cvp/plugins/module_utils/generic_tools.py' | |
- 'ansible_collections/arista/cvp/plugins/module_utils/schema_v3.py' | |
- 'ansible_collections/arista/cvp/plugins/modules/*_v3.py' | |
- '.github/workflows/*' | |
- 'tests/**/*' | |
- 'tests/*' | |
dhcp_module: | |
- 'ansible_collections/arista/cvp/roles/dhcp_configuration/*' | |
- 'ansible_collections/arista/cvp/roles/dhcp_configuration/**/*' | |
- '.github/workflows/*' | |
docs: | |
- 'mkdocs.yml' | |
- 'ansible_collections/arista/cvp/docs/**' | |
- 'ansible_collections/arista/cvp/roles/**/README.md' | |
- 'ansible_collections/arista/cvp/index.md' | |
- '.github/workflows/*' | |
python: | |
- 'ansible_collections/arista/cvp/plugins/**/*.py' | |
- '.github/workflows/*' | |
requirements: | |
- 'development/requirements-dev.txt' | |
- 'development/requirements.txt' | |
- 'ansible_collections/arista/cvp/requirements-dev.txt' | |
- 'ansible_collections/arista/cvp/requirements.txt' | |
- '.github/workflows/*' | |
pre_commit: | |
name: Run pre-commit validation hooks | |
runs-on: ubuntu-latest | |
needs: file-changes | |
if: needs.file-changes.outputs.dhcp_module == 'true' || needs.file-changes.outputs.code_v3 == 'true' || needs.file-changes.outputs.code_v1 == 'true' | |
steps: | |
# Removed as gh action is marked as deprecated | |
# - uses: pre-commit/[email protected] | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python 3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install requirements | |
run: | | |
pip install -r ansible_collections/arista/cvp/requirements-dev.txt --upgrade | |
pip install -r ansible_collections/arista/cvp/requirements.txt --upgrade | |
- name: Run pre-commit | |
run: | | |
pre-commit run --color always --from-ref origin/devel --to-ref HEAD | |
python_version_support: | |
name: Validate code compatibility | |
runs-on: ubuntu-latest | |
needs: [file-changes, pre_commit] | |
if: needs.file-changes.outputs.code_v3 == 'true' | |
strategy: | |
fail-fast: true | |
matrix: | |
python_version: ['3.9','3.10','3.11'] | |
steps: | |
- name: 'set environment variables' | |
run: | | |
echo "PY_COLORS=1" >> $GITHUB_ENV | |
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Test code compatibility | |
run: | | |
cd ansible_collections/arista/cvp/plugins | |
python3 -m compileall -q module_utils | |
python3 -m compileall -q modules | |
pytest: | |
name: Validate code V3 with Pytest | |
runs-on: ubuntu-latest | |
needs: [python_version_support] | |
if: needs.file-changes.outputs.code_v3 == 'true' || needs.file-changes.outputs.requirements == 'true' | |
strategy: | |
fail-fast: true | |
matrix: | |
python_version: ['3.9','3.10','3.11','3.12'] | |
steps: | |
- name: 'set environment variables' | |
run: | | |
echo "PY_COLORS=1" >> $GITHUB_ENV | |
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Install requirements | |
# Removing ansible-lint in requirement-dev-3.9 to allow requirements installation for Python 3.9. | |
run: | | |
pip install -r ansible_collections/arista/cvp/requirements-dev-pytest.txt | |
pip install -r ansible_collections/arista/cvp/requirements.txt | |
- name: 'Execute pytest validation' | |
run: | | |
cd tests/ | |
make unit-tests | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: pytest-report | |
path: | | |
./tests/report.html | |
./tests/htmlcov | |
molecule_cv_modules: | |
name: Validate code V1 with Molecule | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
ansible_version: | |
- 'ansible-core>=2.15.0,<2.18.0 --upgrade' | |
cvp_scenario: | |
- cv_configlet_loose | |
- cv_configlet_strict | |
- cv_device | |
needs: [file-changes, pre_commit] | |
if: needs.file-changes.outputs.code_v1 == 'true' | |
steps: | |
- name: 'set environment variables' | |
run: | | |
echo "PY_COLORS=1" >> $GITHUB_ENV | |
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- name: Run molecule action | |
uses: arista-netdevops-community/[email protected] | |
with: | |
molecule_parentdir: 'ansible_collections/arista/cvp' | |
molecule_command: 'test' | |
molecule_args: '--scenario-name ${{ matrix.cvp_scenario }}' | |
pip_file: ansible_collections/arista/cvp/requirements.txt | |
galaxy_file: "ansible_collections/arista/cvp/collections.yml" | |
ansible: "${{ matrix.ansible_version }}" | |
check_git: true | |
check_git_enforced: false | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: molecule-${{ matrix.cvp_scenario }}-artifacts | |
path: ansible_collections/arista/cvp/molecule/${{ matrix.cvp_scenario }} | |
molecule_dhcp: | |
name: Validate Roles for DHCP management | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
ansible_version: ['ansible-core==2.15.0', 'ansible-core<2.18.0'] | |
cvp_scenario: | |
- dhcp_management_mac | |
- dhcp_management_offline | |
- dhcp_system_mac | |
needs: [file-changes, pre_commit] | |
if: needs.file-changes.outputs.dhcp_module == 'true' | |
steps: | |
- name: 'set environment variables' | |
run: | | |
echo "PY_COLORS=1" >> $GITHUB_ENV | |
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- name: Run molecule action | |
uses: arista-netdevops-community/[email protected] | |
with: | |
molecule_parentdir: 'ansible_collections/arista/cvp' | |
molecule_command: 'test' | |
molecule_args: '--scenario-name ${{ matrix.cvp_scenario }}' | |
pip_file: ansible_collections/arista/cvp/requirements.txt | |
galaxy_file: "ansible_collections/arista/cvp/collections.yml" | |
ansible: "${{ matrix.ansible_version }}" | |
check_git: true | |
check_git_enforced: false | |
offline_link_check: | |
name: 'Validate mkdoc links' | |
runs-on: ubuntu-latest | |
needs: [file-changes] | |
if: needs.file-changes.outputs.docs == 'true' | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'start docker compose stack' | |
run: | | |
docker compose -f development/docker-compose.yml up -d webdoc_cvp | |
docker compose -f development/docker-compose.yml ps | |
- name: 'test connectivity to mkdoc server' | |
run: | | |
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' 127.0.0.1:8000)" != "200" ]]; do sleep 5; done' | |
- name: check links for 404 | |
run: | | |
docker run --network container:webdoc_cvp raviqqe/muffet:2.10.1 http://127.0.0.1:8000/ -f \ | |
--buffer-size 8192 \ | |
--exclude ".*fonts.googleapis.com.*" \ | |
--exclude ".*fonts.gstatic.com.*" \ | |
--exclude ".*tools.ietf.org.*" \ | |
--exclude ".*edit.*" \ | |
--exclude ".*docs.github.com.*" \ | |
--exclude "twitter.com" \ | |
--exclude "www.docker.com" \ | |
--exclude "hub.docker.com" \ | |
--exclude "tech-library.arista.com" \ | |
--max-connections-per-host 30 \ | |
--max-redirections 3 \ | |
--rate-limit 1 \ | |
--timeout 30 | |
- name: 'stop docker compose stack' | |
run: | | |
docker compose -f development/docker-compose.yml down | |
ansible_test: | |
name: Run ansible-test validation | |
runs-on: ubuntu-latest | |
needs: [molecule_dhcp, molecule_cv_modules, pytest] | |
if: always() | |
env: | |
PY_COLORS: 1 # allows molecule colors to be passed to GitHub Actions | |
ANSIBLE_FORCE_COLOR: 1 # allows ansible colors to be passed to GitHub Actions | |
strategy: | |
fail-fast: true | |
matrix: | |
python_version: ['3.10'] | |
steps: | |
- name: 'set environment variables' | |
run: | | |
echo "PY_COLORS=1" >> $GITHUB_ENV | |
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: 'Install Python requirements' | |
run: make install-requirements | |
- name: 'ansible-test linting' | |
run: | | |
cd ansible_collections/arista/cvp/ | |
ansible-test sanity -v --requirements --docker --python ${{ matrix.python_version }} | |
ansible_lint: | |
name: Run ansible-lint test case | |
runs-on: ubuntu-latest | |
needs: [ file-changes ] | |
steps: | |
- name: 'Set environment variables' | |
run: | | |
echo "PY_COLORS=1" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: | | |
3.10 | |
- name: 'Install Python & Ansible requirements' | |
run: | | |
pip install -r ansible_collections/arista/cvp/requirements.txt -r ansible_collections/arista/cvp/requirements-dev.txt --upgrade | |
- name: 'Run ansible-test integration test cases' | |
run: | | |
cd ansible_collections/arista/cvp/ | |
ansible-lint --force-color --strict -v | |
# ----------------------------------- # | |
# Galaxy Importer | |
# ----------------------------------- # | |
galaxy_importer: | |
name: Test galaxy-importer | |
runs-on: ubuntu-20.04 # Older version to be compatible with old python | |
env: | |
PY_COLORS: 1 # allows molecule colors to be passed to GitHub Actions | |
ANSIBLE_FORCE_COLOR: 1 # allows ansible colors to be passed to GitHub Actions | |
GALAXY_IMPORTER_CONFIG: galaxy-importer/galaxy-importer.cfg | |
steps: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: | | |
3.10 | |
- uses: actions/checkout@v4 | |
- name: 'Install Python & Ansible requirements' | |
run: | | |
pip install -r ansible_collections/arista/cvp/requirements.txt -r ansible_collections/arista/cvp/requirements-dev.txt --upgrade | |
ansible-galaxy collection install -r ansible_collections/arista/cvp/collections.yml | |
- name: Install galaxy-importer | |
# Install the specific version of galaxy-importer used on galaxy.ansible.com | |
# The version conflicts with our requirements, | |
# so we let the galaxy-importer version resolve remaining requirements. | |
run: | | |
pip install "galaxy-importer==0.4.20" | |
- name: 'Build ansible package' | |
run: make collection-build | |
- name: 'Run galaxy-importer checks' | |
run: python -m galaxy_importer.main *.tar.gz | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: importer-logs | |
path: ./importer_result.json |