Skip to content

v3.2.9: center beam generator on target #30

v3.2.9: center beam generator on target

v3.2.9: center beam generator on target #30

name: Generate PR Golden Histograms
on:
release:
types: [released]
env:
LDMX_DOCKER_TAG: ldmx/dev:latest
LDMX_NUM_EVENTS: 10000
jobs:
compile-ldmx-sw:
runs-on: ubuntu-latest
outputs:
job_matrix: ${{steps.gen-mat.outputs.job_matrix}}
steps:
- name: Checkout ldmx-sw
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Compile and Install ldmx-sw
uses: ./.github/actions/setup
- name: Package ldmx-sw Into Artifact
run: tar cf ldmx-sw-package.tar install/ .github/
- name: Upload ldmx-sw Package
uses: actions/upload-artifact@v3
with:
name: ldmx-sw-build-${{ github.sha }}
path: ldmx-sw-package.tar
- name: Generate Job Matrix
id: gen-mat
uses: ./.github/actions/generate-matrix
generation:
needs: compile-ldmx-sw
runs-on: ubuntu-latest
env:
LDMX_RUN_NUMBER: ${{matrix.run}}
strategy:
matrix: ${{fromJson(needs.compile-ldmx-sw.outputs.job_matrix)}}
steps:
- name: Download ldmx-sw Package
uses: actions/download-artifact@v3
with:
name: ldmx-sw-build-${{ github.sha }}
- name: Unpack ldmx-sw Build
run: |
cd ${GITHUB_WORKSPACE}
tar xf ldmx-sw-package.tar
- name: Run Validation
id: validation
uses: ./.github/actions/validate
with:
sample: ${{matrix.sample}}
no_comp: true
- name: Upload New Golden Histograms
uses: actions/upload-artifact@v3
with:
name: ${{matrix.sample}}-new-gold
path: ${{steps.validation.outputs.hists}}
pr-new-gold:
needs: [generation]
runs-on: ubuntu-latest
steps:
- name: Checkout ldmx-sw
uses: actions/checkout@v3
with:
submodules: 'recursive'
ref: trunk
- name: Download All the Gold
id: download
uses: actions/download-artifact@v3
with:
path: '../'
# The BIG assumption we make here is that the artifacts
# containing the new gold are named '<sample>-new-gold'
- name: Update the Gold
id: update-gold
run: |
source ${GITHUB_WORKSPACE}/.github/actions/common.sh
start_group Update Gold Label
echo "Old Label: $(ldmx_gold_label)"
echo "${GITHUB_REF##refs/tags/}" > ${LDMX_GOLD_LABEL_FILE}
echo "New Label: $(ldmx_gold_label)"
git add ${LDMX_GOLD_LABEL_FILE}
end_group
start_group Copy over new Gold Histograms
artifacts_d=${{steps.download.outputs.download-path}}
echo ${artifacts_d}
if ! compgen -G "${artifacts_d}/*-new-gold" > /dev/null; then
error "No artifacts matching '${artifacts_d}/*-new-gold'."
exit 1
fi
for sample_d in ${artifacts_d}/*-new-gold; do
sample=$(basename ${sample_d})
sample=${sample%%-new-gold}
echo ${sample}
mv ${sample_d}/hist.root .github/validation_samples/${sample}/gold.root
done
git add .github/validation_samples/*/gold.root
end_group
start_group Set Outputs
set_output new-label $(ldmx_gold_label)
end_group
shell: bash
- name: Open PR for the New Gold
uses: peter-evans/create-pull-request@v4
with:
commit-message: 'Updated Gold for release ${{ steps.update-gold.outputs.new-label }}'
title: 'New Gold for Generated by release ${{ steps.update-gold.outputs.new-label }}'
body: 'Auto-generated updated gold histograms for new release.'
branch: new-gold-${{ steps.update-gold.outputs.new-label }}
delete-branch: true