-
Notifications
You must be signed in to change notification settings - Fork 10
55 lines (47 loc) · 1.37 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
name: Test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
services:
db-server:
image: mysql:latest
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: events_db
MYSQL_USER: admin
MYSQL_PASSWORD: admin
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '16.x'
- name: Install dependencies
run: npm install
- name: Wait for MySQL to start
run: |
echo "Waiting for MySQL to start..."
until mysql -h 127.0.0.1 -u admin -padmin -e ";" ; do sleep 1 ; done
echo "MySQL started"
- name: Run tests
env:
APP_NAME: events-app
PORT: 3000
FRONTEND_PORT: 3001
REACT_APP_API_ENDPOINT: http://localhost:3000/v1/events
MYSQL_HOST: localhost
MYSQL_DATABASE: events_db
MYSQL_ROOT_USER: root
MYSQL_ROOT_PASSWORD: adminroot
MYSQL_USER: admin
MYSQL_PASSWORD: admin
MYSQL_PORT: 3306
MYSQL_SSL_MODE: false
DB_DIALECT: mysql
run: npm test