forked from qiaolei81/copilot-session-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (105 loc) · 3.76 KB
/
ci.yml
File metadata and controls
127 lines (105 loc) · 3.76 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:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
pull-requests: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build frontend
run: npm run build:prod
- name: Run linter
run: npm run lint:check
- name: Run unit tests
run: npm test
env:
DISABLE_TELEMETRY: 'true'
e2e:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'npm'
- name: Install dependencies and build
run: |
npm ci
npm run build:prod
- name: Pack tarball
run: npm pack
- name: Verify tarball contents
run: |
TARBALL=$(ls *.tgz)
tar tzf "$TARBALL" | grep "public/js/" | head -10
echo "--- Checking minified files in tarball ---"
tar tzf "$TARBALL" | grep -q "public/js/homepage.min.js" && echo "✅ homepage.min.js"
tar tzf "$TARBALL" | grep -q "public/js/session-detail.min.js" && echo "✅ session-detail.min.js"
tar tzf "$TARBALL" | grep -q "public/js/time-analyze.min.js" && echo "✅ time-analyze.min.js"
tar tzf "$TARBALL" | grep -q "public/js/telemetry-browser.min.js" && echo "✅ telemetry-browser.min.js"
echo "--- Checking NO source files ---"
! tar tzf "$TARBALL" | grep -q "src/frontend/" && echo "✅ No source files"
- name: Setup test session directories
run: |
mkdir -p ~/.copilot/session-state
mkdir -p ~/.claude/projects
mkdir -p ~/.pi/agent/sessions
- name: Generate test session data (all sources)
run: |
node __tests__/fixtures/generate-test-session.js
node __tests__/fixtures/create-multi-source-mock.js
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Install and start server from tarball
run: |
TARBALL="$(ls $GITHUB_WORKSPACE/*.tgz)"
mkdir -p /tmp/tgz-test
cd /tmp/tgz-test
npm init -y > /dev/null
npm install "$TARBALL" > /dev/null 2>&1
chmod +x node_modules/.bin/copilot-session-viewer 2>/dev/null || true
export COPILOT_SESSION_DIR="$HOME/.copilot/session-state"
export CLAUDE_SESSION_DIR="$HOME/.claude/projects"
export PI_MONO_SESSION_DIR="$HOME/.pi/agent/sessions"
export PORT=3838
export DISABLE_TELEMETRY=true
npx copilot-session-viewer &
sleep 5
curl -sf http://localhost:3838/ > /dev/null
echo "✅ Server started from tarball"
- name: Run E2E tests against tarball server
run: |
export COPILOT_SESSION_DIR="$HOME/.copilot/session-state"
export CLAUDE_SESSION_DIR="$HOME/.claude/projects"
export PI_MONO_SESSION_DIR="$HOME/.pi/agent/sessions"
npx playwright test
env:
PORT: 3838
DISABLE_TELEMETRY: 'true'
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results
path: test-results/
retention-days: 7