|
6 | 6 | concurrency:
|
7 | 7 | # Skip intermediate builds: always.
|
8 | 8 | group: ${{ github.workflow }}-${{ github.ref }}
|
9 |
| - cancel-in-progress: true # allways cancle old runs on new push |
| 9 | + cancel-in-progress: true # always cancel old runs on new push |
10 | 10 |
|
11 | 11 | permissions:
|
12 | 12 | pull-requests: write
|
13 | 13 | actions: write
|
14 | 14 | contents: read
|
15 | 15 |
|
16 | 16 | jobs:
|
17 |
| - run_benchmarks: |
18 |
| - runs-on: ubuntu-latest |
19 |
| - |
20 |
| - steps: |
21 |
| - - uses: actions/checkout@v4 |
22 |
| - with: |
23 |
| - fetch-depth: 0 # fetch all history |
24 |
| - - uses: julia-actions/setup-julia@v2 |
25 |
| - - uses: julia-actions/cache@v2 |
26 |
| - - uses: julia-actions/julia-buildpkg@v1 |
27 |
| - - name: Run benchmarks |
28 |
| - env: |
29 |
| - JULIA_NUM_THREADS: auto |
30 |
| - working-directory: benchmark |
31 |
| - run: | |
32 |
| - julia --color=yes ./run_benchmarks.jl -t ${{github.event.pull_request.head.ref}} -b ${{github.event.pull_request.base.ref}} --no-data-export --prefix "" |
33 |
| - echo '### Benchmark Results' > body.md |
34 |
| - echo '' >> body.md |
35 |
| - echo '```' >> body.md |
36 |
| - cat comparison.txt >> body.md |
37 |
| - echo '```' >> body.md |
38 |
| - echo '' >> body.md |
39 |
| - - name: Upload plot |
40 |
| - uses: actions/upload-artifact@v4 |
41 |
| - id: artifact-upload-step |
42 |
| - with: |
43 |
| - name: comparison.pdf |
44 |
| - path: benchmark/comparison.pdf |
45 |
| - - name: Link to graphic |
46 |
| - run: | |
47 |
| - echo '${{ steps.artifact-upload-step.outputs.artifact-url }}' >> benchmark/body.md |
48 |
| - - uses: int128/hide-comment-action@v1 # hide all previous comments |
49 |
| - - name: Comment on PR |
50 |
| - uses: peter-evans/create-or-update-comment@v3 |
51 |
| - with: |
52 |
| - issue-number: ${{ github.event.pull_request.number }} |
53 |
| - body-path: benchmark/body.md |
| 17 | + run_benchmarks: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Check for '[no benchmark]' in PR |
| 21 | + id: check-no-benchmark |
| 22 | + run: | |
| 23 | + if [[ "${{ github.event.pull_request.title }}" == *"[no benchmark]"* ]] || [[ "${{ github.event.pull_request.body }}" == *"[no benchmark]"* ]]; then |
| 24 | + echo "Skipping benchmarks because '[no benchmark]' is found in the PR title or body." |
| 25 | + echo "skip_benchmark=true" >> $GITHUB_ENV |
| 26 | + else |
| 27 | + echo "skip_benchmark=false" >> $GITHUB_ENV |
| 28 | + fi |
| 29 | + - name: Exit if skipping benchmarks |
| 30 | + if: env.skip_benchmark == 'true' |
| 31 | + run: exit 0 |
| 32 | + - uses: actions/checkout@v4 |
| 33 | + with: |
| 34 | + fetch-depth: 0 # fetch all history |
| 35 | + - uses: julia-actions/setup-julia@v2 |
| 36 | + - uses: julia-actions/cache@v2 |
| 37 | + - uses: julia-actions/julia-buildpkg@v1 |
| 38 | + - name: Run benchmarks |
| 39 | + env: |
| 40 | + JULIA_NUM_THREADS: auto |
| 41 | + working-directory: benchmark |
| 42 | + run: | |
| 43 | + julia --color=yes ./run_benchmarks.jl -t ${{github.event.pull_request.head.ref}} -b ${{github.event.pull_request.base.ref}} --no-data-export --prefix "" |
| 44 | + echo '### Benchmark Results' > body.md |
| 45 | + echo '' >> body.md |
| 46 | + echo '```' >> body.md |
| 47 | + cat comparison.txt >> body.md |
| 48 | + echo '```' >> body.md |
| 49 | + echo '' >> body.md |
| 50 | + - name: Upload plot |
| 51 | + uses: actions/upload-artifact@v4 |
| 52 | + id: artifact-upload-step |
| 53 | + with: |
| 54 | + name: comparison.pdf |
| 55 | + path: benchmark/comparison.pdf |
| 56 | + - name: Link to graphic |
| 57 | + run: | |
| 58 | + echo '${{ steps.artifact-upload-step.outputs.artifact-url }}' >> benchmark/body.md |
| 59 | + - uses: int128/hide-comment-action@v1 # hide all previous comments |
| 60 | + - name: Comment on PR |
| 61 | + uses: peter-evans/create-or-update-comment@v3 |
| 62 | + with: |
| 63 | + issue-number: ${{ github.event.pull_request.number }} |
| 64 | + body-path: benchmark/body.md |
0 commit comments