File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,26 +36,32 @@ jobs:
3636
3737 - name : Install dependencies
3838 run : yarn install
39+
3940
4041 - name : Wait for Postgres to be ready
4142 run : |
4243 for i in {1..10}; do
43- pg_isready -h localhost -p 5432 && break || sleep 5
44+ pg_isready -h postgres -p 5432 && echo "Postgres is ready!" && exit 0
45+ echo "Waiting for Postgres..."
46+ sleep 5
4447 done
48+ echo "Postgres failed to start"
49+ exit 1
50+
4551
4652 - name : Sync Database
4753 env :
4854 NODE_ENV : test
4955 DB_USERNAME : postgres
5056 DB_PASSWORD : 12345678
5157 DB_NAME : database_services_test
52- DB_HOST : localhost
58+ DB_HOST : postgres
5359 JWT_SECRET : supersecretkey
5460 JWT_EXPIRES_IN : 1h
5561 run : yarn sync-db
5662
5763 - name : Wait for database to settle
58- run : sleep 5
64+ run : sleep 10
5965
6066 # - name: Run migrations
6167 # env:
7379 DB_USERNAME : postgres
7480 DB_PASSWORD : 12345678
7581 DB_NAME : database_services_test
76- DB_HOST : localhost
82+ DB_HOST : postgres
7783 JWT_SECRET : supersecretkey
7884 JWT_EXPIRES_IN : 1h
7985 run : yarn test
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ const config = {
1414 username : process . env . DB_USERNAME || 'postgres' ,
1515 password : process . env . DB_PASSWORD || '12345678' ,
1616 database : process . env . DB_NAME || 'database_services_test' ,
17- host : process . env . DB_HOST || 'localhost' ,
17+ host : process . env . CI ? 'postgres' : 'localhost' ,
1818 dialect : 'postgres' ,
1919 logging : false ,
2020 } ,
You can’t perform that action at this time.
0 commit comments