forked from freeCodeCamp/chapter
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (55 loc) · 1.72 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
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: [16.x]
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag=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
run: npm run db:reset