Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Use a local database #19

Merged
merged 9 commits into from
Mar 3, 2024
Merged
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
81 changes: 72 additions & 9 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
name: examples
on: [push]
jobs:
bun:
bun-mysql:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- dir: "examples/bun-mysql2"
qs: "mysql"
steps:
- uses: actions/checkout@v4
- uses: sqlc-dev/setup-sqlc@v4
with:
sqlc-version: '1.24.0'
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: "8.1"
- run: bun install
working-directory: ${{ matrix.dir }}
- run: mysql --user="root" --database="mysql" < schema.sql
working-directory: examples/authors/mysql
- run: bun run src/main.ts
working-directory: ${{ matrix.dir }}
env:
DATABASE_URL: mysql://root:@localhost:3306/mysql

bun-postgresql:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- dir: "examples/bun-postgres"
qs: "postgresql"
- dir: "examples/bun-pg"
Expand All @@ -20,21 +45,53 @@ jobs:
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- uses: sqlc-dev/action-setup-postgres@master
with:
postgres-version: "16"
id: postgres
- run: bun install
working-directory: ${{ matrix.dir }}
- run: echo "DATABASE_URL=$(sqlc createdb --queryset ${{ matrix.qs }})" >> $GITHUB_ENV
working-directory: examples/authors
- run: psql -f schema.sql "$DATABASE_URL"
working-directory: examples/authors/postgresql
env:
SQLC_AUTH_TOKEN: ${{ secrets.SQLC_AUTH_TOKEN }}
DATABASE_URL: ${{ steps.postgres.outputs.connection-uri }}?sslmode=disable
- run: bun run src/main.ts
working-directory: ${{ matrix.dir }}
node:
env:
DATABASE_URL: ${{ steps.postgres.outputs.connection-uri }}?sslmode=disable

node-mysql:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- dir: "examples/node-mysql2"
qs: "mysql"
steps:
- uses: actions/checkout@v4
- uses: sqlc-dev/setup-sqlc@v4
with:
sqlc-version: '1.24.0'
- uses: actions/setup-node@v4
- uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: "8.1"
- run: npm install
working-directory: ${{ matrix.dir }}
- run: npx tsc
working-directory: ${{ matrix.dir }}
- run: mysql --user="root" --database="mysql" < schema.sql
working-directory: examples/authors/mysql
- run: node ./src/main.js
working-directory: ${{ matrix.dir }}
env:
DATABASE_URL: mysql://root:@localhost:3306/mysql

node-postgresql:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- dir: "examples/node-postgres"
qs: "postgresql"
- dir: "examples/node-pg"
Expand All @@ -45,13 +102,19 @@ jobs:
with:
sqlc-version: '1.24.0'
- uses: actions/setup-node@v4
- uses: sqlc-dev/action-setup-postgres@master
with:
postgres-version: "16"
id: postgres
- run: npm install
working-directory: ${{ matrix.dir }}
- run: npx tsc
working-directory: ${{ matrix.dir }}
- run: echo "DATABASE_URL=$(sqlc createdb --queryset ${{ matrix.qs }})" >> $GITHUB_ENV
working-directory: examples/authors
- run: psql -f schema.sql "$DATABASE_URL"
working-directory: examples/authors/postgresql
env:
SQLC_AUTH_TOKEN: ${{ secrets.SQLC_AUTH_TOKEN }}
DATABASE_URL: ${{ steps.postgres.outputs.connection-uri }}?sslmode=disable
- run: node ./src/main.js
working-directory: ${{ matrix.dir }}
working-directory: ${{ matrix.dir }}
env:
DATABASE_URL: ${{ steps.postgres.outputs.connection-uri }}?sslmode=disable