Skip to content

Commit 3275b12

Browse files
patnikoCopilot
andcommitted
Add CI caching and justfile targets for scenario builds
- Add npm, Go module, and NuGet caching to scenario-builds.yml - Add just scenario-build, scenario-verify, scenario-build-lang targets Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e3856b1 commit 3275b12

2 files changed

Lines changed: 125 additions & 0 deletions

File tree

.github/workflows/scenario-builds.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ jobs:
3333
with:
3434
node-version: 22
3535

36+
- uses: actions/cache@v4
37+
with:
38+
path: ~/.npm
39+
key: ${{ runner.os }}-npm-scenarios-${{ hashFiles('test/scenarios/**/package.json') }}
40+
restore-keys: |
41+
${{ runner.os }}-npm-scenarios-
42+
3643
# Build the SDK so local file: references resolve
3744
- name: Build SDK
3845
working-directory: nodejs
@@ -106,6 +113,8 @@ jobs:
106113
- uses: actions/setup-go@v6
107114
with:
108115
go-version: "1.24"
116+
cache: true
117+
cache-dependency-path: test/scenarios/**/go.sum
109118

110119
- name: Build all Go scenarios
111120
run: |
@@ -142,6 +151,13 @@ jobs:
142151
with:
143152
dotnet-version: "8.0.x"
144153

154+
- uses: actions/cache@v4
155+
with:
156+
path: ~/.nuget/packages
157+
key: ${{ runner.os }}-nuget-scenarios-${{ hashFiles('test/scenarios/**/*.csproj') }}
158+
restore-keys: |
159+
${{ runner.os }}-nuget-scenarios-
160+
145161
- name: Build all C# scenarios
146162
run: |
147163
PASS=0; FAIL=0; FAILURES=""

justfile

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,112 @@ validate-docs-go:
117117
validate-docs-cs:
118118
@echo "=== Validating C# documentation ==="
119119
@cd scripts/docs-validation && npm run validate:cs
120+
121+
# Build all scenario samples (all languages)
122+
scenario-build:
123+
#!/usr/bin/env bash
124+
set -euo pipefail
125+
echo "=== Building all scenario samples ==="
126+
TOTAL=0; PASS=0; FAIL=0
127+
128+
build_lang() {
129+
local lang="$1" find_expr="$2" build_cmd="$3"
130+
echo ""
131+
echo "── $lang ──"
132+
while IFS= read -r target; do
133+
[ -z "$target" ] && continue
134+
dir=$(dirname "$target")
135+
scenario="${dir#test/scenarios/}"
136+
TOTAL=$((TOTAL + 1))
137+
if (cd "$dir" && eval "$build_cmd" >/dev/null 2>&1); then
138+
printf " ✅ %s\n" "$scenario"
139+
PASS=$((PASS + 1))
140+
else
141+
printf " ❌ %s\n" "$scenario"
142+
FAIL=$((FAIL + 1))
143+
fi
144+
done < <(find test/scenarios $find_expr | sort)
145+
}
146+
147+
# TypeScript: npm install
148+
(cd nodejs && npm ci --ignore-scripts --silent 2>/dev/null) || true
149+
build_lang "TypeScript" "-path '*/typescript/package.json'" "npm install --ignore-scripts"
150+
151+
# Python: syntax check
152+
build_lang "Python" "-path '*/python/main.py'" "python3 -c \"import ast; ast.parse(open('main.py').read())\""
153+
154+
# Go: go build
155+
build_lang "Go" "-path '*/go/go.mod'" "go build ./..."
156+
157+
# C#: dotnet build
158+
build_lang "C#" "-name '*.csproj' -path '*/csharp/*'" "dotnet build --nologo -v quiet"
159+
160+
echo ""
161+
echo "══════════════════════════════════════"
162+
echo " Scenario build summary: $PASS passed, $FAIL failed (of $TOTAL)"
163+
echo "══════════════════════════════════════"
164+
[ "$FAIL" -eq 0 ]
165+
166+
# Run the full scenario verify orchestrator (build + E2E, needs real CLI)
167+
scenario-verify:
168+
@echo "=== Running scenario verification ==="
169+
@bash test/scenarios/verify.sh
170+
171+
# Build scenarios for a single language (typescript, python, go, csharp)
172+
scenario-build-lang LANG:
173+
#!/usr/bin/env bash
174+
set -euo pipefail
175+
echo "=== Building {{LANG}} scenarios ==="
176+
PASS=0; FAIL=0
177+
178+
case "{{LANG}}" in
179+
typescript)
180+
(cd nodejs && npm ci --ignore-scripts --silent 2>/dev/null) || true
181+
for target in $(find test/scenarios -path '*/typescript/package.json' | sort); do
182+
dir=$(dirname "$target"); scenario="${dir#test/scenarios/}"
183+
if (cd "$dir" && npm install --ignore-scripts >/dev/null 2>&1); then
184+
printf " ✅ %s\n" "$scenario"; PASS=$((PASS + 1))
185+
else
186+
printf " ❌ %s\n" "$scenario"; FAIL=$((FAIL + 1))
187+
fi
188+
done
189+
;;
190+
python)
191+
for target in $(find test/scenarios -path '*/python/main.py' | sort); do
192+
dir=$(dirname "$target"); scenario="${dir#test/scenarios/}"
193+
if python3 -c "import ast; ast.parse(open('$target').read())" 2>/dev/null; then
194+
printf " ✅ %s\n" "$scenario"; PASS=$((PASS + 1))
195+
else
196+
printf " ❌ %s\n" "$scenario"; FAIL=$((FAIL + 1))
197+
fi
198+
done
199+
;;
200+
go)
201+
for target in $(find test/scenarios -path '*/go/go.mod' | sort); do
202+
dir=$(dirname "$target"); scenario="${dir#test/scenarios/}"
203+
if (cd "$dir" && go build ./... >/dev/null 2>&1); then
204+
printf " ✅ %s\n" "$scenario"; PASS=$((PASS + 1))
205+
else
206+
printf " ❌ %s\n" "$scenario"; FAIL=$((FAIL + 1))
207+
fi
208+
done
209+
;;
210+
csharp)
211+
for target in $(find test/scenarios -name '*.csproj' -path '*/csharp/*' | sort); do
212+
dir=$(dirname "$target"); scenario="${dir#test/scenarios/}"
213+
if (cd "$dir" && dotnet build --nologo -v quiet >/dev/null 2>&1); then
214+
printf " ✅ %s\n" "$scenario"; PASS=$((PASS + 1))
215+
else
216+
printf " ❌ %s\n" "$scenario"; FAIL=$((FAIL + 1))
217+
fi
218+
done
219+
;;
220+
*)
221+
echo "Unknown language: {{LANG}}. Use: typescript, python, go, csharp"
222+
exit 1
223+
;;
224+
esac
225+
226+
echo ""
227+
echo "{{LANG}} scenarios: $PASS passed, $FAIL failed"
228+
[ "$FAIL" -eq 0 ]

0 commit comments

Comments
 (0)