benchmark_run.yaml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. name: benchmark-run
  2. # Runs the committed benchmark (`just bench`) and records the numbers.
  3. #
  4. # This is a measurement, not a test: nothing here fails the build. Unlike
  5. # benchmark-ab, which compares two refs inside one job, this just reports the
  6. # absolute throughput of the current ref alongside Crow for reference.
  7. #
  8. # Absolute req/s is only meaningful against other runs on the same runner type,
  9. # so compare like with like when reading the history.
  10. #
  11. # Non-SSL only. Windows is excluded: benchmark/Makefile depends on `nc`, `&`
  12. # and `kill`, so it would need a PowerShell rewrite first.
  13. on:
  14. workflow_dispatch:
  15. inputs:
  16. duration:
  17. description: "Load duration per server"
  18. required: false
  19. default: "5s"
  20. connections:
  21. description: "Concurrent connections"
  22. required: false
  23. default: "10"
  24. crow:
  25. description: "Also benchmark Crow v1.3.1 for reference"
  26. type: boolean
  27. required: false
  28. default: true
  29. permissions:
  30. contents: read
  31. jobs:
  32. bench:
  33. strategy:
  34. fail-fast: false
  35. matrix:
  36. os: [ubuntu-latest, macos-latest]
  37. runs-on: ${{ matrix.os }}
  38. steps:
  39. - name: checkout
  40. uses: actions/checkout@v4
  41. - name: install bombardier
  42. run: go install github.com/codesenberg/bombardier@latest
  43. - name: run benchmark
  44. run: |
  45. export PATH="$(go env GOPATH)/bin:$PATH"
  46. if [ "${{ inputs.crow }}" = "true" ]; then TARGET=bench-all; else TARGET=bench; fi
  47. make -C benchmark "$TARGET" \
  48. BENCH="bombardier -c ${{ inputs.connections }} -d ${{ inputs.duration }} localhost:8080" \
  49. 2>&1 | tee /tmp/bench.txt
  50. - name: record results
  51. if: always()
  52. run: |
  53. {
  54. echo "## Benchmark (${{ matrix.os }})"
  55. echo ""
  56. echo "- ref: \`${{ github.ref_name }}\` (${{ github.sha }})"
  57. echo "- connections=${{ inputs.connections }} duration=${{ inputs.duration }}"
  58. echo ""
  59. echo '```'
  60. cat /tmp/bench.txt
  61. echo '```'
  62. } >> "$GITHUB_STEP_SUMMARY"