#49: GitHub CI Benchmarking #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Benchmark' | |
on: | |
push: | |
paths: | |
- '**.f90' | |
- '**.fpp' | |
- '**.py' | |
- '**.yml' | |
- 'mfc.sh' | |
- 'CMakeLists.txt' | |
- 'requirements.txt' | |
pull_request: | |
jobs: | |
self: | |
name: Georgia Tech | Phoenix (NVHPC) | |
if: github.repository == 'MFlowCode/MFC' | |
strategy: | |
matrix: | |
device: ['cpu', 'gpu'] | |
runs-on: | |
group: phoenix | |
labels: self-hosted | |
steps: | |
- name: Clone - PR | |
uses: actions/checkout@v3 | |
- name: Bench - PR | |
run: | | |
bash .github/workflows/phoenix/submit.sh .github/workflows/phoenix/bench.sh ${{ matrix.device }} | |
mv bench-${{ matrix.device }}.out ~/bench-${{ matrix.device }}-pr.out | |
mv bench-${{ matrix.device }}.yaml ~/bench-${{ matrix.device }}-pr.yaml | |
- name: Clone - Master | |
uses: actions/checkout@v3 | |
with: | |
repository: henryleberre/MFC | |
ref: master | |
- name: Bench - Master | |
run: | | |
bash .github/workflows/phoenix/submit.sh .github/workflows/phoenix/bench.sh ${{ matrix.device }} | |
mv bench-${{ matrix.device }}.out ~/bench-${{ matrix.device }}-master.out | |
mv bench-${{ matrix.device }}.yaml ~/bench-${{ matrix.device }}-master.yaml | |
- name: Post Comment | |
run: | | |
PR_ID=$(cat "${{ github.event_path }}" | jq --raw-output .pull_request.number) | |
PR_COMMENT=`python3 .github/workflows/phoenix/compare.py ~/bench-${{ matrix.device }}-master.yaml ~/bench-${{ matrix.device }}-pr.yaml` | |
echo "Posting comment on PR #$PR_ID: $PR_COMMENT" | |
curl -X POST \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
"https://api.github.com/repos/${{ github.repository }}/issues/$PR_ID/comments" \ | |
-d "{\"body\":\"$PR_COMMENT\"}" | |
- name: Archive Logs | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: logs | |
path: | | |
~/bench-${{ matrix.device }}-* |