diff --git a/.github/workflows/python-test-coverage-report.yml b/.github/workflows/python-test-coverage-report.yml new file mode 100644 index 000000000000..7f0d323bb710 --- /dev/null +++ b/.github/workflows/python-test-coverage-report.yml @@ -0,0 +1,38 @@ +name: Python Test Coverage Report + +on: + workflow_run: + workflows: ["Python Test Coverage"] + types: + - completed + +jobs: + python-test-coverage-report: + runs-on: ubuntu-latest + if: github.event.workflow_run.conclusion == 'success' + continue-on-error: false + defaults: + run: + working-directory: python + steps: + - uses: actions/checkout@v4 + - name: Download coverage report + uses: actions/download-artifact@v4 + with: + github-token: ${{ secrets.GH_ACTIONS_PR_WRITE }} + run-id: ${{ github.event.workflow_run.id }} + path: ./python + merge-multiple: true + - name: Display structure of downloaded files + run: ls + - name: Pytest coverage comment + id: coverageComment + uses: MishaKav/pytest-coverage-comment@main + with: + pytest-coverage-path: python/python-coverage.txt + title: "Python Test Coverage Report" + badge-title: "Python Test Coverage" + junitxml-title: "Python Unit Test Overview" + junitxml-path: python/pytest.xml + default-branch: "main" + report-only-changed-files: true diff --git a/.github/workflows/python-test-coverage.yml b/.github/workflows/python-test-coverage.yml index 59bdb8f4aaba..7ffc9925fb34 100644 --- a/.github/workflows/python-test-coverage.yml +++ b/.github/workflows/python-test-coverage.yml @@ -10,11 +10,6 @@ env: # Configure a constant location for the uv cache UV_CACHE_DIR: /tmp/.uv-cache -permissions: - contents: write - checks: write - pull-requests: write - jobs: python-tests-coverage: runs-on: ubuntu-latest @@ -26,8 +21,6 @@ jobs: UV_PYTHON: "3.10" steps: - uses: actions/checkout@v4 - - name: Setup filename variables - run: echo "FILE_ID=${{ github.event.number }}" >> $GITHUB_ENV - name: Set up uv uses: astral-sh/setup-uv@v4 with: @@ -38,16 +31,12 @@ jobs: run: uv sync --all-extras --dev - name: Test with pytest run: uv run --frozen pytest -q --junitxml=pytest.xml --cov=semantic_kernel --cov-report=term-missing:skip-covered ./tests/unit | tee python-coverage.txt - - name: Pytest coverage comment - id: coverageComment - uses: MishaKav/pytest-coverage-comment@main - continue-on-error: false + - name: Upload coverage report + uses: actions/upload-artifact@v4 with: - pytest-coverage-path: python/python-coverage.txt - coverage-path-prefix: "python/" - title: "Python Test Coverage Report" - badge-title: "Python Test Coverage" - junitxml-title: "Python Unit Test Overview" - junitxml-path: python/pytest.xml - default-branch: "main" - report-only-changed-files: true + path: | + python/python-coverage.txt + python/pytest.xml + overwrite: true + retention-days: 1 + if-no-files-found: error