Skip to content

Commit 75dec95

Browse files
Merge branch 'main' into fix-docs-spacing
2 parents 660344e + 5436648 commit 75dec95

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+289
-45862
lines changed

.env

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ SQLITE_CONNECTION_STRING="Data Source=tests.db;Mode=ReadWrite"
55
MYSQL_CONNECTION_STRING="server=localhost;database=tests;user=root;AllowLoadLocalInfile=true;ConvertZeroDateTime=True"
66
POSTGRES_CONNECTION_STRING="host=localhost;database=tests;username=postgres;password=pass;IncludeErrorDetail=true"
77

8-
SQLITE_BENCHMARK_CONNECTION_STRING="Data Source=benchmark.db;Mode=ReadWrite"
9-
MYSQL_BENCHMARK_CONNECTION_STRING="server=localhost;database=sales;user=root;AllowLoadLocalInfile=true;ConvertZeroDateTime=True"
10-
POSTGRES_BENCHMARK_CONNECTION_STRING="host=localhost;database=tests;username=postgres;password=pass;IncludeErrorDetail=true"
11-
128
POSTGRES_USER="postgres"
139
POSTGRES_PASSWORD="pass"
1410
TESTS_DB="tests"

.github/workflows/benchmark.yml

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ jobs:
1919
benchmark-mysql-reads:
2020
name: MySQL Reads Benchmark
2121
runs-on: ubuntu-latest
22+
defaults:
23+
run:
24+
working-directory: ./benchmark
2225

2326
steps:
2427
- uses: actions/checkout@v4
@@ -32,25 +35,29 @@ jobs:
3235
uses: xom9ikk/[email protected]
3336
with:
3437
load-mode: strict
38+
path: benchmark
3539

3640
- name: Docker compose
3741
uses: hoverkraft-tech/[email protected]
3842
with:
3943
services: mysqldb
4044

4145
- name: Run Benchmark
42-
run: ./benchmark/scripts/run_single_benchmark.sh mysql reads
46+
run: ./scripts/run_single_benchmark.sh mysql reads
4347

4448
- name: Upload Results
4549
uses: actions/upload-artifact@v4
4650
if: success()
4751
with:
4852
name: mysql-reads-results
49-
path: benchmark/BenchmarkDotNet.Artifacts/mysql/reads
53+
path: BenchmarkDotNet.Artifacts/mysql/reads
5054

5155
benchmark-mysql-writes:
5256
name: MySQL Writes Benchmark
5357
runs-on: ubuntu-latest
58+
defaults:
59+
run:
60+
working-directory: ./benchmark
5461

5562
steps:
5663
- uses: actions/checkout@v4
@@ -64,25 +71,29 @@ jobs:
6471
uses: xom9ikk/[email protected]
6572
with:
6673
load-mode: strict
74+
path: benchmark
6775

6876
- name: Docker compose
6977
uses: hoverkraft-tech/[email protected]
7078
with:
7179
services: mysqldb
7280

7381
- name: Run Benchmark
74-
run: ./benchmark/scripts/run_single_benchmark.sh mysql writes
82+
run: ./scripts/run_single_benchmark.sh mysql writes
7583

7684
- name: Upload Results
7785
uses: actions/upload-artifact@v4
7886
if: success()
7987
with:
8088
name: mysql-writes-results
81-
path: benchmark/BenchmarkDotNet.Artifacts/mysql/writes
89+
path: BenchmarkDotNet.Artifacts/mysql/writes
8290

8391
benchmark-postgresql-reads:
8492
name: PostgreSQL Reads Benchmark
8593
runs-on: ubuntu-latest
94+
defaults:
95+
run:
96+
working-directory: ./benchmark
8697

8798
steps:
8899
- uses: actions/checkout@v4
@@ -96,25 +107,29 @@ jobs:
96107
uses: xom9ikk/[email protected]
97108
with:
98109
load-mode: strict
110+
path: benchmark
99111

100112
- name: Docker compose
101113
uses: hoverkraft-tech/[email protected]
102114
with:
103115
services: postgresdb
104116

105117
- name: Run Benchmark
106-
run: ./benchmark/scripts/run_single_benchmark.sh postgresql reads
118+
run: ./scripts/run_single_benchmark.sh postgresql reads
107119

108120
- name: Upload Results
109121
uses: actions/upload-artifact@v4
110122
if: success()
111123
with:
112124
name: postgresql-reads-results
113-
path: benchmark/BenchmarkDotNet.Artifacts/postgresql/reads
125+
path: BenchmarkDotNet.Artifacts/postgresql/reads
114126

115127
benchmark-postgresql-writes:
116128
name: PostgreSQL Writes Benchmark
117129
runs-on: ubuntu-latest
130+
defaults:
131+
run:
132+
working-directory: ./benchmark
118133

119134
steps:
120135
- uses: actions/checkout@v4
@@ -128,25 +143,29 @@ jobs:
128143
uses: xom9ikk/[email protected]
129144
with:
130145
load-mode: strict
146+
path: benchmark
131147

132148
- name: Docker compose
133149
uses: hoverkraft-tech/[email protected]
134150
with:
135151
services: postgresdb
136152

137153
- name: Run Benchmark
138-
run: ./benchmark/scripts/run_single_benchmark.sh postgresql writes
154+
run: ./scripts/run_single_benchmark.sh postgresql writes
139155

140156
- name: Upload Results
141157
uses: actions/upload-artifact@v4
142158
if: success()
143159
with:
144160
name: postgresql-writes-results
145-
path: benchmark/BenchmarkDotNet.Artifacts/postgresql/writes
161+
path: BenchmarkDotNet.Artifacts/postgresql/writes
146162

147163
benchmark-sqlite-reads:
148164
name: SQLite Reads Benchmark
149165
runs-on: ubuntu-latest
166+
defaults:
167+
run:
168+
working-directory: ./benchmark
150169

151170
steps:
152171
- uses: actions/checkout@v4
@@ -160,20 +179,24 @@ jobs:
160179
uses: xom9ikk/[email protected]
161180
with:
162181
load-mode: strict
182+
path: benchmark
163183

164184
- name: Run Benchmark
165-
run: ./benchmark/scripts/run_single_benchmark.sh sqlite reads
185+
run: ./scripts/run_single_benchmark.sh sqlite reads
166186

167187
- name: Upload Results
168188
uses: actions/upload-artifact@v4
169189
if: success()
170190
with:
171191
name: sqlite-reads-results
172-
path: benchmark/BenchmarkDotNet.Artifacts/sqlite/reads
192+
path: BenchmarkDotNet.Artifacts/sqlite/reads
173193

174194
benchmark-sqlite-writes:
175195
name: SQLite Writes Benchmark
176196
runs-on: ubuntu-latest
197+
defaults:
198+
run:
199+
working-directory: ./benchmark
177200

178201
steps:
179202
- uses: actions/checkout@v4
@@ -187,21 +210,25 @@ jobs:
187210
uses: xom9ikk/[email protected]
188211
with:
189212
load-mode: strict
213+
path: benchmark
190214

191215
- name: Run Benchmark
192-
run: ./benchmark/scripts/run_single_benchmark.sh sqlite writes
216+
run: ./scripts/run_single_benchmark.sh sqlite writes
193217

194218
- name: Upload Results
195219
uses: actions/upload-artifact@v4
196220
if: success()
197221
with:
198222
name: sqlite-writes-results
199-
path: benchmark/BenchmarkDotNet.Artifacts/sqlite/writes
223+
path: BenchmarkDotNet.Artifacts/sqlite/writes
200224

201225
push-results:
202226
name: Push Results
203227
runs-on: ubuntu-latest
204-
if: always()
228+
defaults:
229+
run:
230+
working-directory: ./benchmark
231+
if: always() && github.event_name == 'release'
205232
needs: [
206233
benchmark-mysql-reads, benchmark-mysql-writes,
207234
benchmark-postgresql-reads, benchmark-postgresql-writes,
@@ -215,37 +242,40 @@ jobs:
215242
uses: actions/download-artifact@v4
216243
with:
217244
name: mysql-reads-results
218-
path: benchmark/BenchmarkDotNet.Artifacts/mysql/reads
245+
path: BenchmarkDotNet.Artifacts/mysql/reads
219246

220247
- name: Download MySQL Writes Results
221248
uses: actions/download-artifact@v4
222249
with:
223250
name: mysql-writes-results
224-
path: benchmark/BenchmarkDotNet.Artifacts/mysql/writes
251+
path: BenchmarkDotNet.Artifacts/mysql/writes
225252

226253
- name: Download PostgreSQL Reads Results
227254
uses: actions/download-artifact@v4
228255
with:
229256
name: postgresql-reads-results
230-
path: benchmark/BenchmarkDotNet.Artifacts/postgresql/reads
257+
path: BenchmarkDotNet.Artifacts/postgresql/reads
231258

232259
- name: Download PostgreSQL Writes Results
233260
uses: actions/download-artifact@v4
234261
with:
235262
name: postgresql-writes-results
236-
path: benchmark/BenchmarkDotNet.Artifacts/postgresql/writes
263+
path: BenchmarkDotNet.Artifacts/postgresql/writes
237264

238265
- name: Download SQLite Reads Results
239266
uses: actions/download-artifact@v4
240267
with:
241268
name: sqlite-reads-results
242-
path: benchmark/BenchmarkDotNet.Artifacts/sqlite/reads
269+
path: BenchmarkDotNet.Artifacts/sqlite/reads
243270

244271
- name: Download SQLite Writes Results
245272
uses: actions/download-artifact@v4
246273
with:
247274
name: sqlite-writes-results
248-
path: benchmark/BenchmarkDotNet.Artifacts/sqlite/writes
275+
path: BenchmarkDotNet.Artifacts/sqlite/writes
276+
277+
- name: Update Wasm Plugin
278+
run: ./scripts/update_wasm_plugin.sh
249279

250280
- name: Create Pull Request
251281
uses: peter-evans/create-pull-request@v6

.github/workflows/tests.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ jobs:
2121
unit-tests:
2222
name: Unit Tests
2323
runs-on: ubuntu-latest
24-
24+
defaults:
25+
run:
26+
working-directory: ./unit-tests
27+
2528
steps:
2629
- uses: actions/checkout@v4
2730

@@ -30,16 +33,15 @@ jobs:
3033
sqlc-version: '${{ env.SQLC_VERSION }}'
3134

3235
- name: Dotnet publish
33-
run: dotnet publish LocalRunner -c release --output dist/
36+
run: dotnet publish ../LocalRunner -c release --output dist/
3437

3538
- name: Verify pushed generated code is synced
36-
run: |
37-
sqlc -f sqlc.unit.test.yaml diff
39+
run: sqlc diff
3840

3941
- name: Run Tests
4042
run: |
41-
dotnet test unit-tests/RepositoryTests
42-
dotnet test unit-tests/CodegenTests
43+
dotnet test RepositoryTests
44+
dotnet test CodegenTests
4345
4446
end2end-tests:
4547
name: End-to-End Tests
@@ -62,4 +64,4 @@ jobs:
6264
uses: hoverkraft-tech/[email protected]
6365

6466
- name: Run Tests
65-
run: ./end2end/scripts/run_tests.sh
67+
run: ./end2end/scripts/run_tests.sh

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,7 @@ docker-upload/*
139139

140140
plugin.wasm
141141
*.db
142-
.env.bak
142+
.env.bak
143+
**/.env.bak
144+
145+
**/*.wasm

Makefile

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ dotnet-build:
66

77
.PHONY: unit-tests
88
unit-tests:
9-
dotnet test unit-tests/RepositoryTests
10-
sqlc generate -f sqlc.unit.test.yaml
11-
dotnet test unit-tests/CodegenTests
9+
cd unit-tests && \
10+
dotnet test RepositoryTests && \
11+
SQLCCACHE=./; sqlc generate && \
12+
dotnet test CodegenTests
1213

1314
generate-end2end-tests:
1415
./end2end/scripts/generate_tests.sh
@@ -50,22 +51,25 @@ run-end2end-tests:
5051
./end2end/scripts/run_tests.sh
5152

5253
# Benchmarks
53-
run-benchmark-sqlite-reads: sqlc-generate
54+
sqlc-generate-benchmark:
55+
SQLCCACHE=./; sqlc -f benchmark/sqlc.yaml generate
56+
57+
run-benchmark-sqlite-reads: sqlc-generate-benchmark
5458
./benchmark/scripts/run_single_benchmark.sh sqlite reads
5559

56-
run-benchmark-sqlite-writes: sqlc-generate
60+
run-benchmark-sqlite-writes: sqlc-generate-benchmark
5761
./benchmark/scripts/run_single_benchmark.sh sqlite writes
5862

59-
run-benchmark-postgresql-reads: sqlc-generate
63+
run-benchmark-postgresql-reads: sqlc-generate-benchmark
6064
./benchmark/scripts/run_single_benchmark.sh postgresql reads
6165

62-
run-benchmark-postgresql-writes: sqlc-generate
66+
run-benchmark-postgresql-writes: sqlc-generate-benchmark
6367
./benchmark/scripts/run_single_benchmark.sh postgresql writes
6468

65-
run-benchmark-mysql-reads: sqlc-generate
69+
run-benchmark-mysql-reads: sqlc-generate-benchmark
6670
./benchmark/scripts/run_single_benchmark.sh mysql reads
6771

68-
run-benchmark-mysql-writes: sqlc-generate
72+
run-benchmark-mysql-writes: sqlc-generate-benchmark
6973
./benchmark/scripts/run_single_benchmark.sh mysql writes
7074

7175
# Manual

benchmark/.env

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SQLITE_CONNECTION_STRING="Data Source=benchmark.db;Mode=ReadWrite"
2+
MYSQL_CONNECTION_STRING="server=localhost;database=sales;user=root;AllowLoadLocalInfile=true;ConvertZeroDateTime=True"
3+
POSTGRES_CONNECTION_STRING="host=localhost;database=tests;username=postgres;password=pass;IncludeErrorDetail=true"
4+
5+
POSTGRES_USER="postgres"
6+
POSTGRES_PASSWORD="pass"
7+
TESTS_DB="tests"

0 commit comments

Comments
 (0)