-
Notifications
You must be signed in to change notification settings - Fork 1
140 lines (122 loc) · 3.71 KB
/
Copy pathtest.yml
File metadata and controls
140 lines (122 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Test
on:
pull_request:
branches:
- master
- develop
paths:
- "bridge/**"
- ".github/workflows/test.yml"
push:
branches:
- master
paths:
- "bridge/**"
- ".github/workflows/test.yml"
jobs:
test:
runs-on: ubuntu-latest
# Note: SQLite tests are self-contained (no service needed).
# They create a temporary database file and seed it in beforeAll().
# better-sqlite3 native module is compiled during pnpm install.
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: testdb
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U testuser -d testdb"
--health-interval=10s
--health-timeout=5s
--health-retries=5
mysql:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_USER: testuser
MYSQL_PASSWORD: testpass
MYSQL_DATABASE: testdb
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h localhost -u root -prootpass"
--health-interval=10s
--health-timeout=5s
--health-retries=5
mariadb:
image: mariadb:11
env:
MARIADB_ROOT_PASSWORD: rootpass
MARIADB_USER: testuser
MARIADB_PASSWORD: testpass
MARIADB_DATABASE: testdb
ports:
- 3307:3306
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=10s
--health-timeout=5s
--health-retries=5
env:
REAL_POSTGRES_HOST: localhost
REAL_POSTGRES_PORT: 5432
REAL_POSTGRES_USER: testuser
REAL_POSTGRES_PASSWORD: testpass
REAL_POSTGRES_DATABASE: testdb
REAL_POSTGRES_SSL: "false"
REAL_POSTGRES_SSLMODE: disable
MYSQL_HOST: nonexistent.invalid.host
MYSQL_PORT: 3306
MYSQL_USER: invaliduser
MYSQL_PASSWORD: invalidpass
MYSQL_DATABASE: invaliddb
REAL_MYSQL_HOST: localhost
REAL_MYSQL_PORT: 3306
REAL_MYSQL_USER: testuser
REAL_MYSQL_PASSWORD: testpass
REAL_MYSQL_DATABASE: testdb
MARIADB_HOST: nonexistent.invalid.host
MARIADB_PORT: 3307
MARIADB_USER: invaliduser
MARIADB_PASSWORD: invalidpass
MARIADB_DATABASE: invaliddb
REAL_MARIADB_HOST: localhost
REAL_MARIADB_PORT: 3307
REAL_MARIADB_USER: testuser
REAL_MARIADB_PASSWORD: testpass
REAL_MARIADB_DATABASE: testdb
REAL_MARIADB_SSL: "false"
# SQLite — no env vars needed; tests use a temp file
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10 # aligned with release workflow
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 22 # aligned with release workflow, not lts/*
cache: "pnpm"
- name: Install bridge dependencies
run: |
cd bridge
pnpm install --frozen-lockfile # removed --frozen-lockfile=false
- name: Seed PostgreSQL database
run: |
PGPASSWORD=testpass psql -h localhost -U testuser -d testdb -f bridge/scripts/seed-test-db.sql
- name: Seed MySQL database
run: |
mysql -h 127.0.0.1 -u root -prootpass testdb < bridge/scripts/seed-mysql.sql
- name: Seed MariaDB database
run: |
mysql -h 127.0.0.1 -P 3307 -u root -prootpass testdb < bridge/scripts/seed-mariadb.sql
- name: Run tests
run: |
cd bridge
pnpm test