From b119da20ab520a5a14fe670bdb6205ae46a7deae Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Tue, 2 Jun 2026 11:11:11 -0700 Subject: [PATCH 1/2] minor changes --- .github/workflows/all_green_check.yml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/all_green_check.yml b/.github/workflows/all_green_check.yml index 463c0cc..6c51deb 100644 --- a/.github/workflows/all_green_check.yml +++ b/.github/workflows/all_green_check.yml @@ -35,6 +35,9 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + # ansible-test requires cwd under .../ansible_collections/{namespace}/{name}/ + path: ansible_collections/amazon/cloud - name: Set up Python uses: actions/setup-python@v5 @@ -47,22 +50,33 @@ jobs: python -m pip install "https://github.com/ansible/ansible/archive/${ANSIBLE_CORE_REF}.tar.gz" - name: Run unit tests with coverage + working-directory: ansible_collections/amazon/cloud run: ansible-test units --venv --coverage --python 3.10 --requirements - name: Combine and emit coverage XML + working-directory: ansible_collections/amazon/cloud run: | ansible-test coverage combine --venv --python 3.10 --requirements ansible-test coverage xml --venv --python 3.10 --requirements - name: Prepare coverage.xml for SonarCloud + env: + COLLECTION_DIR: ${{ github.workspace }}/ansible_collections/amazon/cloud run: | set -euo pipefail - mkdir -p "${GITHUB_WORKSPACE}" - xml=$(find tests/output/reports -maxdepth 1 -name '*.xml' ! -name '*powershell*' | head -1) - test -n "${xml}" + xml=$(find "${COLLECTION_DIR}/tests/output/reports" -maxdepth 1 -name '*.xml' ! -name '*powershell*' | head -1) + if [[ -z "${xml}" ]]; then + echo "::error::coverage XML not found under tests/output/reports" + exit 1 + fi cp "${xml}" "${GITHUB_WORKSPACE}/coverage.xml" - # Strip workspace prefix so Sonar sees repo-relative paths (same idea as amazon.aws path rewrite) sed -i "s#${GITHUB_WORKSPACE}/##g" "${GITHUB_WORKSPACE}/coverage.xml" + sed -i 's#ansible_collections/amazon/cloud/##g' "${GITHUB_WORKSPACE}/coverage.xml" + if ! grep -q ' Date: Tue, 2 Jun 2026 19:12:05 -0400 Subject: [PATCH 2/2] Check out amazon.aws collection for coverage job --- .github/workflows/all_green_check.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/all_green_check.yml b/.github/workflows/all_green_check.yml index 6c51deb..785baa4 100644 --- a/.github/workflows/all_green_check.yml +++ b/.github/workflows/all_green_check.yml @@ -39,6 +39,13 @@ jobs: # ansible-test requires cwd under .../ansible_collections/{namespace}/{name}/ path: ansible_collections/amazon/cloud + - name: Checkout amazon.aws dependency + uses: ansible-network/github_actions/.github/actions/checkout_dependency@47822b51aee957080e811cc434443c4e3bb9569a + with: + repository: ansible-collections/amazon.aws + path: ansible_collections/amazon/aws + ref: main + - name: Set up Python uses: actions/setup-python@v5 with: