Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 53 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python 3.10.14
- name: Set up Python 3.11.9
uses: actions/setup-python@v5
with:
python-version: 3.10.14
python-version: 3.11.9

- name: Install ansible-base (v${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
Expand All @@ -51,12 +51,12 @@ jobs:
strategy:
matrix:
ansible: [2.14.15, 2.15.10, 2.16.5, 2.17.8]
python: ['3.10']
python: ['3.11']
steps:
- name: Set up Python 3.10.14
- name: Set up Python 3.11.9
uses: actions/setup-python@v5
with:
python-version: 3.10.14
python-version: 3.11.9

- name: Upgrade pip
run: |
Expand All @@ -77,3 +77,51 @@ jobs:
- name: Run sanity tests
run: ansible-test sanity --docker --python ${{matrix.python}} -v --color --truncate 0
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nac_dc_vxlan

unit:
name: Unit (Ⓐ${{ matrix.ansible }})
needs:
- build
runs-on: ubuntu-latest
strategy:
matrix:
ansible: [2.14.15, 2.15.10, 2.16.5, 2.17.8]
python: ['3.11']
steps:
- name: Set up Python 3.11.9
uses: actions/setup-python@v5
with:
python-version: 3.11.9

- name: Upgrade pip
run: |
pip install --upgrade pip

- name: Install ansible-base (v${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check

- name: Download migrated collection artifacts
uses: actions/download-artifact@v4
with:
name: collection-${{ matrix.ansible }}
path: .cache/collection-tarballs

- name: Install iac-validate (v0.2.7)
run: pip install iac-validate==0.2.7

- name: Install coverage (v7.9.2)
run: pip install coverage==7.9.2

- name: Install pytest (v8.4.1)
run: pip install pytest==8.4.1

- name: Install the collection tarball
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz

- name: Run unit tests
run: coverage run --source=. -m pytest tests/unit/. -vvvv
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nac_dc_vxlan

- name: Generate coverage report
run: coverage report --include="plugins/*"
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nac_dc_vxlan
2 changes: 2 additions & 0 deletions plugins/filter/version_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ def version_compare(version1, version2, op):
version1 (str): The first version string to compare.
version2 (str): The second version string to compare.
op (str): The comparison operator as a string. Supported: '==', '!=', '>', '>=', '<', '<='.

Returns:
bool: The result of the comparison.

Raises:
AnsibleError: If the 'packaging' library is not installed.
AnsibleFilterTypeError: If the version arguments are not strings.
Expand Down
Empty file.
Loading