github.com/segmentio/encoding@v0.3.6/.github/workflows/benchmark.yml (about)

     1  name: Benchmark
     2  
     3  on:
     4  - pull_request
     5  
     6  jobs:
     7    benchmark:
     8      strategy:
     9        matrix:
    10          ref:
    11          - master
    12          - ${{ github.sha }}
    13  
    14      runs-on: ubuntu-latest
    15  
    16      steps:
    17      - name: Steup Go
    18        uses: actions/setup-go@v2
    19        with:
    20          go-version: 1.17
    21  
    22      - name: Checkout
    23        uses: actions/checkout@v2
    24        with:
    25          ref: ${{ matrix.ref }}
    26  
    27      - name: Run Benchmarks
    28        run: go test -v -run '^$' -bench '(Marshal|Unmarshal)$/codeResponse' -benchmem -benchtime 3s -cpu 1 -count 5 ./json | tee bench.txt
    29  
    30      - name: Upload Benchmarks
    31        uses: actions/upload-artifact@v2
    32        with:
    33          name: ${{ matrix.ref }}
    34          path: bench.txt
    35  
    36    benchstat:
    37      needs: [benchmark]
    38      runs-on: ubuntu-latest
    39  
    40      steps:
    41      - name: Steup Go
    42        uses: actions/setup-go@v2
    43        with:
    44          go-version: 1.17
    45  
    46      - name: Setup Benchstat
    47        run: go install golang.org/x/perf/cmd/benchstat@latest
    48  
    49      - name: Download Benchmark Results
    50        uses: actions/download-artifact@v2
    51        with:
    52          path: .
    53  
    54      - name: Run Benchstat
    55        run: benchstat ./master/bench.txt ./${{ github.sha }}/bench.txt | tee benchstat.txt
    56  
    57      - name: Upload Benchstat Results
    58        uses: actions/upload-artifact@v2
    59        with:
    60          name: benchstat
    61          path: benchstat.txt