Skip to content

Commit

Permalink
ci: Add reporting to physmon (#1612)
Browse files Browse the repository at this point in the history
This attempts to add a workflow that comments details of the physmon
result on the relevant PR.
  • Loading branch information
paulgessinger committed Oct 21, 2022
1 parent 4ddf9e8 commit e3947c1
Show file tree
Hide file tree
Showing 3 changed files with 149 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ jobs:
- name: Unpack build
run: mkdir build && tar xf build.tar.gz -C build

- name: Save PR number
if: ${{ github.event_name == 'pull_request' }}
run: |
echo ${{ github.event.number }} > physmon/pr_number
echo ${{ github.event.pull_request.head.sha }} > physmon/sha
- name: Physics performance checks
shell: bash
run: >
Expand Down
101 changes: 101 additions & 0 deletions .github/workflows/report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Report on physmon

on:
workflow_run:
workflows: [Builds]
types:
- completed

jobs:
post_comment:
runs-on: ubuntu-latest
steps:
- name: 'Download artifact'
uses: actions/github-script@v6
id: dl-af
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "physmon"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/physmon.zip`, Buffer.from(download.data));
let = url = `https://herald.dokku.paulgessinger.com/view/${process.env.GITHUB_REPOSITORY}/${matchArtifact.id}`;
core.exportVariable('ARTIFACT_URL', url)
- name: 'Unzip artifact'
run: unzip -d physmon physmon.zip && ls -al && ls -al physmon


- name: 'Determine PR number'
uses: actions/github-script@v6
id: get-pr-number
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
let fs = require('fs');
let file = 'physmon/pr_number';
if(!fs.existsSync(file)) {
console.log('No file at ' + file);
return false;
}
let number = Number(fs.readFileSync(file));
console.log('PR number is '+number);
core.exportVariable('PR_NUMBER', number)
let sha = fs.readFileSync('physmon/sha', {encoding: 'utf8'});
console.log('SHA is '+sha);
core.exportVariable('PR_SHA', sha)
return number;
- uses: actions/checkout@v3
if: steps.get-pr-number.outputs.result != 'false'

# ping the url, triggers caching of the artifact
- name: Prime cache
run: curl -L $ARTIFACT_URL
if: steps.get-pr-number.outputs.result != 'false'

- name: Render template
id: template
uses: chuhlomin/render-template@v1.4
if: steps.get-pr-number.outputs.result != 'false'
with:
template: CI/physmon/comment_template.md
vars: |
url: ${{ env.ARTIFACT_URL }}
commit: ${{ env.PR_SHA }}
- name: Find Comment
if: steps.get-pr-number.outputs.result != 'false'
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ steps.get-pr-number.outputs.result }}
comment-author: 'github-actions[bot]'
body-includes: Physics performance monitoring

- name: Create or update comment
if: steps.get-pr-number.outputs.result != 'false'
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ steps.get-pr-number.outputs.result }}
body: ${{ steps.template.outputs.result }}
edit-mode: replace
42 changes: 42 additions & 0 deletions CI/physmon/comment_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
## :bar_chart: Physics performance monitoring for {{ .commit }}
[Full report]({{ .url }}/)
[CKF seeded]({{ .url }}/ckf_seeded.html)
[CKF truth smeared]({{ .url }}/ckf_truth_smeared.html)
[CKF truth estimated]({{ .url }}/ckf_truth_estimated.html)

<details>
<summary><b>Vertexing</b></summary>
<img src="{{ .url }}/vertexing_mu_scan.pdf?to_png=1" width="400"/>
</details>

<details>
<summary><b>CKF seeded</b></summary>
<img src="{{ .url }}/ckf_seeded_plots/trackeff_vs_eta.pdf?to_png=1" width="50%"/><img src="{{ .url }}/ckf_seeded_plots/trackeff_vs_pT.pdf?to_png=1" width="50%"/>

<img src="{{ .url }}/ckf_seeded_plots/nHoles_vs_eta.pdf?to_png=1" width="50%"/><img src="{{ .url }}/ckf_seeded_plots/nMeasurements_vs_eta.pdf?to_png=1" width="50%"/>
</details>

<details>
<summary><b>CKF truth smeared</b></summary>
<img src="{{ .url }}/ckf_truth_smeared_plots/trackeff_vs_eta.pdf?to_png=1" width="50%"/><img src="{{ .url }}/ckf_truth_smeared_plots/trackeff_vs_pT.pdf?to_png=1" width="50%"/>

<img src="{{ .url }}/ckf_truth_smeared_plots/nHoles_vs_eta.pdf?to_png=1" width="50%"/><img src="{{ .url }}/ckf_truth_smeared_plots/nMeasurements_vs_eta.pdf?to_png=1" width="50%"/>
</details>

<details>
<summary><b>CKF truth estimated</b></summary>
<img src="{{ .url }}/ckf_truth_estimated_plots/trackeff_vs_eta.pdf?to_png=1" width="50%"/><img src="{{ .url }}/ckf_truth_estimated_plots/trackeff_vs_pT.pdf?to_png=1" width="50%"/>

<img src="{{ .url }}/ckf_truth_estimated_plots/nHoles_vs_eta.pdf?to_png=1" width="50%"/><img src="{{ .url }}/ckf_truth_estimated_plots/nMeasurements_vs_eta.pdf?to_png=1" width="50%"/>
</details>

<details>
<summary><b>Truth tracking</b></summary>
<img src="{{ .url }}/truth_tracking_plots/nHoles_vs_eta.pdf?to_png=1" width="50%"/><img src="{{ .url }}/truth_tracking_plots/nMeasurements_vs_eta.pdf?to_png=1" width="50%"/>

<img src="{{ .url }}/truth_tracking_plots/pull_d0.pdf?to_png=1" width="50%"/><img src="{{ .url }}/truth_tracking_plots/pull_z0.pdf?to_png=1" width="50%"/>

<img src="{{ .url }}/truth_tracking_plots/pull_theta.pdf?to_png=1" width="50%"/><img src="{{ .url }}/truth_tracking_plots/pull_phi.pdf?to_png=1" width="50%"/>

<img src="{{ .url }}/truth_tracking_plots/pull_qop.pdf?to_png=1" width="50%"/><img src="{{ .url }}/truth_tracking_plots/pull_t.pdf?to_png=1" width="50%"/>
</details>

0 comments on commit e3947c1

Please sign in to comment.