Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ SQLITE_CONNECTION_STRING="Data Source=tests.db;Mode=ReadWrite"
MYSQL_CONNECTION_STRING="server=localhost;database=tests;user=root;AllowLoadLocalInfile=true;ConvertZeroDateTime=True"
POSTGRES_CONNECTION_STRING="host=localhost;database=tests;username=postgres;password=pass;IncludeErrorDetail=true"

SQLITE_BENCHMARK_CONNECTION_STRING="Data Source=benchmark.db;Mode=ReadWrite"
MYSQL_BENCHMARK_CONNECTION_STRING="server=localhost;database=sales;user=root;AllowLoadLocalInfile=true;ConvertZeroDateTime=True"
POSTGRES_BENCHMARK_CONNECTION_STRING="host=localhost;database=tests;username=postgres;password=pass;IncludeErrorDetail=true"

POSTGRES_USER="postgres"
POSTGRES_PASSWORD="pass"
TESTS_DB="tests"
68 changes: 49 additions & 19 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
benchmark-mysql-reads:
name: MySQL Reads Benchmark
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./benchmark

steps:
- uses: actions/checkout@v4
Expand All @@ -32,25 +35,29 @@ jobs:
uses: xom9ikk/[email protected]
with:
load-mode: strict
path: benchmark

- name: Docker compose
uses: hoverkraft-tech/[email protected]
with:
services: mysqldb

- name: Run Benchmark
run: ./benchmark/scripts/run_single_benchmark.sh mysql reads
run: ./scripts/run_single_benchmark.sh mysql reads

- name: Upload Results
uses: actions/upload-artifact@v4
if: success()
with:
name: mysql-reads-results
path: benchmark/BenchmarkDotNet.Artifacts/mysql/reads
path: BenchmarkDotNet.Artifacts/mysql/reads

benchmark-mysql-writes:
name: MySQL Writes Benchmark
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./benchmark

steps:
- uses: actions/checkout@v4
Expand All @@ -64,25 +71,29 @@ jobs:
uses: xom9ikk/[email protected]
with:
load-mode: strict
path: benchmark

- name: Docker compose
uses: hoverkraft-tech/[email protected]
with:
services: mysqldb

- name: Run Benchmark
run: ./benchmark/scripts/run_single_benchmark.sh mysql writes
run: ./scripts/run_single_benchmark.sh mysql writes

- name: Upload Results
uses: actions/upload-artifact@v4
if: success()
with:
name: mysql-writes-results
path: benchmark/BenchmarkDotNet.Artifacts/mysql/writes
path: BenchmarkDotNet.Artifacts/mysql/writes

benchmark-postgresql-reads:
name: PostgreSQL Reads Benchmark
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./benchmark

steps:
- uses: actions/checkout@v4
Expand All @@ -96,25 +107,29 @@ jobs:
uses: xom9ikk/[email protected]
with:
load-mode: strict
path: benchmark

- name: Docker compose
uses: hoverkraft-tech/[email protected]
with:
services: postgresdb

- name: Run Benchmark
run: ./benchmark/scripts/run_single_benchmark.sh postgresql reads
run: ./scripts/run_single_benchmark.sh postgresql reads

- name: Upload Results
uses: actions/upload-artifact@v4
if: success()
with:
name: postgresql-reads-results
path: benchmark/BenchmarkDotNet.Artifacts/postgresql/reads
path: BenchmarkDotNet.Artifacts/postgresql/reads

benchmark-postgresql-writes:
name: PostgreSQL Writes Benchmark
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./benchmark

steps:
- uses: actions/checkout@v4
Expand All @@ -128,25 +143,29 @@ jobs:
uses: xom9ikk/[email protected]
with:
load-mode: strict
path: benchmark

- name: Docker compose
uses: hoverkraft-tech/[email protected]
with:
services: postgresdb

- name: Run Benchmark
run: ./benchmark/scripts/run_single_benchmark.sh postgresql writes
run: ./scripts/run_single_benchmark.sh postgresql writes

- name: Upload Results
uses: actions/upload-artifact@v4
if: success()
with:
name: postgresql-writes-results
path: benchmark/BenchmarkDotNet.Artifacts/postgresql/writes
path: BenchmarkDotNet.Artifacts/postgresql/writes

benchmark-sqlite-reads:
name: SQLite Reads Benchmark
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./benchmark

steps:
- uses: actions/checkout@v4
Expand All @@ -160,20 +179,24 @@ jobs:
uses: xom9ikk/[email protected]
with:
load-mode: strict
path: benchmark

- name: Run Benchmark
run: ./benchmark/scripts/run_single_benchmark.sh sqlite reads
run: ./scripts/run_single_benchmark.sh sqlite reads

- name: Upload Results
uses: actions/upload-artifact@v4
if: success()
with:
name: sqlite-reads-results
path: benchmark/BenchmarkDotNet.Artifacts/sqlite/reads
path: BenchmarkDotNet.Artifacts/sqlite/reads

benchmark-sqlite-writes:
name: SQLite Writes Benchmark
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./benchmark

steps:
- uses: actions/checkout@v4
Expand All @@ -187,21 +210,25 @@ jobs:
uses: xom9ikk/[email protected]
with:
load-mode: strict
path: benchmark

- name: Run Benchmark
run: ./benchmark/scripts/run_single_benchmark.sh sqlite writes
run: ./scripts/run_single_benchmark.sh sqlite writes

- name: Upload Results
uses: actions/upload-artifact@v4
if: success()
with:
name: sqlite-writes-results
path: benchmark/BenchmarkDotNet.Artifacts/sqlite/writes
path: BenchmarkDotNet.Artifacts/sqlite/writes

push-results:
name: Push Results
runs-on: ubuntu-latest
if: always()
defaults:
run:
working-directory: ./benchmark
if: always() && github.event_name == 'release'
needs: [
benchmark-mysql-reads, benchmark-mysql-writes,
benchmark-postgresql-reads, benchmark-postgresql-writes,
Expand All @@ -215,37 +242,40 @@ jobs:
uses: actions/download-artifact@v4
with:
name: mysql-reads-results
path: benchmark/BenchmarkDotNet.Artifacts/mysql/reads
path: BenchmarkDotNet.Artifacts/mysql/reads

- name: Download MySQL Writes Results
uses: actions/download-artifact@v4
with:
name: mysql-writes-results
path: benchmark/BenchmarkDotNet.Artifacts/mysql/writes
path: BenchmarkDotNet.Artifacts/mysql/writes

- name: Download PostgreSQL Reads Results
uses: actions/download-artifact@v4
with:
name: postgresql-reads-results
path: benchmark/BenchmarkDotNet.Artifacts/postgresql/reads
path: BenchmarkDotNet.Artifacts/postgresql/reads

- name: Download PostgreSQL Writes Results
uses: actions/download-artifact@v4
with:
name: postgresql-writes-results
path: benchmark/BenchmarkDotNet.Artifacts/postgresql/writes
path: BenchmarkDotNet.Artifacts/postgresql/writes

- name: Download SQLite Reads Results
uses: actions/download-artifact@v4
with:
name: sqlite-reads-results
path: benchmark/BenchmarkDotNet.Artifacts/sqlite/reads
path: BenchmarkDotNet.Artifacts/sqlite/reads

- name: Download SQLite Writes Results
uses: actions/download-artifact@v4
with:
name: sqlite-writes-results
path: benchmark/BenchmarkDotNet.Artifacts/sqlite/writes
path: BenchmarkDotNet.Artifacts/sqlite/writes

- name: Update Wasm Plugin
run: ./scripts/update_wasm_plugin.sh

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./unit-tests

steps:
- uses: actions/checkout@v4

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

- name: Dotnet publish
run: dotnet publish LocalRunner -c release --output dist/
run: dotnet publish ../LocalRunner -c release --output dist/

- name: Verify pushed generated code is synced
run: |
sqlc -f sqlc.unit.test.yaml diff
run: sqlc diff

- name: Run Tests
run: |
dotnet test unit-tests/RepositoryTests
dotnet test unit-tests/CodegenTests
dotnet test RepositoryTests
dotnet test CodegenTests

end2end-tests:
name: End-to-End Tests
Expand All @@ -62,4 +64,4 @@ jobs:
uses: hoverkraft-tech/[email protected]

- name: Run Tests
run: ./end2end/scripts/run_tests.sh
run: ./end2end/scripts/run_tests.sh
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,7 @@ docker-upload/*

plugin.wasm
*.db
.env.bak
.env.bak
**/.env.bak

**/*.wasm
22 changes: 13 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ dotnet-build:

.PHONY: unit-tests
unit-tests:
dotnet test unit-tests/RepositoryTests
sqlc generate -f sqlc.unit.test.yaml
dotnet test unit-tests/CodegenTests
cd unit-tests && \
dotnet test RepositoryTests && \
SQLCCACHE=./; sqlc generate && \
dotnet test CodegenTests

generate-end2end-tests:
./end2end/scripts/generate_tests.sh
Expand Down Expand Up @@ -50,22 +51,25 @@ run-end2end-tests:
./end2end/scripts/run_tests.sh

# Benchmarks
run-benchmark-sqlite-reads: sqlc-generate
sqlc-generate-benchmark:
SQLCCACHE=./; sqlc -f benchmark/sqlc.yaml generate

run-benchmark-sqlite-reads: sqlc-generate-benchmark
./benchmark/scripts/run_single_benchmark.sh sqlite reads

run-benchmark-sqlite-writes: sqlc-generate
run-benchmark-sqlite-writes: sqlc-generate-benchmark
./benchmark/scripts/run_single_benchmark.sh sqlite writes

run-benchmark-postgresql-reads: sqlc-generate
run-benchmark-postgresql-reads: sqlc-generate-benchmark
./benchmark/scripts/run_single_benchmark.sh postgresql reads

run-benchmark-postgresql-writes: sqlc-generate
run-benchmark-postgresql-writes: sqlc-generate-benchmark
./benchmark/scripts/run_single_benchmark.sh postgresql writes

run-benchmark-mysql-reads: sqlc-generate
run-benchmark-mysql-reads: sqlc-generate-benchmark
./benchmark/scripts/run_single_benchmark.sh mysql reads

run-benchmark-mysql-writes: sqlc-generate
run-benchmark-mysql-writes: sqlc-generate-benchmark
./benchmark/scripts/run_single_benchmark.sh mysql writes

# Manual
Expand Down
7 changes: 7 additions & 0 deletions benchmark/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SQLITE_CONNECTION_STRING="Data Source=benchmark.db;Mode=ReadWrite"
MYSQL_CONNECTION_STRING="server=localhost;database=sales;user=root;AllowLoadLocalInfile=true;ConvertZeroDateTime=True"
POSTGRES_CONNECTION_STRING="host=localhost;database=tests;username=postgres;password=pass;IncludeErrorDetail=true"

POSTGRES_USER="postgres"
POSTGRES_PASSWORD="pass"
TESTS_DB="tests"
Loading
Loading