This repository has been archived by the owner on Jun 9, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 359
58 lines (57 loc) · 1.85 KB
/
ci-workflow.yaml
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
name: CI Workflow
on: [push, pull_request]
jobs:
build:
name: build and test
runs-on: ubuntu-20.04
services:
postgres:
image: postgres:14
env:
POSTGRES_PASSWORD: password
POSTGRES_DB: chapter
ports:
- 5432:5432
strategy:
fail-fast: false
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run linter
run: npm run lint
- name: Run local tests
run: npm t
- name:
Check code generation
# 1) try to generate code, 2) clean up, 3) check if the correct code has been committed
run: |
npm run dev:server & ./server/wait-for localhost:5000 -- npm run gen
killall node
./scripts/check-generated-code.sh
- name:
Check migrations
# 1) apply commited migrations, 2) try to generate a new migration, 3) check if this was possible
env:
DB_PORT: 5432
run: |
npm run prisma -- migrate reset --force --skip-generate --skip-seed
npm run prisma -- migrate dev --skip-generate --skip-seed --name test
./scripts/check-migrations.sh
- name: Start Docker Development Environment
env:
DB_PORT: 54320
run: docker compose up -d
- name: Seed the Docker db
env:
DB_PORT: 54320
# We don't need to build the server explicitly, because npm run
# dev:server is run earlier and it runs tsc.
run: npm run db:migrate:reset