From a06b01111ce215ff1b95da4f01c358be5bca71d0 Mon Sep 17 00:00:00 2001 From: januszjanus Date: Wed, 2 Oct 2024 15:04:12 +0200 Subject: [PATCH 1/5] add new workflow for allure report --- .github/workflows/generate-allure-report.yml | 39 ++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/generate-allure-report.yml diff --git a/.github/workflows/generate-allure-report.yml b/.github/workflows/generate-allure-report.yml new file mode 100644 index 00000000000..9621b7f285a --- /dev/null +++ b/.github/workflows/generate-allure-report.yml @@ -0,0 +1,39 @@ +name: Allure Report Generation + +on: + pull_request: + push: + branches: "main" + +permissions: + contents: write + pull-requests: write + id-token: write + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +env: + AWS_REGION: eu-central-1 + AWS_ROLE_ARN: arn:aws:iam::332405224602:role/ci + EARTHLY_TARGET: docker + ECR_REGISTRY: 332405224602.dkr.ecr.eu-central-1.amazonaws.com + ALLURE_REPORT_PATH: allure-report + COVERAGE_REPORT_PATH: coverage-report + REPORT_EXT: .junit-report.xml + COVERAGE_EXT: .info + +jobs: + generate-test-reports: + name: Generate test reports + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup CI + uses: input-output-hk/catalyst-ci/actions/setup@master + with: + aws_role_arn: ${{ env.AWS_ROLE_ARN }} + aws_region: ${{ env.AWS_REGION }} + earthly_runner_secret: ${{ secrets.EARTHLY_RUNNER_SECRET }} From 34c581d6810b9981ab3bd053779604fcda221814 Mon Sep 17 00:00:00 2001 From: januszjanus Date: Thu, 3 Oct 2024 10:22:45 +0200 Subject: [PATCH 2/5] test workflow --- .github/workflows/generate-allure-report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-allure-report.yml b/.github/workflows/generate-allure-report.yml index 9621b7f285a..bf9b8f8647d 100644 --- a/.github/workflows/generate-allure-report.yml +++ b/.github/workflows/generate-allure-report.yml @@ -3,7 +3,7 @@ name: Allure Report Generation on: pull_request: push: - branches: "main" + branches: [main] permissions: contents: write From 15681d210196e139a3d4cab4d867b11961536721 Mon Sep 17 00:00:00 2001 From: januszjanus Date: Thu, 3 Oct 2024 11:34:12 +0200 Subject: [PATCH 3/5] try generate,build and publish allure report --- .github/workflows/generate-allure-report.yml | 60 ++++++++++++++++++++ rust/Earthfile | 9 +-- 2 files changed, 65 insertions(+), 4 deletions(-) diff --git a/.github/workflows/generate-allure-report.yml b/.github/workflows/generate-allure-report.yml index bf9b8f8647d..68ebc9fe3cf 100644 --- a/.github/workflows/generate-allure-report.yml +++ b/.github/workflows/generate-allure-report.yml @@ -37,3 +37,63 @@ 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 diff --git a/rust/Earthfile b/rust/Earthfile index 00a26b0f4fe..a76ec1ff234 100644 --- a/rust/Earthfile +++ b/rust/Earthfile @@ -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 @@ -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: @@ -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 @@ -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 \ No newline at end of file + BUILD +build From 504d72b383171180f079e126e96b461ed0751c8c Mon Sep 17 00:00:00 2001 From: januszjanus Date: Thu, 3 Oct 2024 11:36:58 +0200 Subject: [PATCH 4/5] add temp manual triggering --- .github/workflows/generate-allure-report.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/generate-allure-report.yml b/.github/workflows/generate-allure-report.yml index 68ebc9fe3cf..75b355e030a 100644 --- a/.github/workflows/generate-allure-report.yml +++ b/.github/workflows/generate-allure-report.yml @@ -4,6 +4,7 @@ on: pull_request: push: branches: [main] + workflow_dispatch: permissions: contents: write From 153933338bd6fb6826d0b4c635e17e0fdfd02698 Mon Sep 17 00:00:00 2001 From: januszjanus Date: Thu, 3 Oct 2024 14:05:07 +0200 Subject: [PATCH 5/5] add allure report link to PR --- .github/workflows/generate-allure-report.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/generate-allure-report.yml b/.github/workflows/generate-allure-report.yml index 75b355e030a..3f221453e77 100644 --- a/.github/workflows/generate-allure-report.yml +++ b/.github/workflows/generate-allure-report.yml @@ -4,7 +4,6 @@ on: pull_request: push: branches: [main] - workflow_dispatch: permissions: contents: write @@ -98,3 +97,12 @@ jobs: 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