-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (46 loc) · 1.3 KB
/
Copy pathbackend.yml
File metadata and controls
57 lines (46 loc) · 1.3 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
name: Backend Tests
on:
push:
branches: [backend]
pull_request:
branches: [backend]
jobs:
backend-tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: testdb
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
defaults:
run:
working-directory: ./backend
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Wait for MySQL to be ready
run: |
until mysqladmin ping -h "127.0.0.1" --silent; do
echo "Waiting for MySQL..."
sleep 2
done
- name: Install dependencies
run: npm ci
- name: Generate Prisma Client
run: DATABASE_URL="mysql://root:root@127.0.0.1:3306/testdb" npx prisma generate
- name: Run Prisma Migrations
run: DATABASE_URL="mysql://root:root@127.0.0.1:3306/testdb" npx prisma migrate deploy
- name: Run backend tests
run: DATABASE_URL="mysql://root:root@127.0.0.1:3306/testdb" npm test