Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
47 changes: 41 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ on:
# Build/publish the image when changes land on main; run on pull requests (so
# the required checks report on PRs); allow manual runs via the "Run workflow"
# button. No push trigger on other branches -- use dispatch for those.
# Release tags run the same build, plus the full physics validation and the
# Pages deployment (both gated on refs/tags below).
push:
branches: [main]
tags: ['v*']
workflow_dispatch:
pull_request:

Expand Down Expand Up @@ -107,12 +110,11 @@ jobs:
# ------------------------------------------------------ physics validation --
physics-validation:
# Run the sim -> digi -> reco -> plot chain against the freshly published
# multi-arch sim image after merges, manual builds, and same-repository pull
# requests. Pull requests also get the quicker validation above.
# multi-arch sim image. This is the expensive, full matrix, so it only runs
# for release tags; pushes to main and pull requests get the quick pion-only
# physics-fast job above instead.
needs: manifest-sim
# Skip on fork PRs: the image isn't pushed there, so there is nothing to pull
# and validate (fork PRs build the image but cannot push it).
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
if: ${{ startsWith(github.ref, 'refs/tags/') }}
strategy:
fail-fast: false
matrix:
Expand All @@ -127,9 +129,42 @@ jobs:
image: ${{ needs.manifest-sim.outputs.image }}
pdg: ${{ matrix.pdg }}

# ------------------------------------------------------------ release assets --
release-assets:
# Attach the per-particle histogram files from physics-validation to the
# release for this tag. Tag-only, like the job it consumes.
needs: physics-validation
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Collect histogram files
uses: actions/download-artifact@v8
with:
pattern: histos-*
path: histos
merge-multiple: true
- name: Upload histograms as release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
TAG: ${{ github.ref_name }}
run: |
ls -l histos
# A release published from the GitHub UI already exists by the time the
# tag push lands here; a tag pushed with plain `git push` has none, so
# create one in that case. --clobber makes re-runs idempotent.
if ! gh release view "${TAG}" >/dev/null 2>&1; then
echo "No release for ${TAG} yet -- creating one."
gh release create "${TAG}" --verify-tag --generate-notes
fi
gh release upload "${TAG}" histos/*.root --clobber

deploy-pages:
# Publishes the plots produced by physics-validation, so it is tag-only too.
needs: physics-validation
if: github.ref == 'refs/heads/main'
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
permissions:
pages: write
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/physics-validation-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,33 @@ jobs:
submission.json
plot_work/**/metrics_*.json
if-no-files-found: error
- name: Stage histogram files for the release
# make_plots.sh writes plot_work/<particle>/<settings-tag>/histos_<study>.root.
# Release assets share one flat namespace across the whole matrix, and the
# study names repeat per particle (histos_tracks.root for muon, electron
# and pion alike), so stamp the particle into each name before uploading.
env:
PARTICLE: ${{ needs.meta.outputs.particle }}
run: |
mkdir -p histos
shopt -s nullglob
n=0
for f in plot_work/"${PARTICLE}"/*/histos_*.root; do
base="$(basename "${f}" .root)"
cp "${f}" "histos/${base}_${PARTICLE}.root"
n=$((n + 1))
done
if [ "${n}" -eq 0 ]; then
echo "ERROR: the studies wrote no histos_*.root under plot_work/${PARTICLE}" >&2
exit 1
fi
ls -l histos
- name: Upload histogram files
uses: actions/upload-artifact@v7
with:
name: histos-${{ needs.meta.outputs.particle }}
path: histos
if-no-files-found: error
- name: Upload plots (per-particle Pages fragment)
uses: actions/upload-artifact@v7
with:
Expand Down