Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcb1253f

Browse files
authored
chore: Use local databases (#19)
Use two new actions to run PostgreSQL and MySQL inside GitHub actions itself.
1 parent31d4796 commitcb1253f

File tree

1 file changed

+72
-9
lines changed

1 file changed

+72
-9
lines changed

‎.github/workflows/examples.yml

Lines changed: 72 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,38 @@
11
name:examples
22
on:[push]
33
jobs:
4-
bun:
4+
bun-mysql:
55
runs-on:ubuntu-latest
66
strategy:
77
matrix:
88
include:
99
-dir:"examples/bun-mysql2"
1010
qs:"mysql"
11+
steps:
12+
-uses:actions/checkout@v4
13+
-uses:sqlc-dev/setup-sqlc@v4
14+
with:
15+
sqlc-version:'1.24.0'
16+
-uses:oven-sh/setup-bun@v1
17+
with:
18+
bun-version:latest
19+
-uses:shogo82148/actions-setup-mysql@v1
20+
with:
21+
mysql-version:"8.1"
22+
-run:bun install
23+
working-directory:${{ matrix.dir }}
24+
-run:mysql --user="root" --database="mysql" < schema.sql
25+
working-directory:examples/authors/mysql
26+
-run:bun run src/main.ts
27+
working-directory:${{ matrix.dir }}
28+
env:
29+
DATABASE_URL:mysql://root:@localhost:3306/mysql
30+
31+
bun-postgresql:
32+
runs-on:ubuntu-latest
33+
strategy:
34+
matrix:
35+
include:
1136
-dir:"examples/bun-postgres"
1237
qs:"postgresql"
1338
-dir:"examples/bun-pg"
@@ -20,21 +45,53 @@ jobs:
2045
-uses:oven-sh/setup-bun@v1
2146
with:
2247
bun-version:latest
48+
-uses:sqlc-dev/action-setup-postgres@master
49+
with:
50+
postgres-version:"16"
51+
id:postgres
2352
-run:bun install
2453
working-directory:${{ matrix.dir }}
25-
-run:echo "DATABASE_URL=$(sqlc createdb --queryset ${{ matrix.qs }})" >> $GITHUB_ENV
26-
working-directory:examples/authors
54+
-run:psql -f schema.sql "$DATABASE_URL"
55+
working-directory:examples/authors/postgresql
2756
env:
28-
SQLC_AUTH_TOKEN:${{secrets.SQLC_AUTH_TOKEN }}
57+
DATABASE_URL:${{steps.postgres.outputs.connection-uri }}?sslmode=disable
2958
-run:bun run src/main.ts
3059
working-directory:${{ matrix.dir }}
31-
node:
60+
env:
61+
DATABASE_URL:${{ steps.postgres.outputs.connection-uri }}?sslmode=disable
62+
63+
node-mysql:
3264
runs-on:ubuntu-latest
3365
strategy:
3466
matrix:
3567
include:
3668
-dir:"examples/node-mysql2"
3769
qs:"mysql"
70+
steps:
71+
-uses:actions/checkout@v4
72+
-uses:sqlc-dev/setup-sqlc@v4
73+
with:
74+
sqlc-version:'1.24.0'
75+
-uses:actions/setup-node@v4
76+
-uses:shogo82148/actions-setup-mysql@v1
77+
with:
78+
mysql-version:"8.1"
79+
-run:npm install
80+
working-directory:${{ matrix.dir }}
81+
-run:npx tsc
82+
working-directory:${{ matrix.dir }}
83+
-run:mysql --user="root" --database="mysql" < schema.sql
84+
working-directory:examples/authors/mysql
85+
-run:node ./src/main.js
86+
working-directory:${{ matrix.dir }}
87+
env:
88+
DATABASE_URL:mysql://root:@localhost:3306/mysql
89+
90+
node-postgresql:
91+
runs-on:ubuntu-latest
92+
strategy:
93+
matrix:
94+
include:
3895
-dir:"examples/node-postgres"
3996
qs:"postgresql"
4097
-dir:"examples/node-pg"
@@ -45,13 +102,19 @@ jobs:
45102
with:
46103
sqlc-version:'1.24.0'
47104
-uses:actions/setup-node@v4
105+
-uses:sqlc-dev/action-setup-postgres@master
106+
with:
107+
postgres-version:"16"
108+
id:postgres
48109
-run:npm install
49110
working-directory:${{ matrix.dir }}
50111
-run:npx tsc
51112
working-directory:${{ matrix.dir }}
52-
-run:echo "DATABASE_URL=$(sqlc createdb --queryset ${{ matrix.qs }})" >> $GITHUB_ENV
53-
working-directory:examples/authors
113+
-run:psql -f schema.sql "$DATABASE_URL"
114+
working-directory:examples/authors/postgresql
54115
env:
55-
SQLC_AUTH_TOKEN:${{secrets.SQLC_AUTH_TOKEN }}
116+
DATABASE_URL:${{steps.postgres.outputs.connection-uri }}?sslmode=disable
56117
-run:node ./src/main.js
57-
working-directory:${{ matrix.dir }}
118+
working-directory:${{ matrix.dir }}
119+
env:
120+
DATABASE_URL:${{ steps.postgres.outputs.connection-uri }}?sslmode=disable

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp