diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 0000000..d58818e --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,43 @@ +name: Benchmarks + +on: + push: + branches: [main] + schedule: + - cron: "0 4 * * 1" + workflow_dispatch: + +concurrency: + group: benchmark-results + cancel-in-progress: false + +jobs: + benchmark: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v7 + + - name: Install build dependencies + run: ./scripts/build-dependencies.sh + + - name: Build and run benchmarks + working-directory: ctprintf + run: | + cmake --workflow --fresh --preset benchmark-workflow + ./build/benchmark/benchmarks/ctprintf_benchmarks \ + --benchmark_min_time=1s \ + --benchmark_repetitions=3 \ + --benchmark_out=./build/benchmark/benchmarks/benchmark_results.json \ + --benchmark_out_format=json + + - name: Publish benchmark results + uses: benchmark-action/github-action-benchmark@d48d326b4ca9ba73ca0cd0d59f108f9e02a381c7 + with: + tool: googlecpp + output-file-path: ctprintf/build/benchmark/benchmarks/benchmark_results.json + github-token: ${{ secrets.GITHUB_TOKEN }} + gh-pages-branch: gh-pages + benchmark-data-dir-path: dev/bench + auto-push: true diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index f9f6c61..77d6d1a 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -35,14 +35,6 @@ jobs: working-directory: ctprintf run: cmake --workflow --preset release-workflow - - name: Run performance benchmarks - working-directory: ctprintf - run: | - cmake --workflow --fresh --preset benchmark-workflow - ./build/benchmark/benchmarks/ctprintf_benchmarks \ - --benchmark_min_time=1s \ - --benchmark_repetitions=3 - - name: Build Debian package run: ./scripts/build-package.sh diff --git a/README.md b/README.md index 30142bf..01882f8 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,13 @@ cmake --workflow --preset benchmark-workflow The benchmark target is separate from CTest because execution time varies between machines and system load. +## Benchmark results + +The [benchmark dashboard](https://embtom.github.io/ctprintf/) tracks performance +over time. Results are updated on pushes to `main` and weekly. To publish the +dashboard, enable GitHub Pages for the repository with the `gh-pages` branch as +the source. + ## Creating a package CPack creates a gzip-compressed tarball containing the installable headers,