Skip to content

Commit

Permalink
Merge pull request #7 from martinjankoehler/reports
Browse files Browse the repository at this point in the history
Publish Python Reports to GitHub Pages
  • Loading branch information
martinjankoehler authored Dec 9, 2024
2 parents e8e5208 + 1f59485 commit a9f57d1
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

3 changes: 2 additions & 1 deletion .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
94 changes: 94 additions & 0 deletions .github/workflows/publish-reports-github-pages.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a9f57d1

Please sign in to comment.