Skip to content

Commit dfdaa2f

Browse files
committed
build: add benchmark workflow
1 parent 615501d commit dfdaa2f

File tree

12 files changed

+264
-115
lines changed

12 files changed

+264
-115
lines changed

.github/actions/setup-rust/action.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Setup Test
2+
description: |
3+
This action sets up the environment for running tests in a Rust project.
4+
It installs Rust, sets up caching, and installs mise.
5+
6+
runs:
7+
using: composite
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: Install rust
11+
shell: /bin/bash -l {0}
12+
run: rustup toolchain install stable --profile minimal --no-self-update
13+
- name: Setup Rust cache
14+
uses: Swatinem/rust-cache@v2
15+
with:
16+
cache-provider: buildjet
17+
cache-all-crates: true
18+
- uses: jdx/mise-action@v2
19+
with:
20+
version: 2025.1.0 # [default: latest] mise version to install
21+
install: true # [default: true] run `mise install`
22+
cache: true # [default: true] cache mise using GitHub's cache

.github/workflows/benchmark.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Benchmark Proxy
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
push:
7+
branches:
8+
- main
9+
workflow_dispatch:
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
permissions:
15+
# deployments permission to deploy GitHub pages website
16+
deployments: write
17+
# contents permission to update benchmark contents in gh-pages branch
18+
contents: write
19+
20+
jobs:
21+
benchmark:
22+
name: Performance regression check
23+
runs-on: buildjet-16vcpu-ubuntu-2204
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: ./.github/actions/setup-test
27+
- run: |
28+
mise run postgres:up --extra-args "--detach --wait"
29+
- name: Run benchmark
30+
working-directory: tests/benchmark
31+
env:
32+
CS_WORKSPACE_ID: ${{ secrets.CS_WORKSPACE_ID }}
33+
CS_CLIENT_ACCESS_KEY: ${{ secrets.CS_CLIENT_ACCESS_KEY }}
34+
CS_DEFAULT_KEYSET_ID: ${{ secrets.CS_DEFAULT_KEYSET_ID }}
35+
CS_CLIENT_ID: ${{ secrets.CS_CLIENT_ID }}
36+
CS_CLIENT_KEY: ${{ secrets.CS_CLIENT_KEY }}
37+
RUST_BACKTRACE: "1"
38+
run: mise run benchmark:continuous
39+
# Download previous benchmark result from cache (if exists)
40+
- name: Download previous benchmark data
41+
uses: actions/cache@v4
42+
with:
43+
path: ./cache
44+
key: ${{ runner.os }}-benchmark
45+
# Run `github-action-benchmark` action
46+
- name: Store benchmark result
47+
uses: benchmark-action/github-action-benchmark@v1
48+
with:
49+
# What benchmark tool the output.txt came from
50+
tool: 'customSmallerIsBetter'
51+
# Where the output from the benchmark tool is stored
52+
output-file-path: tests/benchmark/results/output.json
53+
# # Where the previous data file is stored
54+
# external-data-json-path: ./cache/benchmark-data.json
55+
# Workflow will fail when an alert happens
56+
fail-on-alert: true
57+
# Enable alert commit comment
58+
# comment-on-alert: true
59+
# GitHub API token to make a commit comment
60+
# github-token: ${{ secrets.GITHUB_TOKEN }}
61+
# Enable Job Summary for PRs
62+
summary-always: true
63+
auto-push: true

.github/workflows/test.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: test
1+
name: Test
22
on:
33
pull_request:
44
branches:
@@ -10,25 +10,14 @@ on:
1010

1111
env:
1212
CARGO_TERM_COLOR: always
13+
1314
jobs:
1415
test:
1516
name: Test
1617
runs-on: buildjet-16vcpu-ubuntu-2204
1718
steps:
1819
- uses: actions/checkout@v4
19-
- name: Install rust
20-
shell: /bin/bash -l {0}
21-
run: rustup toolchain install stable --profile minimal --no-self-update
22-
- name: Setup Rust cache
23-
uses: Swatinem/rust-cache@v2
24-
with:
25-
cache-provider: buildjet
26-
cache-all-crates: true
27-
- uses: jdx/mise-action@v2
28-
with:
29-
version: 2025.1.0 # [default: latest] mise version to install
30-
install: true # [default: true] run `mise install`
31-
cache: true # [default: true] cache mise using GitHub's cache
20+
- uses: ./.github/actions/setup-test
3221
- run: |
3322
mise run postgres:up --extra-args "--detach --wait"
3423
- env:

Cargo.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,29 @@ edition = "2021"
1010
incremental = true
1111
debug = true
1212

13+
# [profile.dev.package]# aws-lc-sys.opt-level = 3
14+
# proc-macro2.opt-level = 3
15+
# quote.opt-level = 3
16+
# serde_derive.opt-level = 3
17+
# sqlparser.opt-level = 3
18+
# syn.opt-level = 3
19+
1320
[profile.dev.build-override]
1421
opt-level = 3
1522

1623
[profile.test]
1724
incremental = true
1825
debug = true
1926

27+
# Default release profile (https://doc.rust-lang.org/cargo/reference/profiles.html)
2028
[profile.release]
2129
codegen-units = 1
2230
strip = "symbols"
23-
lto = true
31+
32+
[profile.profiling]
33+
inherits = "release"
34+
strip = "none"
35+
debug = true
2436

2537
[workspace.dependencies]
2638
sqlparser = { version = "^0.52", features = ["bigdecimal", "serde"] }

packages/cipherstash-proxy/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ uuid = { version = "1.11.0", features = ["serde", "v4"] }
5656
x509-parser = "0.17.0"
5757
vitaminc-protected = "0.1.0-pre2"
5858

59-
6059
[dev-dependencies]
6160
recipher = "0.1.3"
6261
temp-env = "0.3.6"

tests/benchmark/docker/pgbouncer/pgbouncer.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22
cipherstash = host=host.docker.internal port=5532 dbname=cipherstash user=cipherstash password=password
33

44
[users]
5-
;user1 = pool_size=5 pool_mode=transaction max_user_connections=10
65

76
[pgbouncer]
87
listen_addr = *
98
listen_port = 6433
109
listen_backlog = 1000
1110
so_reuseport = 1
12-
; pool_mode = session
1311

1412
default_pool_size = 100
1513
min_pool_size = 20

0 commit comments

Comments
 (0)