Skip to content

Benchmark

Benchmark #3224

Workflow file for this run

name: Benchmark
on:
workflow_dispatch:
inputs:
exclude-slow-benchmarks:
description: 'Exclude slow benchmarks'
required: true
type: boolean
default: false
exclude-unstable-benchmarks:
description: 'Exclude unstable benchmarks'
required: true
type: boolean
default: false
exclude-release-only-benchmarks:
description: 'Exclude release benchmarks'
required: true
type: boolean
default: false
jobs:
get-exclude-dirs:
name: Get exclude directories
runs-on: ubuntu-latest
outputs:
exclude-dirs: ${{ steps.get-exclude-dirs.outputs.exclude-dirs }}
steps:
- uses: actions/checkout@v4
- id: get-exclude-dirs
uses: ./.github/actions/get_exclude_dirs
with:
exclude-slow: ${{ github.event.inputs.exclude-slow-benchmarks }}
exclude-unstable: ${{ github.event.inputs.exclude-unstable-benchmarks }}
exclude-release-only: ${{ github.event.inputs.exclude-release-only-benchmarks }}
create-branch-prefix:
name: Create Branch and Branch Prefix
runs-on: ubuntu-latest
outputs:
branch-prefix: ${{ steps.create-prefix.outputs.branch-prefix }}
base-branch: ${{ steps.create-prefix.outputs.base-branch }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- id: create-prefix
run: |
VERSION=$(jq -r '.version' package.json)
echo "branch-prefix=benchmark--$VERSION-" >> $GITHUB_OUTPUT
echo "base-branch=benchmark--$VERSION" >> $GITHUB_OUTPUT
- uses: ./.github/actions/configure_git
with:
gpg_signing_key: ${{ secrets.GPG_SIGNING_KEY }}
- name: Create base branch
run: |
git checkout -b ${{ steps.create-prefix.outputs.base-branch }}
git push origin ${{ steps.create-prefix.outputs.base-branch }}
run-benchmarks:
name: ${{ matrix.benchmark_group.name }}
needs:
- get-exclude-dirs
- create-branch-prefix
strategy:
fail-fast: false
matrix:
benchmark_group:
- { name: 'Examples', directories: './examples' }
- {
name: 'E2E Class',
directories: './tests/end_to_end/candid_rpc/class_syntax'
}
- {
name: 'E2E Functional',
directories: './tests/end_to_end/candid_rpc/functional_syntax'
}
- {
name: 'E2E HTTP Server',
directories: './tests/end_to_end/http_server'
}
- {
name: 'Property Class',
directories: './tests/property/candid_rpc/class_api'
}
uses: ./.github/workflows/benchmark_parallel.yml
secrets:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LASTMJS_GITHUB_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
with:
base-branch: ${{ needs.create-branch-prefix.outputs.base-branch }}
branch-prefix: ${{ needs.create-branch-prefix.outputs.branch-prefix }}
directories: ${{ matrix.benchmark_group.directories }}
exclude-dirs: ${{ needs.get-exclude-dirs.outputs.exclude-dirs }}
squash-branches:
needs: [run-benchmarks, create-branch-prefix]
uses: ./.github/workflows/squash_branches.yml
with:
base-branch: ${{ needs.create-branch-prefix.outputs.base-branch }}
branch-prefix: ${{ needs.create-branch-prefix.outputs.branch-prefix }}
commit-message: 'run benchmarks'
secrets:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LASTMJS_GITHUB_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
create-pr:
needs: [squash-branches, create-branch-prefix]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
run: |
gh pr create \
--base main \
--head ${{ needs.create-branch-prefix.outputs.base-branch }} \
--title "Benchmark Results for ${{ needs.create-branch-prefix.outputs.base-branch }}" \
--body "Automated PR for benchmark results"