From 6cf23fe39834b3e7ee3a7c9d2048fa4ae982065e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ko=CC=88hler?= Date: Thu, 5 Dec 2024 20:34:48 +0100 Subject: [PATCH 1/3] GitHub Actions: added workflow to publish test/coverage/lint reports --- .../publish-reports-github-pages.yml | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .github/workflows/publish-reports-github-pages.yml diff --git a/.github/workflows/publish-reports-github-pages.yml b/.github/workflows/publish-reports-github-pages.yml new file mode 100644 index 00000000..3c08ef05 --- /dev/null +++ b/.github/workflows/publish-reports-github-pages.yml @@ -0,0 +1,94 @@ +name: "Publish test/coverage/lint reports to GitHub Pages" + +on: + workflow_call: + +concurrency: + group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + allure-report: + name: "Generate Allure Report (Aggregated Suites)" + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + # NOTE: actions/download-artifact@v4 now has merging functionality built in => no need for actions/upload-artifact/merge@v4 + # - name: "Merge test results (Allure)" + # uses: actions/upload-artifact/merge@v4 + # with: + # name: merged-allure-reports + # pattern: upload-python-allure-report-* + # # delete-merged: true + # retention-days: 1 + + - name: "Download and merge Allure coverage artifacts" + uses: actions/download-artifact@v4 + with: + pattern: upload-python-allure-report-* + merge-multiple: true + path: build/allure-results # destination + + - name: "Set up JDK (for Allure)" + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 17 + + - name: "Load test report history (Allure)" + uses: actions/checkout@v4 + if: always() + continue-on-error: true + with: + ref: gh-pages + path: gh-pages + + - name: "Build test report" + uses: simple-elf/allure-report-action@master + if: always() + with: + gh_pages: allure-results + # allure_history: allure-history + allure_results: build/allure-results + subfolder: allure + # subfolder: allure-results + + - name: "Publish test report" + uses: peaceiris/actions-gh-pages@v4 + if: always() + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: gh-pages + publish_dir: allure-history + destination_dir: ./ + # destination_dir: ./allure + keep_files: true + + python-coverage-report: + name: "Generate Coverage Report (Aggregated Suites)" + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: "Download and merge Python coverage artifacts" + uses: actions/download-artifact@v4 + with: + pattern: upload-python-coverage-report-* + merge-multiple: true + path: pycov # destination + + - name: Display structure of downloaded files + run: ls -R pycov + + - name: "Publish test report" + uses: peaceiris/actions-gh-pages@v4 + if: always() + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: gh-pages + publish_dir: pycov + destination_dir: pycov + keep_files: true From 763da3ce00a02d162096e87aa9c1940a5b5a8495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ko=CC=88hler?= Date: Thu, 5 Dec 2024 20:39:30 +0100 Subject: [PATCH 2/3] GitHub Actions: after CI-CD, trigger workflow to publish reports to GitHub Pages --- .github/workflows/ci-cd.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 23a5b0be..b7e56eb8 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -244,3 +244,8 @@ jobs: needs: build_and_test uses: ./.github/workflows/publish-pypi.yml + call-publish-reports-github-pages: + name: "Trigger workflow to publish reports to GitHub Pages" + needs: build_and_test + uses: ./.github/workflows/publish-reports-github-pages.yml + From 1f59485ecdc8cc06fd886ae856503cef36604d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Jan=20K=C3=B6hler?= Date: Mon, 9 Dec 2024 17:02:43 +0100 Subject: [PATCH 3/3] publish-pypi.yml: allow TestPyPi publish to fail --- .github/workflows/publish-pypi.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 8b452069..b1ee4590 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -13,7 +13,8 @@ jobs: publish-test-pypi: name: "Publish distribution 📦s to TestPyPI" runs-on: ubuntu-latest - + continue-on-error: true + permissions: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing