Skip to content

Commit 92811fe

Browse files
fix: benchmark workflow
1 parent 8d223a7 commit 92811fe

File tree

3 files changed

+80
-4
lines changed

3 files changed

+80
-4
lines changed

.github/workflows/benchmark.yml

Lines changed: 78 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
name: Performance Benchmark
1+
name: Performance Benchmarks
22
defaults:
33
run:
44
shell: bash
5-
5+
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
610
env:
711
DOTNET_VERSION: '8.0.x'
812

@@ -26,6 +30,9 @@ jobs:
2630
with:
2731
dotnet-version: ${{ env.DOTNET_VERSION }}
2832

33+
- name: Dotnet Build
34+
run: dotnet build ./benchmark/BenchmarkRunner/BenchmarkRunner.csproj -c Release
35+
2936
- name: Load .env file
3037
uses: xom9ikk/[email protected]
3138
with:
@@ -38,6 +45,12 @@ jobs:
3845

3946
- name: Run Benchmark
4047
run: ./benchmark/scripts/run_benchmark_for_db.sh mysql
48+
49+
- name: Upload Results
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: mysql-results
53+
path: benchmark/BenchmarkDotNet.Artifacts/results/*.{md,html,csv}
4154

4255
benchmark-postgresql:
4356
name: PostgreSQL Benchmark
@@ -64,6 +77,12 @@ jobs:
6477
- name: Run Benchmark
6578
run: ./benchmark/scripts/run_benchmark_for_db.sh postgresql
6679

80+
- name: Upload Results
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: postgresql-results
84+
path: benchmark/BenchmarkDotNet.Artifacts/results/*.{md,html,csv}
85+
6786
benchmark-sqlite:
6887
name: SQLite Benchmark
6988
runs-on: ubuntu-latest
@@ -75,11 +94,67 @@ jobs:
7594
uses: actions/setup-dotnet@v4
7695
with:
7796
dotnet-version: ${{ env.DOTNET_VERSION }}
97+
98+
- name: Dotnet Build
99+
run: dotnet build ./benchmark/BenchmarkRunner/BenchmarkRunner.csproj -c Release
78100

79101
- name: Load .env file
80102
uses: xom9ikk/[email protected]
81103
with:
82104
load-mode: strict
83105

84106
- name: Run Benchmark
85-
run: ./benchmark/scripts/run_benchmark_for_db.sh sqlite
107+
run: ./benchmark/scripts/run_benchmark_for_db.sh sqlite
108+
109+
- name: Upload Results
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: sqlite-results
113+
path: benchmark/BenchmarkDotNet.Artifacts/results/*.{md,html,csv}
114+
115+
push-results:
116+
name: Push Results
117+
runs-on: ubuntu-latest
118+
if: always()
119+
needs: [benchmark-mysql, benchmark-postgresql, benchmark-sqlite]
120+
121+
steps:
122+
- uses: actions/checkout@v4
123+
124+
- name: Set up .NET
125+
uses: actions/setup-dotnet@v4
126+
with:
127+
dotnet-version: ${{ env.DOTNET_VERSION }}
128+
129+
- name: Dotnet Build
130+
run: dotnet build ./benchmark/BenchmarkRunner/BenchmarkRunner.csproj -c Release
131+
132+
- name: Download MySQL Results
133+
uses: actions/download-artifact@v4
134+
with:
135+
name: mysql-results
136+
path: benchmark/BenchmarkDotNet.Artifacts/results/mysql
137+
138+
- name: Download PostgreSQL Results
139+
uses: actions/download-artifact@v4
140+
with:
141+
name: postgresql-results
142+
path: benchmark/BenchmarkDotNet.Artifacts/results/postgresql
143+
144+
- name: Download SQLite Results
145+
uses: actions/download-artifact@v4
146+
with:
147+
name: sqlite-results
148+
path: benchmark/BenchmarkDotNet.Artifacts/results/sqlite
149+
150+
- name: Create Pull Request
151+
uses: peter-evans/create-pull-request@v6
152+
env:
153+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
154+
with:
155+
base: main
156+
title: update benchmark results
157+
commit-message: update benchmark results
158+
branch: update-benchmark-results
159+
branch-suffix: timestamp
160+
delete-branch: true

benchmark/scripts/run_benchmark_all_dbs.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ destroy() { docker-compose down --volumes; }
66
trap destroy EXIT
77
docker-compose up --build --detach --force-recreate --remove-orphans --wait
88

9+
dotnet build ./benchmark/BenchmarkRunner/BenchmarkRunner.csproj -c Release
10+
911
./benchmark/scripts/run_benchmark_for_db.sh mysql
1012
./benchmark/scripts/run_benchmark_for_db.sh postgresql
1113
./benchmark/scripts/run_benchmark_for_db.sh sqlite

benchmark/scripts/run_benchmark_for_db.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
set -ex
44

55
database_to_benchmark=$1
6-
dotnet build ./benchmark/BenchmarkRunner/BenchmarkRunner.csproj -c Release
76

87
if [ "$GITHUB_ACTIONS" = "true" ]; then
98
echo "Running in Github Actions"

0 commit comments

Comments
 (0)