Skip to content

NLightning Combined Coverage Report (Push) #54

NLightning Combined Coverage Report (Push)

NLightning Combined Coverage Report (Push) #54

name: NLightning Combined Coverage Report (Push)
on:
workflow_run:
workflows: [ "NLightning .NET Build & Tests (Push)" ]
types:
- completed
jobs:
combined-report:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure' }}
steps:
- uses: actions/checkout@v4
- name: Wait for all workflows to complete
run: |
REQUIRED_WORKFLOWS=(
"NLightning .NET Build & Tests (Push)"
"NLightning.Native .NET Build & Tests (Push)"
"NLightning.Wasm .NET Build & Tests (Push)"
)
echo "Waiting for all workflows to complete for commit ${{ github.event.workflow_run.head_sha }}"
# Set timeout to 5 minutes (300 seconds)
TIMEOUT=300
ELAPSED=0
SLEEP_INTERVAL=30
while [ $ELAPSED -lt $TIMEOUT ]; do
all_complete=true
for workflow in "${REQUIRED_WORKFLOWS[@]}"; do
# Get the latest run for this workflow and commit
run_data=$(gh api repos/${{ github.repository }}/actions/runs \
--jq ".workflow_runs[] | select(.head_sha==\"${{ github.event.workflow_run.head_sha }}\" and .name==\"$workflow\") | {status: .status, conclusion: .conclusion}" \
| head -1)
run_status=$(echo "$run_data" | jq -r '.status')
run_conclusion=$(echo "$run_data" | jq -r '.conclusion')
echo "Workflow '$workflow': status=$run_status, conclusion=$run_conclusion"
if [ "$run_status" != "completed" ]; then
all_complete=false
break
fi
done
if [ "$all_complete" = true ]; then
echo "✅ All workflows completed!"
exit 0
else
echo "⏳ Still waiting for workflows to complete... (${ELAPSED}s/${TIMEOUT}s)"
sleep $SLEEP_INTERVAL
ELAPSED=$((ELAPSED + SLEEP_INTERVAL))
fi
done
echo "❌ Timeout reached after ${TIMEOUT} seconds. Not all workflows completed in time."
exit 1
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Download Standard Coverage
uses: dawidd6/action-download-artifact@v3
with:
workflow: dotnet.yml
name: coverage
path: coverage-reports/standard
- name: Download Native Coverage
uses: dawidd6/action-download-artifact@v3
with:
workflow: dotnet.native.yml
name: coverage.Native
path: coverage-reports/native
- name: Download WASM Coverage
uses: dawidd6/action-download-artifact@v3
with:
workflow: dotnet.wasm.yml
name: coverage.Wasm
path: coverage-reports/wasm
- name: List All Downloaded Files
run: find coverage-reports -type f | sort
- name: Combine All Coverage Reports
uses: danielpalme/ReportGenerator-GitHub-Action@5.2.4
with:
reports: "coverage-reports/**/Cobertura.xml"
targetdir: "${{ github.workspace }}/combined-report"
reporttypes: "Cobertura;Html;Badges"
verbosity: "Info"
title: "Combined Code Coverage"
tag: "${{ github.run_number }}_${{ github.run_id }}"
toolpath: "reportgeneratortool"
assemblyfilters: "+*;-NLightning.Infrastructure.Blazor;-NLightning.BlazorTestApp"
- name: Generate Combined Coverage Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: combined-report/Cobertura.xml
badge: true
fail_below_min: false
format: markdown
hide_branch_rate: false
hide_complexity: false
indicators: true
output: both
thresholds: '50 75'
- name: Copy Reports to DocFX
run: |
mkdir -p .docfx/docs/coverage-reports
cp -r combined-report/* .docfx/docs/coverage-reports/
- name: Upload Coverage for DocFX
uses: actions/upload-artifact@v4
with:
name: coverage-docfx
path: .docfx/docs/coverage-reports/
retention-days: 5