-
-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (122 loc) · 3.9 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Build & Test
on: push
jobs:
test:
name: Ubuntu Node.js ${{ matrix.node-version }}
# Containers must run in Linux based operating systems
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version:
- 20
- 18
- 16
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: wcjiang
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Builder Lib & Example
run: npm run build
# - name: Run tests with Postgres
# env:
# POSTGRES_HOST: localhost
# POSTGRES_USER: postgres
# POSTGRES_PASSWORD: wcjiang
# POSTGRES_DB: typenexus-base
# run: |
# npm test
- name: Run example base tests with Postgres
working-directory: examples/base
env:
# The hostname used to communicate with the PostgreSQL service container
POSTGRES_HOST: localhost
# The default PostgreSQL port
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_PASSWORD: wcjiang
run: |
npm install
npm run coverage
- name: Constructor Decorator Sample test with Postgres
working-directory: examples/constructor-decorator
env:
# The hostname used to communicate with the PostgreSQL service container
POSTGRES_HOST: localhost
# The default PostgreSQL port
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_PASSWORD: wcjiang
run: |
npm install
npm run coverage
- name: Run example CURD tests with Postgres
working-directory: examples/curd
env:
# The hostname used to communicate with the PostgreSQL service container
POSTGRES_HOST: localhost
# The default PostgreSQL port
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_PASSWORD: wcjiang
run: |
npm install
npm run coverage
- name: Run example authorized tests
working-directory: examples/authorized
run: npm run coverage
- name: Run example current-user tests
working-directory: examples/current-user
run: npm run coverage
- name: Run example status-code tests
working-directory: examples/status-code
run: npm run coverage
- name: Run example http-errors tests
working-directory: examples/http-errors
run: npm run coverage
- name: Run example middleware tests
working-directory: examples/middleware
run: npm run coverage
- name: Run example redirect tests
working-directory: examples/redirect
run: npm run coverage
- name: Run example status-code tests
working-directory: examples/status-code
run: npm run coverage
- name: Run example views-render tests
working-directory: examples/views-render
run: npm run coverage
- name: Run example uploaded-file tests
working-directory: examples/uploaded-file
run: npm run coverage
trigger_tests:
needs: test
runs-on: ubuntu-latest
steps:
- name: Trigger tests
uses: actions/github-script@v7
with:
script: |
const res = await github.rest.repos.createDispatchEvent({
owner: 'jaywcjlove',
repo: 'typenexus',
event_type: 'run-deploy'
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}