-
Notifications
You must be signed in to change notification settings - Fork 157
81 lines (66 loc) · 2.13 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
name: Continuous Integration
on:
pull_request:
types: [opened, synchronize]
jobs:
ci:
name: CI
runs-on: ubuntu-latest
timeout-minutes: 15
services:
postgres:
image: postgres
env:
POSTGRES_DB: oyster
POSTGRES_PASSWORD: oyster
POSTGRES_USER: oyster
ports:
- 5432:5432
options: >-
--health-cmd pg_isready --health-interval 10s --health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout
5s --health-retries 5
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
DATABASE_URL: postgres://oyster:oyster@localhost:5432/oyster
REDIS_URL: redis://localhost:6379
steps:
- name: Checkout repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache Turborepo setup
uses: actions/cache@v4
with:
# When running turbo commands, we use `.turbo` as the cache directory.
# See the root `package.json` for reference.
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
# This is how GitHub Actions restores the cache. Because we only
# the prefix of the key (and not the `github.sha`), this will allow
# us to hit the cache on any CI runs on commit on any branch.
restore-keys: |
${{ runner.os }}-turbo-
- name: Setup Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run database migrations and generate types
run: yarn db:migrate
- name: Lint
run: yarn lint --filter=[$BASE_SHA]
- name: Check types
run: yarn type-check --filter=[$BASE_SHA]
- name: Build all packages and applications
run: yarn build --filter=[$BASE_SHA]
- name: Run tests
run: yarn test --filter=[$BASE_SHA]