-
Notifications
You must be signed in to change notification settings - Fork 922
Expand file tree
/
Copy pathjustfile
More file actions
229 lines (194 loc) · 7.31 KB
/
justfile
File metadata and controls
229 lines (194 loc) · 7.31 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# Default recipe to display help
default:
@just --list
# Format all code across all languages
format: format-go format-python format-nodejs format-dotnet
# Lint all code across all languages
lint: lint-go lint-python lint-nodejs lint-dotnet
# Run tests for all languages
test: test-go test-python test-nodejs test-dotnet
# Format Go code
format-go:
@echo "=== Formatting Go code ==="
@cd go && find . -name "*.go" -not -path "*/generated/*" -exec gofmt -w {} +
# Format Python code
format-python:
@echo "=== Formatting Python code ==="
@cd python && uv run ruff format .
# Format Node.js code
format-nodejs:
@echo "=== Formatting Node.js code ==="
@cd nodejs && npm run format
# Format .NET code
format-dotnet:
@echo "=== Formatting .NET code ==="
@cd dotnet && dotnet format src/GitHub.Copilot.SDK.csproj
# Lint Go code
lint-go:
@echo "=== Linting Go code ==="
@cd go && golangci-lint run ./...
# Lint Python code
lint-python:
@echo "=== Linting Python code ==="
@cd python && uv run ruff check . && uv run ty check copilot
# Lint Node.js code
lint-nodejs:
@echo "=== Linting Node.js code ==="
@cd nodejs && npm run format:check && npm run lint && npm run typecheck
# Lint .NET code
lint-dotnet:
@echo "=== Linting .NET code ==="
@cd dotnet && dotnet format src/GitHub.Copilot.SDK.csproj --verify-no-changes
# Test Go code
test-go:
@echo "=== Testing Go code ==="
@cd go && go test ./...
# Test Python code
test-python:
@echo "=== Testing Python code ==="
@cd python && uv run pytest
# Test Node.js code
test-nodejs:
@echo "=== Testing Node.js code ==="
@cd nodejs && npm test
# Test .NET code
test-dotnet:
@echo "=== Testing .NET code ==="
@cd dotnet && dotnet test test/GitHub.Copilot.SDK.Test.csproj
# Install all dependencies
install:
@echo "=== Installing dependencies ==="
@cd nodejs && npm ci
@cd python && uv pip install -e ".[dev]"
@cd go && go mod download
@cd dotnet && dotnet restore
@cd test/harness && npm ci --ignore-scripts
@echo "✅ All dependencies installed"
# Run interactive SDK playground
playground:
@echo "=== Starting SDK Playground ==="
@cd demos/playground && npm install && npm start
# Validate documentation code examples
validate-docs: validate-docs-extract validate-docs-check
# Extract code blocks from documentation
validate-docs-extract:
@echo "=== Extracting documentation code blocks ==="
@cd scripts/docs-validation && npm ci --silent && npm run extract
# Validate all extracted code blocks
validate-docs-check:
@echo "=== Validating documentation code blocks ==="
@cd scripts/docs-validation && npm run validate
# Validate only TypeScript documentation examples
validate-docs-ts:
@echo "=== Validating TypeScript documentation ==="
@cd scripts/docs-validation && npm run validate:ts
# Validate only Python documentation examples
validate-docs-py:
@echo "=== Validating Python documentation ==="
@cd scripts/docs-validation && npm run validate:py
# Validate only Go documentation examples
validate-docs-go:
@echo "=== Validating Go documentation ==="
@cd scripts/docs-validation && npm run validate:go
# Validate only C# documentation examples
validate-docs-cs:
@echo "=== Validating C# documentation ==="
@cd scripts/docs-validation && npm run validate:cs
# Build all scenario samples (all languages)
scenario-build:
#!/usr/bin/env bash
set -euo pipefail
echo "=== Building all scenario samples ==="
TOTAL=0; PASS=0; FAIL=0
build_lang() {
local lang="$1" find_expr="$2" build_cmd="$3"
echo ""
echo "── $lang ──"
while IFS= read -r target; do
[ -z "$target" ] && continue
dir=$(dirname "$target")
scenario="${dir#test/scenarios/}"
TOTAL=$((TOTAL + 1))
if (cd "$dir" && eval "$build_cmd" >/dev/null 2>&1); then
printf " ✅ %s\n" "$scenario"
PASS=$((PASS + 1))
else
printf " ❌ %s\n" "$scenario"
FAIL=$((FAIL + 1))
fi
done < <(find test/scenarios $find_expr | sort)
}
# TypeScript: npm install
(cd nodejs && npm ci --ignore-scripts --silent 2>/dev/null) || true
build_lang "TypeScript" "-path '*/typescript/package.json'" "npm install --ignore-scripts"
# Python: syntax check
build_lang "Python" "-path '*/python/main.py'" "python3 -c \"import ast; ast.parse(open('main.py').read())\""
# Go: go build
build_lang "Go" "-path '*/go/go.mod'" "go build ./..."
# C#: dotnet build
build_lang "C#" "-name '*.csproj' -path '*/csharp/*'" "dotnet build --nologo -v quiet"
echo ""
echo "══════════════════════════════════════"
echo " Scenario build summary: $PASS passed, $FAIL failed (of $TOTAL)"
echo "══════════════════════════════════════"
[ "$FAIL" -eq 0 ]
# Run the full scenario verify orchestrator (build + E2E, needs real CLI)
scenario-verify:
@echo "=== Running scenario verification ==="
@bash test/scenarios/verify.sh
# Build scenarios for a single language (typescript, python, go, csharp)
scenario-build-lang LANG:
#!/usr/bin/env bash
set -euo pipefail
echo "=== Building {{LANG}} scenarios ==="
PASS=0; FAIL=0
case "{{LANG}}" in
typescript)
(cd nodejs && npm ci --ignore-scripts --silent 2>/dev/null) || true
for target in $(find test/scenarios -path '*/typescript/package.json' | sort); do
dir=$(dirname "$target"); scenario="${dir#test/scenarios/}"
if (cd "$dir" && npm install --ignore-scripts >/dev/null 2>&1); then
printf " ✅ %s\n" "$scenario"; PASS=$((PASS + 1))
else
printf " ❌ %s\n" "$scenario"; FAIL=$((FAIL + 1))
fi
done
;;
python)
for target in $(find test/scenarios -path '*/python/main.py' | sort); do
dir=$(dirname "$target"); scenario="${dir#test/scenarios/}"
if python3 -c "import ast; ast.parse(open('$target').read())" 2>/dev/null; then
printf " ✅ %s\n" "$scenario"; PASS=$((PASS + 1))
else
printf " ❌ %s\n" "$scenario"; FAIL=$((FAIL + 1))
fi
done
;;
go)
for target in $(find test/scenarios -path '*/go/go.mod' | sort); do
dir=$(dirname "$target"); scenario="${dir#test/scenarios/}"
if (cd "$dir" && go build ./... >/dev/null 2>&1); then
printf " ✅ %s\n" "$scenario"; PASS=$((PASS + 1))
else
printf " ❌ %s\n" "$scenario"; FAIL=$((FAIL + 1))
fi
done
;;
csharp)
for target in $(find test/scenarios -name '*.csproj' -path '*/csharp/*' | sort); do
dir=$(dirname "$target"); scenario="${dir#test/scenarios/}"
if (cd "$dir" && dotnet build --nologo -v quiet >/dev/null 2>&1); then
printf " ✅ %s\n" "$scenario"; PASS=$((PASS + 1))
else
printf " ❌ %s\n" "$scenario"; FAIL=$((FAIL + 1))
fi
done
;;
*)
echo "Unknown language: {{LANG}}. Use: typescript, python, go, csharp"
exit 1
;;
esac
echo ""
echo "{{LANG}} scenarios: $PASS passed, $FAIL failed"
[ "$FAIL" -eq 0 ]