forked from github/copilot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
186 lines (168 loc) · 5.9 KB
/
scenario-builds.yml
File metadata and controls
186 lines (168 loc) · 5.9 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
name: "Scenario Build Verification"
on:
pull_request:
paths:
- "test/scenarios/**"
- "nodejs/src/**"
- "python/copilot/**"
- "go/**/*.go"
- "dotnet/src/**"
- ".github/workflows/scenario-builds.yml"
push:
branches:
- main
paths:
- "test/scenarios/**"
- ".github/workflows/scenario-builds.yml"
workflow_dispatch:
merge_group:
permissions:
contents: read
jobs:
# ── TypeScript ──────────────────────────────────────────────────────
build-typescript:
name: "TypeScript scenarios"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-scenarios-${{ hashFiles('test/scenarios/**/package.json') }}
restore-keys: |
${{ runner.os }}-npm-scenarios-
# Build the SDK so local file: references resolve
- name: Build SDK
working-directory: nodejs
run: npm ci --ignore-scripts
- name: Build all TypeScript scenarios
run: |
PASS=0; FAIL=0; FAILURES=""
for dir in $(find test/scenarios -path '*/typescript/package.json' -exec dirname {} \; | sort); do
scenario="${dir#test/scenarios/}"
echo "::group::$scenario"
if (cd "$dir" && npm install --ignore-scripts 2>&1); then
echo "✅ $scenario"
PASS=$((PASS + 1))
else
echo "❌ $scenario"
FAIL=$((FAIL + 1))
FAILURES="$FAILURES\n $scenario"
fi
echo "::endgroup::"
done
echo ""
echo "TypeScript builds: $PASS passed, $FAIL failed"
if [ "$FAIL" -gt 0 ]; then
echo -e "Failures:$FAILURES"
exit 1
fi
# ── Python ──────────────────────────────────────────────────────────
build-python:
name: "Python scenarios"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install Python SDK
run: pip install -e python/
- name: Compile and import-check all Python scenarios
run: |
PASS=0; FAIL=0; FAILURES=""
for main in $(find test/scenarios -path '*/python/main.py' | sort); do
dir=$(dirname "$main")
scenario="${dir#test/scenarios/}"
echo "::group::$scenario"
if python3 -m py_compile "$main" 2>&1 && python3 -c "import copilot" 2>&1; then
echo "✅ $scenario"
PASS=$((PASS + 1))
else
echo "❌ $scenario"
FAIL=$((FAIL + 1))
FAILURES="$FAILURES\n $scenario"
fi
echo "::endgroup::"
done
echo ""
echo "Python builds: $PASS passed, $FAIL failed"
if [ "$FAIL" -gt 0 ]; then
echo -e "Failures:$FAILURES"
exit 1
fi
# ── Go ──────────────────────────────────────────────────────────────
build-go:
name: "Go scenarios"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: "1.24"
cache: true
cache-dependency-path: test/scenarios/**/go.sum
- name: Build all Go scenarios
run: |
PASS=0; FAIL=0; FAILURES=""
for mod in $(find test/scenarios -path '*/go/go.mod' | sort); do
dir=$(dirname "$mod")
scenario="${dir#test/scenarios/}"
echo "::group::$scenario"
if (cd "$dir" && go build ./... 2>&1); then
echo "✅ $scenario"
PASS=$((PASS + 1))
else
echo "❌ $scenario"
FAIL=$((FAIL + 1))
FAILURES="$FAILURES\n $scenario"
fi
echo "::endgroup::"
done
echo ""
echo "Go builds: $PASS passed, $FAIL failed"
if [ "$FAIL" -gt 0 ]; then
echo -e "Failures:$FAILURES"
exit 1
fi
# ── C# ─────────────────────────────────────────────────────────────
build-csharp:
name: "C# scenarios"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.0.x"
- uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-scenarios-${{ hashFiles('test/scenarios/**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-scenarios-
- name: Build all C# scenarios
run: |
PASS=0; FAIL=0; FAILURES=""
for proj in $(find test/scenarios -name '*.csproj' | sort); do
dir=$(dirname "$proj")
scenario="${dir#test/scenarios/}"
echo "::group::$scenario"
if (cd "$dir" && dotnet build --nologo 2>&1); then
echo "✅ $scenario"
PASS=$((PASS + 1))
else
echo "❌ $scenario"
FAIL=$((FAIL + 1))
FAILURES="$FAILURES\n $scenario"
fi
echo "::endgroup::"
done
echo ""
echo "C# builds: $PASS passed, $FAIL failed"
if [ "$FAIL" -gt 0 ]; then
echo -e "Failures:$FAILURES"
exit 1
fi