diff --git a/.github/workflows/linux-eic-shell.yml b/.github/workflows/linux-eic-shell.yml index 53dce6951..15f5e8bd7 100644 --- a/.github/workflows/linux-eic-shell.yml +++ b/.github/workflows/linux-eic-shell.yml @@ -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: @@ -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 diff --git a/.github/workflows/trigger-benchmarks.yml b/.github/workflows/trigger-benchmarks.yml new file mode 100644 index 000000000..7e3f897a1 --- /dev/null +++ b/.github/workflows/trigger-benchmarks.yml @@ -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/github-script@v3.1.0 + 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 }}