github.com/metasources/buildx@v0.0.0-20230418141019-7aa1459cedea/.github/workflows/benchmark-testing.yaml (about)

     1  name: "Benchmark testing"
     2  
     3  on:
     4    workflow_dispatch:
     5    pull_request:
     6  
     7  jobs:
     8  
     9    Benchmark-Test:
    10      name: "Benchmark tests"
    11      runs-on: ubuntu-20.04
    12      # note: we want benchmarks to run on pull_request events in order to publish results to a sticky comment, and
    13      # we also want to run on push such that merges to main are recorded to the cache. For this reason we don't filter
    14      # the job by event.
    15      steps:
    16        - uses: actions/checkout@v3
    17  
    18        - name: Bootstrap environment
    19          uses: ./.github/actions/bootstrap
    20  
    21        - name: Restore base benchmark result
    22          uses: actions/cache@v3
    23          with:
    24            path: test/results/benchmark-main.txt
    25            # use base sha for PR or new commit hash for main push in benchmark result key
    26            key: ${{ runner.os }}-bench-${{ (github.event.pull_request.base.sha != github.event.after) && github.event.pull_request.base.sha || github.event.after }}
    27  
    28        - name: Run benchmark tests
    29          id: benchmark
    30          run: |
    31            REF_NAME=${GITHUB_REF##*/} make benchmark
    32            OUTPUT=$(make show-benchstat)
    33            OUTPUT="${OUTPUT//'%'/'%25'}"   # URL encode all '%' characters
    34            OUTPUT="${OUTPUT//$'\n'/'%0A'}" # URL encode all '\n' characters
    35            OUTPUT="${OUTPUT//$'\r'/'%0D'}" # URL encode all '\r' characters
    36            echo "result=$OUTPUT" >> $GITHUB_OUTPUT
    37  
    38        - uses: actions/upload-artifact@v3
    39          with:
    40            name: benchmark-test-results
    41            path: test/results/**/*
    42  
    43        - name: Update PR benchmark results comment
    44          uses: marocchino/sticky-pull-request-comment@v2
    45          continue-on-error: true
    46          with:
    47            header: benchmark
    48            message: |
    49              ### Benchmark Test Results
    50  
    51              <details>
    52                <summary>Benchmark results from the latest changes vs base branch</summary>
    53  
    54              ```
    55              ${{ steps.benchmark.outputs.result }}
    56              ```
    57  
    58              </details>