-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (56 loc) · 1.92 KB
/
main.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
name: CI
on: push
jobs:
test:
name: Lint, typecheck & test
runs-on: ubuntu-16.04
# Start a Postgres instance, which is used during tests
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
# This needs to match the POSTGRES_* env variables set in the Postgres service above
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: "14"
# Cache node_modules for faster CI runs if the yarn.lock doesn't change change
- name: Get yarn cache directory path
id: yarn-cache-dir
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# Throw an error if the yarn.lock file doesn't match the installed dependencies (rather than updating it in-place, which it does by default locally)
- name: Install
run: yarn install --frozen-lockfile --silent
- name: Copy example env
run: cp .env.example .env
- name: Copy example env.local
run: cp .env.local.example .env.local
- name: Generate
run: yarn generate
- name: Migrate the CI database
run: yarn prisma:migrate
- name: Lint
run: yarn lint
- name: Typecheck
run: yarn typecheck
- name: Tests (Jest)
run: yarn test