#49: GitHub CI Benchmarking #8
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 | |
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 | |
- name: Bench - Master | |
run: | | |
git remote add upstream https://github.com/MFlowCode/MFC.git | |
git fetch upstream | |
git checkout upstream/master | |
bash .github/workflows/phoenix/submit.sh .github/workflows/phoenix/bench.sh ${{ matrix.device }} | |
mv bench-${{ matrix.device }}.out bench-${{ matrix.device }}-master.out | |
- name: Generate Comment | |
run: | | |
export "BENCH_COMMENT="$(python3 .github/workflows/phoenix/compare.py bench-${{ matrix.device }}-master.out bench-${{ matrix.device }}-pr.out)"" >> $GITHUB_ENV | |
- name: Post Comment | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: process.env.BENCH_COMMENT | |
}) | |
- name: Print | |
if: always() | |
run: | | |
cat bench-${{ matrix.device }}-master.out || true | |
cat bench-${{ matrix.device }}-pr.out || true |