From 30da652a66c91bf8ba99bfc2282350f56bfbbb70 Mon Sep 17 00:00:00 2001 From: Moiz Habibi Date: Mon, 11 Nov 2024 15:46:52 -0500 Subject: [PATCH] Replaces the plugin that was used in Jenkins that would consolidate all of the individual Cucumber reports into one. Once generated, it will publish the reports to reports.cucumber.io under the aiSSEMBLE collection. --- .github/workflows/build.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d6f40ee8..f2ac19098 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ on: type: string default: "dev" push: - branches: [ "dev" ] + branches: [ "447-publish-consolidated-cucumber-report-gh-actions" ] schedule: - cron: "0 6 * * *" # every day at 6am UTC @@ -117,3 +117,23 @@ jobs: with: path: ~/.m2/build-cache key: maven-build-cache-${{ hashFiles('**/pom.xml') }} + # Generate & Publish Cucumber report + - name: Install Cucumber HTML Reporter + run: npm install multiple-cucumber-html-reporter + - name: Aggregate Cucumber JSON files + run: | + mkdir -p cucumber-reports + cp **/cucumber.json cucumber_reports/ + npx multiple-cucumber-html-reporter --jsonDir=cucumber_reports --reportPath=./cucumber_report + - name: Publish Cucumber Report + env: + CUCUMBER_PUBLISH_TOKEN: "b9aed90d-fac1-4b6c-bc07-83d0df2d8bbf" + run: | + # Publish each JSON file to Cucumber Reports + for report in cucumber_reports/*.json; do + cat "$report" | curl -X POST \ + -H "Content-Type: Application/json" \ + -H "Authorization: Bearer b9aed90d-fac1-4b6c-bc07-83d0df2d8bbf \ + -d @- \ + https://reports.cucumber.io/api/reports + done