fix CMake source globbing for incremental rebuilds (#471) #136
This file contains hidden or 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: Compile PR in Container | |
| ############################################################ | |
| # Triggers | |
| ############################################################ | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| workflow_dispatch: # Allows manual triggering of the workflow to test before merging | |
| ############################################################ | |
| # Global variables | |
| ############################################################ | |
| env: | |
| # SHA of the code being tested (PR head or merge commit) | |
| COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | |
| ############################################################ | |
| # Jobs | |
| ############################################################ | |
| jobs: | |
| build-and-run-scarab-dbg: | |
| if: github.event_name == 'pull_request' | |
| uses: ./.github/workflows/scarab-sim.yml | |
| with: | |
| sci_id: top_simpoint_dbg | |
| collect_metrics: true | |
| allow_failed_report_ignored: true | |
| build-and-run-scarab-opt: | |
| uses: ./.github/workflows/scarab-sim.yml | |
| with: | |
| sci_id: top_simpoint | |
| collect_metrics: true | |
| compare-ipc: | |
| ######################################################## | |
| # Job: ensure opt and dbg IPC match | |
| ######################################################## | |
| if: github.event_name == 'pull_request' | |
| needs: [build-and-run-scarab-opt, build-and-run-scarab-dbg] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Compare IPC values | |
| run: | | |
| opt_ipc="${{ needs.build-and-run-scarab-opt.outputs.ipc }}" | |
| dbg_ipc="${{ needs.build-and-run-scarab-dbg.outputs.ipc }}" | |
| if [ -z "$opt_ipc" ] || [ -z "$dbg_ipc" ]; then | |
| echo "Missing IPC outputs: opt='$opt_ipc' dbg='$dbg_ipc'" | |
| exit 1 | |
| fi | |
| if [ "$opt_ipc" != "$dbg_ipc" ]; then | |
| echo "IPC mismatch: opt=$opt_ipc dbg=$dbg_ipc" | |
| exit 1 | |
| fi | |
| echo "IPC match: $opt_ipc" | |
| comment-pr: | |
| ######################################################## | |
| # Job: comment on PR with metrics | |
| ######################################################## | |
| if: github.event_name == 'pull_request' | |
| needs: [build-and-run-scarab-opt, build-and-run-scarab-dbg, compare-ipc] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: litz-lab/scarab_perf | |
| path: baseline | |
| - id: base | |
| name: Read last baseline line | |
| run: | | |
| last=$(tail -n1 baseline/scarab_perf.log | tr -d '\r') | |
| IFS=',' read -r _ IPC KIPS <<<"$last" | |
| echo "ipc=$IPC" >>"$GITHUB_OUTPUT" | |
| echo "kips=$KIPS" >>"$GITHUB_OUTPUT" | |
| - name: Post PR comment | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const simKips = parseFloat("${{ needs.build-and-run-scarab-opt.outputs.kips }}"); | |
| const simIpc = parseFloat("${{ needs.build-and-run-scarab-opt.outputs.ipc }}"); | |
| const baseKips = parseFloat("${{ steps.base.outputs.kips }}"); | |
| const baseIpc = parseFloat("${{ steps.base.outputs.ipc }}"); | |
| // 1× → green, <1× → red, >1× → blue | |
| function coloured(v) { | |
| const EPS = 1e-3; // tolerance for “equal” | |
| let colour = 'green'; | |
| if (v > 1 + EPS) colour = 'blue'; | |
| else if (v < 1 - EPS) colour = 'red'; | |
| return `<span style="color:${colour};font-weight:bold">${v.toFixed(2)}×</span>`; | |
| } | |
| const body = ` | |
| 📊 **Scarab simulation** | |
| | Metric | PR | Baseline | Δ | | |
| | ------ | --:| -------: | :- | | |
| | **KIPS** | \`${simKips}\` | \`${baseKips}\` | ${coloured(simKips / baseKips)} | | |
| | **IPC** | \`${simIpc}\` | \`${baseIpc}\` | ${coloured(simIpc / baseIpc )} | | |
| `; | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.payload.pull_request.number, | |
| body | |
| }); | |
| update-baseline: | |
| ######################################################## | |
| # Job: update perf baseline on push | |
| ######################################################## | |
| if: github.event_name == 'push' | |
| needs: [build-and-run-scarab-opt] | |
| runs-on: ubuntu-latest | |
| env: | |
| PAT: ${{ secrets.SCARAB_PERF_PAT }} | |
| steps: | |
| # 1) Clone the perf repo (via HTTPS + PAT) | |
| - name: Checkout perf baseline | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: litz-lab/scarab_perf | |
| token: ${{ secrets.SCARAB_PERF_PAT }} | |
| path: perf | |
| # 2) Ensure commits come from the GH‑actions bot | |
| - name: Configure Git user | |
| run: | | |
| cd perf | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # 3) “Force Authentication” remote add/set‑url exactly like your sync job | |
| - name: Force Authentication with Fine-Grained PAT | |
| run: | | |
| cd perf | |
| if git remote get-url public > /dev/null 2>&1; then | |
| git remote set-url public https://${PAT}@github.com/litz-lab/scarab_perf.git | |
| else | |
| git remote add public https://${PAT}@github.com/litz-lab/scarab_perf.git | |
| fi | |
| git credential reject https://github.com/ || true | |
| # 4) Append the new line | |
| - name: Append new metrics line | |
| run: | | |
| echo "${COMMIT_SHA},${{ needs.build-and-run-scarab-opt.outputs.ipc }},${{ needs.build-and-run-scarab-opt.outputs.kips }}" \ | |
| >> perf/scarab_perf.log | |
| # 5) Commit & push back to the perf repo using the “public” remote | |
| - name: Commit & Push perf update | |
| run: | | |
| cd perf | |
| git add scarab_perf.log | |
| git commit -m "Add perf result for ${COMMIT_SHA}" | |
| git push public main |