forked from ohmyform/ohmyform
-
Notifications
You must be signed in to change notification settings - Fork 0
223 lines (194 loc) · 5.9 KB
/
api-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
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: API Test
on:
pull_request:
paths:
- 'api/**'
- '.github/workflows/api-test.yml'
branches:
- master
env:
CREATE_ADMIN: true
ADMIN_EMAIL: admin@localhost
ADMIN_USERNAME: admin
ADMIN_PASSWORD: admin
MAILER_URI: smtp://localhost:1025
jobs:
run-linters:
name: run API lint
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
sparse-checkout: 'api'
sparse-checkout-cone-mode: false
- name: Move API files to root
run: |
ls -lah
shopt -s dotglob
mv api/* .
rm -rf api
ls -lah
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 16
# ESLint and Prettier must be in `package.json`
- name: Install Node.js dependencies
run: yarn install --frozen-lockfile --silent
- run: ls -lah
- name: Lint
uses: reviewdog/action-eslint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review # Change reporter.
eslint_flags: '{src,test}/**/*.ts'
- name: Typecheck
uses: andoshin11/[email protected]
run-postgres:
name: run API postgres migrations
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10-alpine
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: ohmyform
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
sparse-checkout: 'api'
sparse-checkout-cone-mode: false
- name: Move API files to root
run: |
ls -lah
shopt -s dotglob
mv api/* .
rm -rf api
ls -lah
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 16
- name: Install Node.js dependencies
run: yarn install --frozen-lockfile --silent
- name: PostgreSQL Migrations
run: yarn typeorm migration:run
env:
DATABASE_DRIVER: postgres
TYPEORM_CONNECTION: postgres
TYPEORM_HOST: localhost
TYPEORM_PORT: 5432
TYPEORM_USERNAME: root
TYPEORM_PASSWORD: root
TYPEORM_DATABASE: ohmyform
TYPEORM_AUTO_SCHEMA_SYNC: false
TYPEORM_ENTITIES: src/entity/**/*.ts
TYPEORM_SUBSCRIBERS: src/subscriber/**/*.ts
TYPEORM_MIGRATIONS: src/migrations/postgres/**/*.ts
TYPEORM_MIGRATIONS_TRANSACTION_MODE: 'each'
TYPEORM_ENTITIES_DIR: src/entity
TYPEORM_MIGRATIONS_DIR: src/migrations/postgres
TYPEORM_SUBSCRIBERS_DIR: src/subscriber
run-mariadb:
name: run API mariadb migrations
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: ohmyform
ports:
- 3306:3306
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
sparse-checkout: 'api'
sparse-checkout-cone-mode: false
- name: Move API files to root
run: |
ls -lah
shopt -s dotglob
mv api/* .
rm -rf api
ls -lah
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 16
- name: Install Node.js dependencies
run: yarn install --frozen-lockfile --silent
- name: MariaDB Migrations
run: yarn typeorm migration:run
env:
DATABASE_DRIVER: mariadb
TYPEORM_CONNECTION: mariadb
TYPEORM_HOST: localhost
TYPEORM_PORT: 3306
TYPEORM_USERNAME: root
TYPEORM_PASSWORD: root
TYPEORM_DATABASE: ohmyform
TYPEORM_AUTO_SCHEMA_SYNC: false
TYPEORM_ENTITIES: src/entity/**/*.ts
TYPEORM_SUBSCRIBERS: src/subscriber/**/*.ts
TYPEORM_MIGRATIONS: src/migrations/mariadb/**/*.ts
TYPEORM_MIGRATIONS_TRANSACTION_MODE: 'each'
TYPEORM_ENTITIES_DIR: src/entity
TYPEORM_MIGRATIONS_DIR: src/migrations/mariadb
TYPEORM_SUBSCRIBERS_DIR: src/subscriber
run-sqlite:
name: run API sqlite migrations
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
sparse-checkout: 'api'
sparse-checkout-cone-mode: false
- name: Move API files to root
run: |
ls -lah
shopt -s dotglob
mv api/* .
rm -rf api
ls -lah
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 16
- name: Install Node.js dependencies
run: yarn install --frozen-lockfile --silent
- name: SQLite Migrations
run: yarn typeorm migration:run --transaction none
env:
DATABASE_DRIVER: sqlite
TYPEORM_CONNECTION: sqlite
TYPEORM_USERNAME: root
TYPEORM_DATABASE: data.sqlite
TYPEORM_AUTO_SCHEMA_SYNC: false
TYPEORM_ENTITIES: src/entity/**/*.ts
TYPEORM_SUBSCRIBERS: src/subscriber/**/*.ts
TYPEORM_MIGRATIONS: src/migrations/sqlite/**/*.ts
TYPEORM_MIGRATIONS_TRANSACTION_MODE: 'none'
TYPEORM_ENTITIES_DIR: src/entity
TYPEORM_MIGRATIONS_DIR: src/migrations/sqlite
TYPEORM_SUBSCRIBERS_DIR: src/subscriber