Skip to content

Commit e12b26e

Browse files
Copilotrajbos
andauthored
Fix devcontainer build issues and add CI test workflow
- Remove PowerShell feature from default devcontainer (not needed, may cause timeouts) - Fix updateContentCommand path to 'cd vscode-extension && npm ci' (repo structure changed) - Add test-devcontainer.yml workflow to validate devcontainer builds in CI - Update devcontainer-local.json with correct npm ci path Agent-Logs-Url: https://github.com/rajbos/github-copilot-token-usage/sessions/a38744a9-240d-4e23-b4d8-b0344072c15c Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
1 parent 8b6de1c commit e12b26e

File tree

3 files changed

+55
-4
lines changed

3 files changed

+55
-4
lines changed

.devcontainer/devcontainer-local.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333
"containerEnv": {
3434
"NODE_OPTIONS": "--max-old-space-size=4096"
3535
},
36-
"updateContentCommand": "npm ci",
36+
"updateContentCommand": "cd vscode-extension && npm ci",
3737
"remoteUser": "node"
3838
}

.devcontainer/devcontainer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
"name": "Copilot Token Tracker Extension",
33
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm",
44
"features": {
5-
"ghcr.io/devcontainers/features/git:1": {},
6-
"ghcr.io/devcontainers/features/powershell:1": {}
5+
"ghcr.io/devcontainers/features/git:1": {}
76
},
87
"customizations": {
98
"vscode": {
@@ -27,6 +26,6 @@
2726
"containerEnv": {
2827
"NODE_OPTIONS": "--max-old-space-size=4096"
2928
},
30-
"updateContentCommand": "npm ci",
29+
"updateContentCommand": "cd vscode-extension && npm ci",
3130
"remoteUser": "node"
3231
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Test DevContainer
2+
3+
on:
4+
push:
5+
branches: [ main, develop, copilot/fix-codespace-boot-issue ]
6+
paths:
7+
- '.devcontainer/**'
8+
- '.github/workflows/test-devcontainer.yml'
9+
pull_request:
10+
branches: [ main, develop ]
11+
paths:
12+
- '.devcontainer/**'
13+
- '.github/workflows/test-devcontainer.yml'
14+
workflow_dispatch:
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
test-devcontainer:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Harden the runner (Audit all outbound calls)
25+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
26+
with:
27+
egress-policy: audit
28+
29+
- name: Checkout code
30+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
31+
32+
- name: Build and test devcontainer
33+
uses: devcontainers/ci@a56d055efecd725e8cfe370543b6071b79989cc8 # v0.3
34+
with:
35+
imageName: ghcr.io/${{ github.repository }}/devcontainer
36+
cacheFrom: ghcr.io/${{ github.repository }}/devcontainer
37+
push: never
38+
runCmd: |
39+
echo "=== DevContainer Environment Test ==="
40+
echo "Node version: $(node --version)"
41+
echo "NPM version: $(npm --version)"
42+
echo "Working directory: $(pwd)"
43+
echo "User: $(whoami)"
44+
echo ""
45+
echo "=== Installing dependencies ==="
46+
cd /workspaces/github-copilot-token-usage/vscode-extension
47+
npm ci
48+
echo ""
49+
echo "=== Running build ==="
50+
npm run compile
51+
echo ""
52+
echo "=== DevContainer test successful ==="

0 commit comments

Comments
 (0)