-
Notifications
You must be signed in to change notification settings - Fork 376
86 lines (71 loc) · 2.02 KB
/
ci.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
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
name: test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
runs-on: ubuntu-latest
env:
CI: true
TZ: utc
NODE_ENV: test
MYSQL_DB_URL: "mysql://root:[email protected]:3306/orm_test?"
POSTGRES_DB_URL: "postgres://postgres:[email protected]:3306/orm_test?"
REDSHIFT_DB_URL: "redshift://postgres:[email protected]:3306/orm_test?"
SQLITE_DB_URL: "sqlite://?"
strategy:
matrix:
node-version: ['14', '16', '18']
name: test on nodejs ${{ matrix.node-version }}
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
ports:
- 3306:3306
postgres:
# Docker Hub image
image: postgres
# Set health checks to wait until postgres has started
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: create mysql DB
run: mysql -uroot -proot -h 127.0.0.1 --port 3306 -e "CREATE DATABASE orm_test CHARACTER SET utf8mb4;"
- name: create postgres DB
run: psql -U postgres -h 127.0.0.1 -c 'create database orm_test;'
env:
PGPASSWORD: postgres
- uses: actions/checkout@v2
- name: install node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- uses: bahmutov/npm-install@v1
- name: run tests
run: npm run test
test-success:
name: Tests
if: ${{ always() }}
runs-on: ubuntu-latest
needs: test
steps:
- name: Check build matrix status
if: ${{ needs.test.result != 'success' }}
run: exit 1