Skip to content

Commit

Permalink
feat: do not call docker within github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
eEQK committed Dec 28, 2024
1 parent 8154dad commit 4cecd1d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,26 @@ on:
pull_request:
jobs:
build_and_test:
services:
postgres:
image: postgres
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5439:5432
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: sqlc-dev/setup-sqlc@v4
with:
sqlc-version: '1.27.0'
- uses: actions/setup-node@v4
- uses: oven-sh/setup-bun@v2
- run: wget https://github.com/bytecodealliance/javy/releases/download/v4.0.0/javy-x86_64-linux-v4.0.0.gz
- run: gzip -d javy-x86_64-linux-v4.0.0.gz
Expand Down
7 changes: 6 additions & 1 deletion test/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ for (const c of cases) {
await $`bun run ${c} prepare`;
}

await $`docker compose up -d`;
const dbStatus = await $`pg_isready -h localhost -p 5439`;
if (dbStatus.exitCode !== 0) {
// when running in CI, the database will be up already
await $`docker compose up -d`;
}

await $`sqlc generate`;

await db.file("schema.sql");
Expand Down

0 comments on commit 4cecd1d

Please sign in to comment.