@@ -3,51 +3,38 @@ name: test
33on : [push, pull_request]
44
55jobs :
6- test :
6+ build :
77 runs-on : ubuntu-20.04
88
9- services :
10- # postgres:
11- # image: postgres:10.8
12- # env:
13- # POSTGRES_USER: postgres
14- # POSTGRES_PASSWORD: postgres
15- # POSTGRES_DB: pgbd
16- # ports:
17- # - 5432:5432
18- # # needed because the postgres container does not provide a healthcheck
19- # options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
9+ strategy :
10+ matrix :
11+ node-version : [12.x]
12+
13+ steps :
14+ - uses : actions/checkout@v2
15+
16+ - name : Use Node.js ${{ matrix.node-version }}
17+ uses : actions/setup-node@v1
18+ with :
19+ node-version : ${{ matrix.node-version }}
20+
21+ - name : Build for ${{ matrix.node-version }}
22+ run : scripts/build.sh
2023
21- mariadb :
22- image : mariadb:10.3
23- ports :
24- - 13306:3306
25- env :
26- MYSQL_USER : user
27- MYSQL_PASSWORD : password
28- MYSQL_DATABASE : db
29- MYSQL_ROOT_PASSWORD : password
30- options : --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=5
24+ - name : Store artifacts
25+ uses : actions/upload-artifact@v1
26+ with :
27+ name : built_node${{ matrix.node-version }}
28+ path : server/public
3129
32- mssql :
33- image : mcr.microsoft.com/mssql/server:2017-CU8-ubuntu
34- env :
35- ACCEPT_EULA : Y
36- SA_PASSWORD : SuperP4ssw0rd!
37- MSSQL_PID : Developer
38- ports :
39- - 1433:1433
30+ test :
31+ needs : build
32+ runs-on : ubuntu-20.04
4033
4134 strategy :
4235 fail-fast : false # if one job fails, others will not be aborted
4336 matrix :
44- db_uri : [
45- ' mssql://sa:SuperP4ssw0rd!@localhost:1433/dbname' ,
46- # 'postgres://postgres:postgres@localhost:5432/pgdb',
47- ' mysql://root:root@localhost:3306/db2' ,
48- ' mariadb://root:password@localhost:13306/db' ,
49- ' '
50- ]
37+ backendtype : [ '', 'mssql','mysql', 'mariadb', 'postgres' ]
5138 node-version : [12.x]
5239
5340 steps :
@@ -58,13 +45,21 @@ jobs:
5845 with :
5946 node-version : ${{ matrix.node-version }}
6047
61- - name : Build
62- run : scripts/build.sh
48+ - name : Install node modules
49+ run : npm ci --prefix server
50+
51+ - name : Download built artifacts
52+ uses : actions/download-artifact@v1
53+ with :
54+ name : built_node${{ matrix.node-version }}
55+ path : server/public
6356
64- - name : Enable mysql server included in ubuntu-20.04 image
65- run : sudo systemctl start mysql.service
57+ - name : Enable backend server
58+ if : ${{ matrix.backendtype }}
59+ run : |
60+ docker-compose -f server/docker-compose.yml up -d ${{ matrix.backendtype }}
61+ # Wait until container becomes healthy
62+ docker-compose -f server/docker-compose.yml events | grep --max-count 1 'health_status: healthy'
6663
6764 - name : Test
68- env :
69- SQLPAD_BACKEND_DB_URI : ${{ matrix.db_uri }}
70- run : npm run test --prefix server
65+ run : npm run test${{ matrix.backendtype }} --prefix server
0 commit comments