Merge pull request #706 from sysprog21/fix-file-desc #3161
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: Benchmark | |
| on: [push, pull_request_target, workflow_dispatch] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.event.pull_request.head.sha || github.sha }} | |
| cancel-in-progress: true | |
| jobs: | |
| benchmark: | |
| name: Performance regression check | |
| if: contains(toJSON(github.event.head_commit.message), 'Merge pull request ') == false | |
| timeout-minutes: 30 | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: 'true' | |
| - name: Test changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@v47 | |
| with: | |
| files: | | |
| src/riscv.c | |
| src/decode.c | |
| src/emulate.c | |
| src/rv32_template.c | |
| src/rv32_constopt.c | |
| src/cache.c | |
| src/io.c | |
| src/jit.c | |
| # Build system configuration (may affect optimization flags) | |
| mk/kconfig.mk | |
| mk/toolchain.mk | |
| tools/detect-env.py | |
| - name: Cache benchmark artifacts | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' | |
| uses: actions/cache@v4 | |
| with: | |
| path: build/ | |
| key: benchmark-artifacts-${{ runner.os }}-${{ hashFiles('mk/artifact.mk') }} | |
| restore-keys: | | |
| benchmark-artifacts-${{ runner.os }}- | |
| - name: Install dependencies | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' | |
| run: | | |
| sudo pip3 install numpy --break-system-packages | |
| shell: bash | |
| - name: Build for benchmark | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' | |
| run: make defconfig && make ENABLE_SDL=0 all artifact | |
| - name: Run benchmark | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' | |
| run: | | |
| python3 tests/bench.py --json --quiet | |
| - name: Store benchmark results | |
| if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' | |
| uses: benchmark-action/github-action-benchmark@v1 | |
| with: | |
| name: Benchmarks | |
| tool: 'customBiggerIsBetter' | |
| output-file-path: benchmark_output.json | |
| github-token: ${{ secrets.RV32EMU_BENCH_TOKEN }} | |
| gh-repository: 'github.com/sysprog21/rv32emu-bench' | |
| gh-pages-branch: 'master' | |
| auto-push: true | |
| comment-always: true | |
| benchmark-data-dir-path: . |