Skip to content

Commit 4b75eed

Browse files
authored
refactor: separate CI tests, and support pg bouncer (#529)
* feat: add support for PgBouncer in database initialization * refactor: consolidate gorm configuration for database connection * Add MySQL and multi-driver DB integration tests (#535) * feat: streamline integration tests by using a centralized docker-compose file * fix: add timeout * refactor: replace inline service definitions with docker-compose action for integration tests * fix: update pgbouncer image and environment variable names for consistency
1 parent 8ff1c2c commit 4b75eed

16 files changed

+426
-303
lines changed

.github/workflows/claude.yml

Lines changed: 0 additions & 64 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Database Integration Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: test-db-${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
db-integration:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Start integration services
23+
uses: hoverkraft-tech/compose-action@v2.0.2
24+
with:
25+
compose-file: |
26+
integration/docker/docker-compose.ci.yml
27+
services: |
28+
redis
29+
postgres
30+
mysql
31+
pgbouncer
32+
33+
- name: Setup Go
34+
uses: actions/setup-go@v5
35+
with:
36+
go-version: '1.23'
37+
38+
- name: Install uv
39+
run: |
40+
curl -LsSf https://astral.sh/uv/install.sh | sh
41+
echo "UV_PATH=$(which uv)" >> $GITHUB_ENV
42+
43+
- name: Setup License
44+
run: go run cmd/license/generate/main.go
45+
46+
- name: Install dependencies
47+
run: go mod download
48+
49+
- name: Run database integration tests
50+
run: go test -v ./integration/db/...
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Plugin Integration Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: test-plugin-${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
plugin-integration:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Start integration services
23+
uses: hoverkraft-tech/compose-action@v2.0.2
24+
with:
25+
compose-file: |
26+
integration/docker/docker-compose.ci.yml
27+
services: |
28+
redis
29+
postgres
30+
mysql
31+
pgbouncer
32+
33+
- name: Setup Go
34+
uses: actions/setup-go@v5
35+
with:
36+
go-version: '1.23'
37+
38+
- name: Install uv
39+
run: |
40+
curl -LsSf https://astral.sh/uv/install.sh | sh
41+
echo "UV_PATH=$(which uv)" >> $GITHUB_ENV
42+
43+
- name: Setup License
44+
run: go run cmd/license/generate/main.go
45+
46+
- name: Install dependencies
47+
run: go mod download
48+
49+
- name: Run plugin integration tests
50+
run: go test -v ./integration/plugin/...

.github/workflows/tests-unit.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Run Unit Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: test-unit-${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
unit-tests:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Start integration services
23+
uses: hoverkraft-tech/compose-action@v2.0.2
24+
with:
25+
compose-file: |
26+
integration/docker/docker-compose.ci.yml
27+
services: |
28+
redis
29+
postgres
30+
31+
- name: Setup Go
32+
uses: actions/setup-go@v5
33+
with:
34+
go-version: '1.23'
35+
36+
- name: Install uv
37+
run: |
38+
curl -LsSf https://astral.sh/uv/install.sh | sh
39+
echo "UV_PATH=$(which uv)" >> $GITHUB_ENV
40+
41+
- name: Setup License
42+
run: go run cmd/license/generate/main.go
43+
44+
- name: Install dependencies
45+
run: go mod download
46+
47+
- name: Run unit tests
48+
run: go test -v -timeout 1m ./cmd/... ./internal/... ./pkg/...

.github/workflows/tests.yml

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)