-
Notifications
You must be signed in to change notification settings - Fork 5
130 lines (107 loc) · 4.36 KB
/
check.yml
File metadata and controls
130 lines (107 loc) · 4.36 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
128
129
130
name: Check application build
on:
pull_request:
branches: [main]
paths:
- "apps/monitor-app/**"
- "apps/client-app/**"
- "packages/client-sdk/**"
permissions:
contents: read
jobs:
check_pull_request:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify commits behind
continue-on-error: true
run: |
git fetch
COMMITS_BEHIND=$(git rev-list --left-only --count origin/$GITHUB_BASE_REF...origin/$GITHUB_HEAD_REF)
if [ $COMMITS_BEHIND -gt 0 ]; then
echo "::warning::Source branch is $COMMITS_BEHIND commit(s) behind target branch - consider rebasing"
exit 1
fi
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 24
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install deps
run: pnpm install
- name: Determine changed parts
id: changes
run: |
git fetch origin $GITHUB_BASE_REF --depth=1
MERGE_BASE=$(git merge-base origin/$GITHUB_BASE_REF HEAD || echo "")
if [ -z "$MERGE_BASE" ]; then
CHANGED_FILES=$(git diff --name-only HEAD)
else
CHANGED_FILES=$(git diff --name-only $MERGE_BASE HEAD)
fi
echo "sdk_changed=false" >> $GITHUB_OUTPUT
echo "monitor_changed=false" >> $GITHUB_OUTPUT
echo "client_changed=false" >> $GITHUB_OUTPUT
if echo "$CHANGED_FILES" | grep -q "^packages/client-sdk/"; then
echo "sdk_changed=true" >> $GITHUB_OUTPUT
fi
if echo "$CHANGED_FILES" | grep -q "^apps/monitor-app/"; then
echo "monitor_changed=true" >> $GITHUB_OUTPUT
fi
if echo "$CHANGED_FILES" | grep -q "^apps/client-app/"; then
echo "client_changed=true" >> $GITHUB_OUTPUT
fi
- name: Check sdk
if: steps.changes.outputs.sdk_changed == 'true'
run: |
pnpm --filter next-cwv-monitor build
pnpm --filter next-cwv-monitor check-size
- name: Check monitor
if: steps.changes.outputs.monitor_changed == 'true'
run: |
cp apps/monitor-app/.env.ci apps/monitor-app/.env
pnpm --filter cwv-monitor-app build
- name: Run monitor integration tests
if: steps.changes.outputs.monitor_changed == 'true'
env:
CI: true
run: pnpm --filter cwv-monitor-app test:integration
- name: Run monitor performance guardrails
if: steps.changes.outputs.monitor_changed == 'true'
env:
CI: true
run: pnpm --filter cwv-monitor-app test:perf
- name: Run monitor anomaly detection tests
if: steps.changes.outputs.monitor_changed == 'true'
env:
CI: true
run: pnpm --filter cwv-monitor-app test:anomaly
# SDK can destroy client build, so let's verify it here too
- name: Check demo (Build)
if: steps.changes.outputs.client_changed == 'true' || steps.changes.outputs.sdk_changed == 'true'
run: |
cp apps/client-app/.env.ci apps/client-app/.env 2>/dev/null || true
pnpm --filter next-cwv-monitor build
pnpm --filter cwv-monitor-client build
- name: Cache Playwright Binaries
id: playwright-cache
if: steps.changes.outputs.client_changed == 'true' || steps.changes.outputs.sdk_changed == 'true'
uses: actions/cache@v5
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Install Playwright Browsers
if: (steps.changes.outputs.client_changed == 'true' || steps.changes.outputs.sdk_changed == 'true') && steps.playwright-cache.outputs.cache-hit != 'true'
run: pnpm --filter cwv-monitor-client exec playwright install
- name: Install Playwright System Dependencies
if: steps.changes.outputs.client_changed == 'true' || steps.changes.outputs.sdk_changed == 'true'
run: pnpm --filter cwv-monitor-client exec playwright install-deps
- name: Run E2E tests
if: steps.changes.outputs.client_changed == 'true' || steps.changes.outputs.sdk_changed == 'true'
run: pnpm --filter cwv-monitor-client test
env:
CI: true