Skip to content

Exposing Timeout and Check_Mode Properties for Rest Send #2311

Exposing Timeout and Check_Mode Properties for Rest Send

Exposing Timeout and Check_Mode Properties for Rest Send #2311

Workflow file for this run

name: CI
on:
# Triggers the workflow on push or pull request events but only for the develop branch
push:
branches:
- develop
- main
pull_request:
branches:
- develop
- main
# schedule:
# # * is a special character in YAML so you have to quote this string
# - cron: '0 6 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# env:
# python_version: '3.11'
jobs:
pep8-black:
name: Pep8 Compliance - Black
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Check out code
uses: actions/checkout@v6
- name: Run black against code
uses: psf/black@stable
with:
options: "--check --diff --color -l 159"
build:
name: Build Collection
runs-on: ubuntu-latest
strategy: &ansible_strategy
fail-fast: false
# https://docs.ansible.com/projects/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix
# https://access.redhat.com/support/policy/updates/ansible-automation-platform#coreversion
matrix:
include:
# Ansible 2.19: supports Python 3.11 - 3.13
- ansible_version: "stable-2.19"
python_version: "3.13"
- ansible_version: "stable-2.19"
python_version: "3.12"
- ansible_version: "stable-2.19"
python_version: "3.11"
# Ansible 2.18: supports Python 3.11 - 3.13
- ansible_version: "stable-2.18"
python_version: "3.13"
- ansible_version: "stable-2.18"
python_version: "3.12"
- ansible_version: "stable-2.18"
python_version: "3.11"
# Ansible 2.17: supports Python 3.7 - 3.12
- ansible_version: "stable-2.17"
python_version: "3.12"
- ansible_version: "stable-2.17"
python_version: "3.11"
- ansible_version: "stable-2.17"
python_version: "3.10"
# Ansible 2.16: supports Python 3.10 - 3.12
- ansible_version: "stable-2.16"
python_version: "3.12"
- ansible_version: "stable-2.16"
python_version: "3.11"
- ansible_version: "stable-2.16"
python_version: "3.10"
steps:
- name: Check out code
uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install ansible-base (${{ matrix.ansible_version }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
- name: Build a collection tarball
run: ansible-galaxy collection build --output-path "${GITHUB_WORKSPACE}/.cache/collection-tarballs"
- name: Store migrated collection artifacts
uses: actions/upload-artifact@v7
with:
name: collection-${{ matrix.python_version }}-${{ matrix.ansible_version }}
path: .cache/collection-tarballs
ansible-galaxy-importer:
name: Ansible Galaxy-Importer Check
needs:
- pep8-black
- build
runs-on: ubuntu-latest
strategy: *ansible_strategy
steps:
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install ansible-core (${{ matrix.ansible_version }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
- name: Download migrated collection artifacts
uses: actions/download-artifact@v8
with:
name: collection-${{ matrix.python_version }}-${{ matrix.ansible_version }}
path: .cache/collection-tarballs
- name: Install the collection tarball
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
- name: Install galaxy-importer
run: pip install galaxy-importer
- name: Create galaxy-importer directory
run: sudo mkdir -p /etc/galaxy-importer
- name: Create galaxy-importer.cfg
run: |
sudo cp \
/home/runner/.ansible/collections/ansible_collections/cisco/nd/.github/workflows/galaxy-importer.cfg \
/etc/galaxy-importer/galaxy-importer.cfg
- name: Run galaxy-importer check
run: |
python -m galaxy_importer.main .cache/collection-tarballs/cisco-*.tar.gz \
| tee .cache/collection-tarballs/log.txt \
&& sudo cp ./importer_result.json .cache/collection-tarballs/importer_result.json
- name: Check warnings and errors
shell: python
run: |
# Check warnings and errors
err = 0
with open('.cache/collection-tarballs/log.txt', 'r', encoding='utf-8') as f:
for line in f:
if line.startswith('ERROR:') or line.startswith('WARNING:'):
print(line)
if 'Ignore files skip ansible-test sanity tests, found ignore' not in line:
err = 1
exit(err)
- name: Store galaxy_importer check log file
uses: actions/upload-artifact@v7
with:
name: galaxy-importer-log-${{ matrix.python_version }}-${{ matrix.ansible_version }}
path: .cache/collection-tarballs/importer_result.json
ansible-test:
name: Ansible-Test Sanity
needs:
- ansible-galaxy-importer
runs-on: ubuntu-latest
strategy: *ansible_strategy
steps:
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install ansible-base (${{ matrix.ansible_version }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
- name: Install coverage (v4.5.4)
run: pip install coverage==4.5.4
- name: Download migrated collection artifacts
uses: actions/download-artifact@v8
with:
name: collection-${{ matrix.python_version }}-${{ matrix.ansible_version }}
path: .cache/collection-tarballs
- name: Install the collection tarball
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
- name: Run sanity tests
run: ansible-test sanity --docker -v --color --truncate 0 --coverage
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
- name: Generate coverage report
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
- name: Push coverate report to codecov.io
run: bash <(curl -s https://codecov.io/bash) -s 'tests/output/reports/' -F sanity
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
units:
name: Unit Tests
needs:
- ansible-galaxy-importer
runs-on: ubuntu-latest
strategy: *ansible_strategy
steps:
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install ansible-base (${{ matrix.ansible_version }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
- name: Install coverage (v4.5.4)
run: pip install coverage==4.5.4
- name: Download migrated collection artifacts
uses: actions/download-artifact@v8
with:
name: collection-${{ matrix.python_version }}-${{ matrix.ansible_version }}
path: .cache/collection-tarballs
- name: Install the collection tarball
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
- name: Run unit tests
run: ansible-test units --docker -v --color --truncate 0 --python ${{ matrix.python_version }} --coverage
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
- name: Generate coverage report
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
- name: Push coverage report to codecov.io
run: bash <(curl -s https://codecov.io/bash) -s 'tests/output/reports/' -F unit
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
integration:
name: Integration Tests
if: false # No integration tests for now
needs:
- units
- ansible-test
runs-on: ubuntu-latest
strategy: *ansible_strategy
env:
MUTEX_URL: https://8v7s765ibh.execute-api.us-west-1.amazonaws.com
steps:
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install ansible-base (${{ matrix.ansible_version }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
- name: Install coverage (v4.5.4)
run: pip install coverage==4.5.4
- name: Download migrated collection artifacts
uses: actions/download-artifact@v8
with:
name: collection-${{ matrix.python_version }}-${{ matrix.ansible_version }}
path: .cache/collection-tarballs
- name: Install the collection tarball
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
- name: Requesting integration mutex
uses: nev7n/wait_for_response@v1
with:
url: ${{ format('{0}/v1/ansible-nd?repo={1}&run_id={2}', env.MUTEX_URL, github.repository, github.run_id) }}
responseCode: 200
timeout: 2000000
interval: 5000
- name: Run integration tests on Python ${{ matrix.python_version }}
run: |
ansible-test network-integration --docker -v --color --retry-on-error --python ${{ matrix.python_version }} \
--truncate 0 --continue-on-error --coverage
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
- name: Releasing integration mutex
uses: nev7n/wait_for_response@v1
if: always()
with:
url: ${{ format('{0}/v1/ansible-nd/release?repo={1}&run_id={2}', env.MUTEX_URL, github.repository, github.run_id) }}
responseCode: 200
- name: Generate coverage report
if: always()
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
- name: Push coverage report to codecov.io
if: always()
run: bash <(curl -s https://codecov.io/bash) -s 'tests/output/reports/' -F integration
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd