Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move benchmark trigger to workflow_run #318

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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: 15 additions & 32 deletions .github/workflows/linux-eic-shell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ concurrency:
cancel-in-progress: true

jobs:
meta:
runs-on: ubuntu-latest
steps:
- name: Save metadata
run: |
echo "GITHUB_SERVER_URL=${{ github.server_url }}" >> meta.env
echo "GITHUB_REPOSITORY=${{ github.repository }}" >> meta.env
echo "GITHUB_REF=${{ github.ref }}" >> meta.env
echo "GITHUB_REF_NAME=${{ github.event.pull_request.head.ref || github.ref_name }}" >> meta.env
echo "GITHUB_SHA=${{ github.event.pull_request.head.sha || github.sha }}" >> meta.env
- uses: actions/upload-artifact@v2
with:
name: meta
path: meta.env

xmllint-before-build:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -480,38 +495,6 @@ jobs:
noverlaps="$(grep -c GeomVol1002 doc/overlap_check_geant4.out || true)"
if [[ "${noverlaps}" -gt "0" ]] ; then echo "${noverlaps} overlaps found!" && false ; fi

trigger-detector-benchmarks:
runs-on: ubuntu-latest
needs: [check-overlap-tgeo, check-overlap-geant4-fast]
strategy:
matrix:
detector_config: [epic_arches, epic_brycecanyon]
steps:
- uses: eic/trigger-gitlab-ci@v2
id: trigger
with:
url: https://eicweb.phy.anl.gov
project_id: 399
token: ${{ secrets.EICWEB_DETECTOR_BENCHMARK_TRIGGER }}
ref_name: master
variables: |
DETECTOR_REPOSITORYURL=${{ github.server_url }}/${{ github.repository }}
DETECTOR_VERSION=${{ github.event.pull_request.head.ref || github.ref_name }}
DETECTOR_CONFIG=${{ matrix.detector_config }}
GITHUB_REPOSITORY=${{ inputs.github_repository || github.repository }}
GITHUB_SHA=${{ inputs.github_sha || github.event.pull_request.head.sha || github.sha }}
- run: |
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha || github.sha }} \
-f state="pending" \
-f target_url="${{ steps.trigger.outputs.web_url }}" \
-f description="Triggered... $(TZ=America/New_York date)" \
-f context="eicweb/detector_benchmarks (${{ matrix.detector_config }})"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

generate-prim-file:
runs-on: ubuntu-latest
needs: build-gcc
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/trigger-benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: trigger-benchmarks

on:
workflow_run:
workflows:
- linux-eic-shell
types:
- completed

jobs:
trigger-detector-benchmarks:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
strategy:
matrix:
detector_config: [epic_arches, epic_brycecanyon]
steps:
- name: 'Download artifact'
uses: actions/[email protected]
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "meta"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/meta.zip', Buffer.from(download.data));
- run: unzip meta.zip
- run: cat meta.env >> ${GITHUB_ENV}
- uses: eic/trigger-gitlab-ci@v2
id: trigger
with:
url: https://eicweb.phy.anl.gov
project_id: 399
token: ${{ secrets.EICWEB_DETECTOR_BENCHMARK_TRIGGER }}
ref_name: master
variables: |
DETECTOR_REPOSITORYURL=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY
DETECTOR_VERSION=$GITHUB_REF_NAME
DETECTOR_CONFIG=${{ matrix.detector_config }}
GITHUB_REPOSITORY=$GITHUB_REPOSITORY
GITHUB_SHA=$GITHUB_SHA
- run: |
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha || github.sha }} \
-f state="pending" \
-f target_url="${{ steps.trigger.outputs.web_url }}" \
-f description="Triggered... $(TZ=America/New_York date)" \
-f context="eicweb/detector_benchmarks (${{ matrix.detector_config }})"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}