Skip to content

Commit

Permalink
Towards Feature Request: Include Historical Data in Allure Reports wi…
Browse files Browse the repository at this point in the history
…th Commit References trueagi-io#89
  • Loading branch information
TeamSPoon committed Aug 18, 2024
1 parent a1a8807 commit b965138
Showing 1 changed file with 42 additions and 18 deletions.
60 changes: 42 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ jobs:
- name: Make Shell Script Executable
run: chmod +x scripts/run_commit_tests.sh

- name: Download Historical JUnit Reports
uses: actions/download-artifact@v4
with:
name: junit-history
path: ./history

- name: Unzip Historical Reports
run: |
unzip -o ./history/junit-history.zip -d ./allure-results
- name: Run Shell Script to Generate Input File
continue-on-error: true
run: |
Expand All @@ -43,22 +53,33 @@ jobs:
run: |
python scripts/into_junit.py /tmp/SHARED.UNITS > junit.xml
- name: Store JUnit Report with Timestamp and Metadata
run: |
TIMESTAMP=$(date +'%Y-%m-%d-%H-%M-%S')
COMMIT_SHA=$(git rev-parse HEAD)
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
mv junit.xml junit-${TIMESTAMP}.xml
echo "Commit SHA: ${COMMIT_SHA}" > ./allure-results/environment-${TIMESTAMP}.properties
echo "Branch: ${BRANCH_NAME}" >> ./allure-results/environment-${TIMESTAMP}.properties
cp junit-${TIMESTAMP}.xml ./allure-results/
cp ./allure-results/environment-${TIMESTAMP}.properties ./allure-results/environment.properties
- name: Convert JUnit XML to Standard HTML Report
continue-on-error: true
run: |
junit2html junit.xml junit-standard-report.html
junit2html junit-${TIMESTAMP}.xml junit-standard-report.html
- name: Convert JUnit XML to Matrix HTML Report
continue-on-error: true
run: |
junit2html --report-matrix junit-matrix-report.html junit.xml
junit2html --report-matrix junit-matrix-report.html junit-${TIMESTAMP}.xml
- name: Upload JUnit XML Report
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: junit-report
path: junit.xml
path: junit-${TIMESTAMP}.xml

- name: Upload Standard HTML Report
continue-on-error: true
Expand All @@ -79,24 +100,17 @@ jobs:
uses: dorny/test-reporter@v1
with:
name: 'JUnit Results'
path: 'junit.xml'
path: junit-${TIMESTAMP}.xml
reporter: 'java-junit'
fail-on-error: false

- name: Download Previous JUnit Results
continue-on-error: true
uses: actions/download-artifact@v4
with:
name: junit-report
path: previous-junit.xml

- name: Install ReportGenerator
run: |
dotnet tool install -g dotnet-reportgenerator-globaltool
- name: Compare JUnit Test Results with ReportGenerator
run: |
reportgenerator -reports:"previous-junit.xml;junit.xml" -targetdir:"./comparison-report" -reporttypes:"HtmlSummary;HtmlChart"
reportgenerator -reports:"./allure-results/*.xml" -targetdir:"./comparison-report" -reporttypes:"HtmlSummary;HtmlChart"
- name: Upload JUnit Comparison Report
continue-on-error: true
Expand All @@ -115,12 +129,12 @@ jobs:
- name: Prepare Allure Results Directory
run: |
mkdir -p ./allure-results
cp junit.xml ./allure-results/
if [ -f "previous-junit.xml" ]; then
cp previous-junit.xml ./allure-results/
cp junit-${TIMESTAMP}.xml ./allure-results/
if [ -f "./allure-results/previous-junit.xml" ]; then
cp ./allure-results/previous-junit.xml ./allure-results/
fi
- name: Generate Allure Report
- name: Generate Allure Report with Full History
run: |
allure generate --clean --output ./allure-report ./allure-results
Expand All @@ -131,6 +145,16 @@ jobs:
name: allure-html-report
path: ./allure-report

- name: Zip and Update Historical JUnit Reports with Metadata
run: |
zip -r junit-history.zip ./allure-results/*.xml ./allure-results/environment-*.properties
- name: Upload Updated JUnit History
uses: actions/upload-artifact@v4
with:
name: junit-history
path: junit-history.zip

- name: Provide Report Links
run: |
echo "JUnit reports, Allure report, and test comparison reports are available as artifacts."
Expand All @@ -143,7 +167,7 @@ jobs:

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload Allure Report as Pages Artifact
uses: actions/upload-pages-artifact@v3
with:
Expand All @@ -165,4 +189,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v4

0 comments on commit b965138

Please sign in to comment.