-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (78 loc) · 2.53 KB
/
Copy pathpr-checks-web.yml
File metadata and controls
88 lines (78 loc) · 2.53 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
name: PR Checks (Web)
on:
pull_request:
paths:
- 'apps/web/**'
- 'apps/docs/**'
- 'packages/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- 'turbo.json'
- '.github/workflows/pr-checks-web.yml'
push:
branches:
- main
paths:
- 'apps/web/**'
- 'apps/docs/**'
- 'packages/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- 'turbo.json'
- '.github/workflows/pr-checks-web.yml'
jobs:
web:
name: Web (lint / type-check / build)
runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-latest' || 'self-hosted' }}
steps:
- name: Reset workspace ownership
run: |
docker run --rm -v "$GITHUB_WORKSPACE:/ws" alpine \
chown -R $(id -u):$(id -g) /ws 2>/dev/null || true
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v6
with:
version: '10.6.5'
- uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: |
for attempt in 1 2 3; do
if pnpm install --frozen-lockfile; then
exit 0
fi
if [ "$attempt" -eq 3 ]; then
exit 1
fi
sleep $((attempt * 5))
done
- name: Lint
run: pnpm run lint
- name: Type check
run: pnpm run type-check
- name: Build
run: pnpm --filter web run build
env:
# Dummy env vars so Next.js build doesn't fail on missing secrets
DATABASE_URL: postgresql://dummy:dummy@localhost:5432/dummy
BETTER_AUTH_SECRET: dummy-secret-for-ci-build-only-at-least-32
BETTER_AUTH_URL: http://localhost:3000
NEXT_PUBLIC_APP_URL: http://localhost:3000
- name: Clean up runner disk
if: always()
run: |
set +e
# Reclaim any root-owned files Docker may have left behind so the
# delete below can actually remove them.
docker run --rm -v "$GITHUB_WORKSPACE:/ws" alpine \
chown -R "$(id -u):$(id -g)" /ws 2>/dev/null || true
find "$GITHUB_WORKSPACE" -mindepth 1 -delete 2>/dev/null || true
rm -rf /tmp/digests 2>/dev/null || true
# "until=1h" keeps cache layers a parallel job might still be using.
docker buildx prune -f --filter "until=1h" 2>/dev/null || true
docker system prune -f --filter "until=1h" 2>/dev/null || true
exit 0