-
Notifications
You must be signed in to change notification settings - Fork 4
64 lines (59 loc) · 1.6 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
56
57
58
59
60
61
62
63
64
name: Test
on:
pull_request:
workflow_call:
jobs:
test:
runs-on: [ubuntu-latest]
services:
postgres:
image: postgres:13-alpine
env:
POSTGRES_PASSWORD: admin@123
POSTGRES_USER: postgres
POSTGRES_DB: test_salary_hero
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:6-alpine
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.20.1'
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ./node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list
- name: Install yarn
run: npm install yarn -g
- name: Install dependencies
run: yarn
- name: Test
env:
NODE_ENV: testing
POSTGRES_PASSWORD: admin@123
POSTGRES_USER: postgres
POSTGRES_DB_TEST: test_salary_hero
run: |
npm run typeorm:test
yarn test