Skip to content

Commit

Permalink
ci(general): Add test reporting to catalyst libs repo (#47)
Browse files Browse the repository at this point in the history
* add new workflow for allure report

* test workflow

* try generate,build and publish allure report

* add temp manual triggering

* add allure report link to PR
  • Loading branch information
oldGreg5 authored Oct 3, 2024
1 parent 75754af commit d74f273
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 5 deletions.
71 changes: 70 additions & 1 deletion .github/workflows/generate-allure-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Allure Report Generation
on:
pull_request:
push:
branches: "main"
branches: [main]

permissions:
contents: write
Expand Down Expand Up @@ -37,3 +37,72 @@ jobs:
aws_role_arn: ${{ env.AWS_ROLE_ARN }}
aws_region: ${{ env.AWS_REGION }}
earthly_runner_secret: ${{ secrets.EARTHLY_RUNNER_SECRET }}

- name: Get catalyst libs unit test report
uses: input-output-hk/catalyst-ci/actions/run@master
if: always()
continue-on-error: true
with:
earthfile: ./rust/
flags:
targets: build
target_flags:
runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }}
artifact: "false"

- name: Collect and upload test reports
uses: actions/upload-artifact@v4
if: always()
with:
name: test-reports
path: "**/*${{ env.REPORT_EXT }}"
if-no-files-found: error
retention-days: 1

generate-allure-report:
name: Generate allure report
runs-on: ubuntu-latest
needs: [generate-test-reports]
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: test-reports

- name: Setup Allure report
run: |
mkdir -p ${{ env.ALLURE_REPORT_PATH }}
shopt -s globstar
cp **/*${{ env.REPORT_EXT }} ${{ env.ALLURE_REPORT_PATH }}
ls ${{ env.ALLURE_REPORT_PATH }}
- name: Checkout gh-pages
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages-dir

- name: Build Allure report
uses: mgrybyk/allure-report-branch-action@v1
id: allure
with:
report_id: "test-report"
gh_pages: "gh-pages-dir"
report_dir: ${{ env.ALLURE_REPORT_PATH }}

- name: Git push to gh-pages
uses: mgrybyk/git-commit-pull-push-action@v1
with:
repository: gh-pages-dir
branch: gh-pages
pull_args: --rebase -X ours

- name: Comment PR with Allure report link
if: ${{ always() && github.event_name == 'pull_request' && steps.allure.outputs.report_url }}
uses: thollander/actions-comment-pull-request@v2
with:
message: |
${{ steps.allure.outputs.test_result_icon }} [Test Report](${{ steps.allure.outputs.report_url }}) | ${\color{lightgreen}Pass: ${{ steps.allure.outputs.test_result_passed }}/${{ steps.allure.outputs.test_result_total }}}$ | ${\color{red}Fail: ${{ steps.allure.outputs.test_result_failed }}/${{ steps.allure.outputs.test_result_total }}}$ |
comment_tag: allure_report
mode: upsert
9 changes: 5 additions & 4 deletions rust/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ sync-cfg:

# builder : Set up our target toolchains, and copy our files.
builder:
DO rust-ci+SETUP
DO rust-ci+SETUP

builder-src:
FROM +builder
Expand All @@ -36,7 +36,7 @@ builder-src:

# Generate Checksums of the source
DO rust-ci+FINGERPRINT_SRC
SAVE ARTIFACT ../src_fingerprint.txt
SAVE ARTIFACT ../src_fingerprint.txt

# check : Run basic check.
check:
Expand All @@ -50,11 +50,12 @@ build:

DO rust-ci+EXECUTE \
--cmd="/scripts/std_build.py" \
--output="release/[^\./]+" \
--args1="--libs=c509-certificate --libs=cardano-chain-follower --libs=hermes-ipfs" \
--args2="--libs=cbork-cddl-parser --libs=cbork-abnf-parser" \
--args3="--libs=catalyst-voting" \
--args4="--bins=cbork/cbork" \
--output="release/[^\./]+" \
--junit="cat-libs.junit-report.xml" \
--docs="true"

SAVE ARTIFACT target/$TARGETARCH/doc doc
Expand Down Expand Up @@ -86,4 +87,4 @@ check-builder-src-cache:
# local-ci-run: This step simulates the full CI run for local purposes only.
local-ci-run:
BUILD +check
BUILD +build
BUILD +build

0 comments on commit d74f273

Please sign in to comment.