Skip to content

Commit f0c0e14

Browse files
authored
Enhance copilot setup steps for Three.js environment
Added environment variables for GitHub tokens and DISPLAY. Enhanced setup steps for Three.js test environment with Xvfb and Chrome installation. Signed-off-by: James Pether Sörling <pethers@users.noreply.github.com>
1 parent b33feb8 commit f0c0e14

1 file changed

Lines changed: 169 additions & 7 deletions

File tree

.github/workflows/copilot-setup-steps.yml

Lines changed: 169 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
paths:
1212
- .github/workflows/copilot-setup-steps.yml
1313

14+
env:
15+
GITHUB_TOKEN: ${{ secrets.COPILOT_MCP_GITHUB_PERSONAL_ACCESS_TOKEN }}
16+
GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.COPILOT_MCP_GITHUB_PERSONAL_ACCESS_TOKEN }}
17+
DISPLAY: ":99"
18+
1419
jobs:
1520
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
1621
copilot-setup-steps:
@@ -21,7 +26,6 @@ jobs:
2126
permissions:
2227
contents: read
2328
actions: read
24-
artifact-metadata: read
2529
attestations: read
2630
checks: read
2731
deployments: read
@@ -38,24 +42,154 @@ jobs:
3842
- name: Checkout
3943
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4044

41-
# JavaScript/TypeScript linting
45+
# Start Xvfb early for Playwright/Chrome
46+
- name: Start Xvfb
47+
run: |
48+
echo "🖥️ Starting Xvfb virtual display..."
49+
Xvfb :99 -screen 0 1920x1080x24 &
50+
sleep 2
51+
echo "DISPLAY=:99" >> $GITHUB_ENV
52+
echo "✅ Xvfb started on display :99"
53+
54+
# Cache APT packages for faster installs
55+
- name: Cache APT packages
56+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
57+
with:
58+
path: /var/cache/apt/archives
59+
key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/copilot-setup-steps.yml') }}
60+
restore-keys: |
61+
${{ runner.os }}-apt-
62+
63+
# Setup complete Three.js test environment
64+
- name: Setup Three.js Test Environment (Chrome + Xvfb + Dependencies)
65+
run: |
66+
echo "🔧 Setting up complete Three.js test environment..."
67+
68+
# Install system dependencies for Three.js rendering
69+
sudo apt-get update
70+
sudo apt-get install -y --no-install-recommends \
71+
xvfb dbus-x11 x11-utils \
72+
libgtk2.0-0 libgtk-3-0 libgbm-dev libgbm1 \
73+
libnotify-dev libnss3 libxss1 \
74+
libxtst6 xauth \
75+
graphviz ffmpeg \
76+
fonts-noto fonts-noto-cjk fonts-noto-cjk-extra \
77+
ca-certificates fonts-liberation \
78+
libatk-bridge2.0-0 libatk1.0-0 libcups2 \
79+
libdbus-1-3 libdrm2 libnspr4 \
80+
libx11-xcb1 libxcomposite1 libxdamage1 \
81+
libxfixes3 libxrandr2 libxrender1 \
82+
libxshmfence1 xdg-utils wget libxkbcommon0 xkb-data
83+
84+
# Install Google Chrome Stable for Three.js WebGL support
85+
wget -qO- https://dl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg
86+
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
87+
sudo apt-get update
88+
sudo apt-get install -y google-chrome-stable
89+
90+
# Setup D-Bus for Chrome
91+
sudo mkdir -p /var/run/dbus
92+
sudo dbus-daemon --system --fork || true
93+
94+
# Verify Chrome installation
95+
google-chrome --version
96+
echo "✅ Three.js test environment setup complete"
97+
env:
98+
DISPLAY: ":99"
99+
XKB_DEFAULT_RULES: evdev
100+
XKB_DEFAULT_MODEL: pc105
101+
XKB_DEFAULT_LAYOUT: us
102+
103+
# JavaScript/TypeScript setup
42104
- name: Setup Node.js
43105
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
44106
with:
45107
node-version: "24"
46108
cache: "npm"
47109

110+
- name: Cache dependencies
111+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
112+
with:
113+
path: ~/.npm
114+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
115+
restore-keys: |
116+
${{ runner.os }}-node-
117+
48118
- name: Install dependencies
49119
run: npm ci
120+
env:
121+
NODE_OPTIONS: "--max-old-space-size=4096"
50122

51-
- name: Cache build artifacts
123+
# Cache global npm packages for MCP servers
124+
- name: Cache global npm packages
52125
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
53126
with:
54-
path: dist
55-
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('src/**/*') }}
127+
path: |
128+
~/.npm
129+
/usr/local/lib/node_modules
130+
/usr/local/bin/mcp-server-*
131+
key: ${{ runner.os }}-mcp-servers-v4-${{ hashFiles('.github/copilot-mcp.json') }}
56132
restore-keys: |
57-
${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}-
58-
${{ runner.os }}-build-
133+
${{ runner.os }}-mcp-servers-v4-
134+
135+
# Pre-install MCP server packages globally
136+
- name: Install MCP server packages globally
137+
run: |
138+
echo "📦 Installing MCP server packages globally..."
139+
140+
# Install Node.js MCP servers that exist on npm
141+
npm install -g @modelcontextprotocol/server-filesystem
142+
npm install -g @modelcontextprotocol/server-memory
143+
npm install -g @modelcontextprotocol/server-sequential-thinking
144+
145+
# Pre-cache @playwright/mcp for faster startup
146+
npm install -g @playwright/mcp
147+
148+
echo "✅ Node.js MCP server packages installed globally"
149+
150+
151+
# Verify all MCP server installations
152+
- name: Verify MCP server installations
153+
run: |
154+
echo "🔍 Verifying MCP server installations..."
155+
156+
echo "=== Node.js MCP Servers ==="
157+
echo "Checking mcp-server-filesystem..."
158+
which mcp-server-filesystem && echo "✅ mcp-server-filesystem found" || echo "❌ mcp-server-filesystem NOT found"
159+
160+
echo "Checking mcp-server-memory..."
161+
which mcp-server-memory && echo "✅ mcp-server-memory found" || echo "❌ mcp-server-memory NOT found"
162+
163+
echo "Checking mcp-server-sequential-thinking..."
164+
which mcp-server-sequential-thinking && echo "✅ mcp-server-sequential-thinking found" || echo "❌ mcp-server-sequential-thinking NOT found"
165+
166+
echo "Checking @playwright/mcp..."
167+
which mcp-server-playwright 2>/dev/null && echo "✅ mcp-server-playwright found" || echo "ℹ️ @playwright/mcp available via npx"
168+
169+
echo ""
170+
echo "=== HTTP MCP Servers ==="
171+
echo "📍 GitHub MCP Server: Using HTTP endpoint (https://api.githubcopilot.com/mcp/insiders)"
172+
echo "✅ MCP server verification complete"
173+
174+
- name: Install Playwright browsers (and OS deps)
175+
run: npx playwright install --with-deps
176+
env:
177+
DISPLAY: ":99"
178+
PLAYWRIGHT_BROWSERS_PATH: "0"
179+
180+
- name: Cache Cypress binary
181+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
182+
with:
183+
path: ~/.cache/Cypress
184+
key: cypress-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
185+
restore-keys: |
186+
cypress-${{ runner.os }}-
187+
188+
- name: Verify Cypress for Three.js Testing
189+
run: |
190+
npx cypress verify
191+
npx cypress info
192+
echo "✅ Cypress verified and ready for Three.js tests"
59193
60194
- name: Display environment info
61195
run: |
@@ -65,6 +199,34 @@ jobs:
65199
echo "Node version: $(node --version)"
66200
echo "npm version: $(npm --version)"
67201
echo "TypeScript version: $(npx tsc --version)"
202+
echo "Cypress version: $(npx cypress version)"
203+
echo "Chrome version: $(google-chrome --version)"
204+
echo "Display: $DISPLAY"
205+
echo "Xvfb running: $(pgrep -x Xvfb >/dev/null && echo 'Yes' || echo 'No')"
206+
echo "D-Bus running: $(pgrep -x dbus-daemon >/dev/null && echo 'Yes' || echo 'No')"
68207
echo "Working directory: $(pwd)"
69208
echo "Build artifacts: $(ls -la dist/ 2>/dev/null | wc -l) files"
70209
echo "========================================="
210+
echo "MCP Servers Available:"
211+
echo "- GitHub MCP Server: HTTP (https://api.githubcopilot.com/mcp/insiders)"
212+
echo "- mcp-server-filesystem: $(which mcp-server-filesystem 2>/dev/null || echo 'not found')"
213+
echo "- mcp-server-memory: $(which mcp-server-memory 2>/dev/null || echo 'not found')"
214+
echo "- mcp-server-sequential-thinking: $(which mcp-server-sequential-thinking 2>/dev/null || echo 'not found')"
215+
echo "- Playwright MCP: @playwright/mcp (via npx)"
216+
echo "========================================="
217+
echo "Three.js Test Environment Ready"
218+
echo "- WebGL rendering: SwiftShader (software)"
219+
echo "- Target FPS: 30-60fps"
220+
echo "- Memory limit: 4GB Node.js heap"
221+
echo "=========================================="
222+
env:
223+
DISPLAY: ":99"
224+
225+
- name: Cache build artifacts
226+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
227+
with:
228+
path: .tsbuildinfo
229+
key: ${{ runner.os }}-tsbuild-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('src/**/*.ts', 'src/**/*.tsx') }}
230+
restore-keys: |
231+
${{ runner.os }}-tsbuild-${{ hashFiles('**/package-lock.json') }}-
232+
${{ runner.os }}-tsbuild-

0 commit comments

Comments
 (0)