-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (50 loc) · 1.46 KB
/
test.yml
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
name: Node.js CI with MySQL
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: testdb
MYSQL_USER: testuser
MYSQL_PASSWORD: testpassword
options: --health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js 22
uses: actions/setup-node@v3
with:
node-version: 22
- name: Install dependencies
run: npm install
- name: Wait for MySQL to be ready
run: |
until mysqladmin ping --host=127.0.0.1 --user=testuser --password=testpassword --silent; do
echo "Waiting for MySQL to be ready..."
sleep 5
done
- name: Run Prisma migrations
env:
DATABASE_URL: mysql://testuser:[email protected]:3306/testdb
run: npm run db:migration:migrate
- name: Run tests
env:
APP_SECRET: very-strong-app-secret
APP_HTTP_PORT: 3000
APP_HTTP_BODY_LIMIT: 1mb
APP_HTTP_CORS: "*"
DATABASE_URL: mysql://testuser:[email protected]:3306/testdb
DATABASE_CONNECTION_LIMIT: 1
run: npm run test