ci.yml installs mettalog #80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Job to Generate JUnit Reports with Diff and Allure Reports | |
on: | |
push: | |
branches: | |
- main | |
pull_request_target: | |
branches: | |
- main | |
permissions: | |
contents: write # Grant write permissions for contents | |
checks: write # Grant write permissions for checks, only effective on push | |
pull-requests: write # Explicitly grant write permissions for pull requests | |
jobs: | |
generate-reports: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install python packages | |
run: | | |
pip install ansi2html | |
pip install hyperon | |
pip install junit2html | |
- name: Make Install Script Executable | |
run: chmod +x INSTALL.sh | |
- name: Run Install Script to install Mettalog | |
run: | | |
. ./INSTALL.sh --easy | |
echo $PATH >> $GITHUB_PATH | |
- name: Make Test Script Executable | |
run: chmod +x scripts/run_commit_tests.sh | |
- name: Run Test Script to Generate Input File | |
continue-on-error: true | |
run: | | |
./scripts/run_commit_tests.sh | |
env: | |
TERM: xterm-256color | |
- name: Run JUnit Report Generation Script | |
continue-on-error: true | |
run: | | |
cat /tmp/SHARED.UNITS | |
python scripts/into_junit.py /tmp/SHARED.UNITS > junit.xml | |
- name: Convert JUnit XML to Standard HTML Report | |
continue-on-error: true | |
run: | | |
junit2html junit.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 | |
- name: Upload JUnit XML Report | |
continue-on-error: true | |
uses: actions/upload-artifact@v4 | |
with: | |
name: junit-report | |
path: junit.xml | |
- name: Upload Standard HTML Report | |
continue-on-error: true | |
uses: actions/upload-artifact@v4 | |
with: | |
name: junit-standard-html-report | |
path: junit-standard-report.html | |
- name: Upload Matrix HTML Report | |
continue-on-error: true | |
uses: actions/upload-artifact@v4 | |
with: | |
name: junit-matrix-html-report | |
path: junit-matrix-report.html | |
- name: Display JUnit Test Results | |
if: github.event_name == 'push' # Only run this step on pushes to main | |
uses: dorny/test-reporter@v1 | |
with: | |
name: 'JUnit Results' | |
path: 'junit.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" | |
- name: Upload JUnit Comparison Report | |
continue-on-error: true | |
uses: actions/upload-artifact@v4 | |
with: | |
name: junit-comparison-html-report | |
path: ./comparison-report | |
- name: Install Allure | |
run: | | |
curl -sLo allure-2.17.2.tgz https://github.com/allure-framework/allure2/releases/download/2.17.2/allure-2.17.2.tgz | |
tar -zxvf allure-2.17.2.tgz | |
sudo mv allure-2.17.2 /opt/allure | |
sudo ln -s /opt/allure/bin/allure /usr/bin/allure | |
- 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/ | |
fi | |
- name: Generate Allure Report | |
run: | | |
allure generate --clean --output ./allure-report ./allure-results | |
- name: Upload Allure Report as Artifact | |
continue-on-error: true | |
uses: actions/upload-artifact@v4 | |
with: | |
name: allure-html-report | |
path: ./allure-report | |
- name: Provide Report Links | |
run: | | |
echo "JUnit reports, Allure report, and test comparison reports are available as artifacts." | |
- name: Auto-Approve the Pull Request | |
if: github.event_name == 'pull_request_target' | |
uses: hmarr/auto-approve-action@v4 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Upload Allure Report as Pages Artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./allure-report | |
deploy-allure-report: | |
runs-on: ubuntu-latest | |
needs: generate-reports | |
permissions: | |
pages: write # Allow deployment to GitHub Pages | |
id-token: write | |
environment: | |
# environment created automatically by GitHub | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |