Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion .github/workflows/publish_pages.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,56 @@
name: Publish Pages

# Required permissions for GitHub Pages OIDC deployment token
permissions:
contents: read # to fetch the repository
pages: write # to publish to Pages
id-token: write # to request the OIDC token (fixes ACTIONS_ID_TOKEN_REQUEST_URL error)

on:
push:
branches: [ master ]
paths:
- '.github/workflows/publish_pages.yml'
- 'Help/**'
- 'docs/**'
workflow_dispatch:
workflow_run:
workflows: ["CI (master)"]
types:
- completed

# Ensure only one Pages deployment runs at a time
concurrency:
group: pages
cancel-in-progress: false

jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
timeout-minutes: 15
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: "Guard: Validate site content exists"
run: |
set -euo pipefail
if [ ! -d Help ]; then
echo "Help directory missing; aborting publish." >&2
exit 1
fi
if [ ! -f Help/index.html ] && [ ! -f Help/Index.html ]; then
echo "No index.html/Index.html in Help; aborting publish." >&2
ls -al Help || true
exit 1
fi
echo "Help directory and index file found. Proceeding."

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

Expand Down
44 changes: 41 additions & 3 deletions .github/workflows/template_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
dotnet test "$proj" --framework "$tfm" --no-build --no-restore --configuration Release \
--logger "trx;LogFileName=${tfm}-results.trx" \
--collect "XPlat Code Coverage" \
--results-directory "$resultsDir" || echo "Test failures captured for $proj ($tfm)"
--results-directory "$resultsDir"
done

- name: Upload test results
Expand Down Expand Up @@ -141,15 +141,53 @@ jobs:
if: always()
steps:
- name: Aggregate matrix result
id: aggregate
run: |
echo "Aggregating test matrix results..."
result='${{ needs.build-test.result }}'
echo "Matrix overall result: $result"
if [ "$result" != "success" ]; then
echo "One or more test legs failed. See individual build-test jobs."
echo "Matrix failed. See individual build-test jobs." >> $GITHUB_STEP_SUMMARY
echo "matrix-status=$result" >> $GITHUB_OUTPUT
exit 1
fi
echo "All test legs passed." >> $GITHUB_STEP_SUMMARY
echo "matrix-status=$result" >> $GITHUB_OUTPUT
echo "### Test Matrix Summary" >> $GITHUB_STEP_SUMMARY
echo "All frameworks succeeded." >> $GITHUB_STEP_SUMMARY

- name: Download test artifacts
if: steps.aggregate.outputs.matrix-status == 'success'
uses: actions/download-artifact@v4
with:
pattern: test-results-*
path: test-artifacts
merge-multiple: true

- name: Coverage summary
if: steps.aggregate.outputs.matrix-status == 'success'
run: |
set -euo pipefail
shopt -s globstar nullglob
files=(test-artifacts/**/coverage.cobertura.xml)
if [ ${#files[@]} -eq 0 ]; then
echo "No coverage.cobertura.xml files found." >> $GITHUB_STEP_SUMMARY
exit 0
fi
total_covered=0
total_valid=0
for f in "${files[@]}"; do
covered=$(sed -n 's/.*lines-covered="\([0-9]\+\)".*/\1/p' "$f" | head -n1 || echo 0)
valid=$(sed -n 's/.*lines-valid="\([0-9]\+\)".*/\1/p' "$f" | head -n1 || echo 0)
if [ -n "$covered" ] && [ -n "$valid" ]; then
total_covered=$(( total_covered + covered ))
total_valid=$(( total_valid + valid ))
fi
done
echo "### Coverage" >> $GITHUB_STEP_SUMMARY
if [ "$total_valid" -gt 0 ]; then
pct=$(awk -v c="$total_covered" -v v="$total_valid" 'BEGIN { if (v>0) printf "%.2f", (c/v)*100; }')
echo "Combined line coverage: ${pct}% (${total_covered}/${total_valid})" >> $GITHUB_STEP_SUMMARY
else
echo "Unable to compute coverage (no valid line counts)." >> $GITHUB_STEP_SUMMARY
fi