-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (107 loc) · 3.04 KB
/
ci.yml
File metadata and controls
127 lines (107 loc) · 3.04 KB
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
name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
changes:
runs-on: ubuntu-latest
outputs:
web: ${{ steps.filter.outputs.web }}
api: ${{ steps.filter.outputs.api }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Detect changed paths
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
web:
- 'apps/web/**'
- 'packages/types/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- 'turbo.json'
- '.github/workflows/ci.yml'
api:
- 'apps/api/**'
- 'packages/types/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- 'turbo.json'
- '.github/workflows/ci.yml'
web:
needs: changes
if: ${{ needs.changes.outputs.web == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
env:
DATABASE_URL: postgres://dummy:dummy@localhost:5432/dummy
run: pnpm install --frozen-lockfile
- name: Build shared types
run: pnpm --filter @stack/types build
# - name: Lint web
# run: pnpm --filter web lint
- name: Typecheck web
run: pnpm --filter web exec tsc --noEmit
- name: Build web
env:
DATABASE_URL: postgres://dummy:dummy@localhost:5432/dummy
run: pnpm --filter web build
api:
needs: changes
if: ${{ needs.changes.outputs.api == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
env:
DATABASE_URL: postgres://dummy:dummy@localhost:5432/dummy
run: pnpm install --frozen-lockfile
- name: Build shared types
run: pnpm --filter @stack/types build
- name: Build API
env:
DATABASE_URL: postgres://dummy:dummy@localhost:5432/dummy
run: pnpm --filter api build
ci-status:
name: CI status
needs: [changes, web, api]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Ensure required checks passed
run: |
if [ "${{ needs.web.result }}" = "failure" ] || [ "${{ needs.api.result }}" = "failure" ]; then
echo "A required CI job failed."
exit 1
fi
echo "CI checks completed successfully."