mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-02-04 07:11:49 +00:00
Add coverage
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
parent
caf6dfa23f
commit
709cadd3c5
2 changed files with 15 additions and 16 deletions
29
.github/workflows/test-inventory-examples.yml
vendored
29
.github/workflows/test-inventory-examples.yml
vendored
|
|
@ -19,6 +19,7 @@ on:
|
|||
|
||||
jobs:
|
||||
inventory_test:
|
||||
name: Functional inventory tests
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
@ -258,8 +259,11 @@ jobs:
|
|||
set -o pipefail
|
||||
ANSIBLE_INVENTORY_ENABLED=containers.podman.buildah_containers,yaml,ini \
|
||||
ansible-inventory -i ci/tmpinv/buildah_verbose.yml --list -vvvv 1>/tmp/buildah_verbose.out 2>/tmp/buildah_verbose.err || true
|
||||
echo "buildah_verbose.err:"
|
||||
cat /tmp/buildah_verbose.err
|
||||
grep -q "Filtered out hello-buildah by name_patterns option" /tmp/buildah_verbose.err
|
||||
echo "buildah_verbose.out:"
|
||||
cat /tmp/buildah_verbose.out
|
||||
grep -q "Filtered out hello-buildah by name_patterns option" /tmp/buildah_verbose.out
|
||||
|
||||
- name: Test buildah inventory - empty selection with name_patterns
|
||||
run: |
|
||||
|
|
@ -321,7 +325,6 @@ jobs:
|
|||
- name: Install requirements for tests
|
||||
run: >-
|
||||
python -m pip install --user -r test-requirements.txt
|
||||
pytest pytest-cov coverage
|
||||
|
||||
- name: Build a collection tarball
|
||||
run: >-
|
||||
|
|
@ -332,30 +335,24 @@ jobs:
|
|||
run: >-
|
||||
~/.local/bin/ansible-galaxy collection install ${GITHUB_WORKSPACE}/.cache/collection-tarballs/*.tar.gz
|
||||
|
||||
- name: Run collection unit tests
|
||||
- name: Run collection unit tests (with coverage)
|
||||
run: >-
|
||||
~/.local/bin/ansible-test units
|
||||
--python "${{ matrix.runner-python-version }}" -vvv
|
||||
--python "${{ matrix.runner-python-version }}" --coverage -vvv
|
||||
tests/unit/plugins/inventory/
|
||||
working-directory: >-
|
||||
/home/runner/.ansible/collections/ansible_collections/containers/podman
|
||||
|
||||
- name: Run pytest with coverage (inventory only)
|
||||
run: >-
|
||||
~/.local/bin/pytest -vv
|
||||
tests/unit/plugins/inventory/
|
||||
--cov=ansible_collections.containers.podman.plugins.inventory
|
||||
--cov-branch
|
||||
--cov-report=term-missing:skip-covered
|
||||
--cov-report=xml:coverage.xml
|
||||
--cov-report=html:htmlcov
|
||||
- name: Generate coverage reports (xml, html)
|
||||
run: |
|
||||
~/.local/bin/ansible-test coverage xml
|
||||
~/.local/bin/ansible-test coverage html
|
||||
working-directory: >-
|
||||
/home/runner/.ansible/collections/ansible_collections/containers/podman
|
||||
|
||||
- name: Upload coverage artifact
|
||||
- name: Upload coverage artifact (ansible-test outputs)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: inventory-coverage
|
||||
path: |
|
||||
/home/runner/.ansible/collections/ansible_collections/containers/podman/coverage.xml
|
||||
/home/runner/.ansible/collections/ansible_collections/containers/podman/htmlcov
|
||||
/home/runner/.ansible/collections/ansible_collections/containers/podman/tests/output/coverage/**
|
||||
|
|
|
|||
|
|
@ -2,3 +2,5 @@ ansible-core
|
|||
pytest
|
||||
pytest-forked
|
||||
pytest-xdist
|
||||
pytest-cov
|
||||
coverage==7.6.1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue