|
| 1 | +name: JSOBenchmarks |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + types: [labeled, opened, synchronize, reopened] |
| 5 | + workflow_call: |
| 6 | + |
| 7 | +jobs: |
| 8 | + bmark: |
| 9 | + name: Julia ${{ matrix.version }} - macOS - ${{ matrix.arch }} - ${{ github.event_name }} |
| 10 | + if: github.event_name == 'workflow_call' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'run benchmarks')) |
| 11 | + # FIXME: should run on hosted runner |
| 12 | + runs-on: macOS-latest |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + version: |
| 17 | + - 1 |
| 18 | + arch: |
| 19 | + - aarch64 |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v6 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + - uses: julia-actions/setup-julia@v2 |
| 25 | + with: |
| 26 | + version: ${{ matrix.version }} |
| 27 | + arch: ${{ matrix.arch }} |
| 28 | + - uses: julia-actions/julia-buildpkg@v1 |
| 29 | + # FIXME: register JSOBenchmarks |
| 30 | + - name: Installing non-registered dependencies |
| 31 | + run: | |
| 32 | + using Pkg |
| 33 | + pkg1 = PackageSpec(url = "https://github.com/JuliaSmoothOptimizers/JSOBenchmarks.jl.git", rev = "main") |
| 34 | + pkg_list = [pkg1] |
| 35 | + Pkg.add(pkg_list) |
| 36 | + shell: julia --project=benchmark --color=yes {0} |
| 37 | + - name: Install benchmark dependencies |
| 38 | + run: julia --project=benchmark -e 'using Pkg; Pkg.instantiate()' |
| 39 | + - name: Sanitize project name |
| 40 | + id: sanitize |
| 41 | + run: echo "REPONAME=${{ github.event.repository.name }}" | sed -e 's/\.jl$//' >> $GITHUB_OUTPUT |
| 42 | + - name: Run benchmarks |
| 43 | + run: julia --project=benchmark -e 'using JSOBenchmarks; run_benchmarks("${{ steps.sanitize.outputs.REPONAME }}", "benchmark", reference_branch = "main")' |
| 44 | + env: |
| 45 | + GITHUB_AUTH: ${{ secrets.GIST_TOKEN }} |
| 46 | + # - name: Post benchmark results in PR |
| 47 | + # uses: thollander/actions-comment-pull-request@v2 |
| 48 | + # with: |
| 49 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + # message: "Full benchmark results stored as artifacts. Summary: ${{ secrets.BMARK_GIST_URL }}" |
| 51 | + - name: Build comment |
| 52 | + id: build-comment |
| 53 | + uses: actions/github-script@v6 |
| 54 | + with: |
| 55 | + github-token: ${{ github.token }} |
| 56 | + result-encoding: string |
| 57 | + script: | |
| 58 | + const fs = require('fs'); |
| 59 | + return fs.readFileSync("${{ github.workspace }}/bmark_${{ github.sha }}.md", "utf8").toString(); |
| 60 | + - name: Comment in PR |
| 61 | + uses: thollander/actions-comment-pull-request@v2 |
| 62 | + with: |
| 63 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + message: ${{ steps.build-comment.outputs.result }} |
| 65 | + # - name: Upload benchmark plots |
| 66 | + # uses: edunad/actions-image@v2.0.0 |
| 67 | + # with: |
| 68 | + # path: "./*.png" |
| 69 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + # title: "Benchmarks at a Glance" |
| 71 | + # annotationLevel: "notice" |
| 72 | + - name: Upload artifacts |
| 73 | + uses: actions/upload-artifact@v7 |
| 74 | + with: |
| 75 | + name: jso-benchmarks |
| 76 | + path: | |
| 77 | + profiles_this_commit_vs_reference_*.svg |
| 78 | + *_vs_reference_*.jld2 |
| 79 | + bmark_*.md |
| 80 | + reference.md |
| 81 | + judgement_*.md |
0 commit comments