-
Notifications
You must be signed in to change notification settings - Fork 1.2k
237 lines (215 loc) · 7.72 KB
/
scenario-builds.yml
File metadata and controls
237 lines (215 loc) · 7.72 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
230
231
232
233
234
235
236
237
name: "Scenario Build Verification"
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "test/scenarios/**"
- "nodejs/src/**"
- "python/copilot/**"
- "go/**/*.go"
- "dotnet/src/**"
- "rust/src/**"
- "rust/Cargo.toml"
- ".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"
if: github.event.repository.fork == false
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"
if: github.event.repository.fork == false
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"
if: github.event.repository.fork == false
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"
if: github.event.repository.fork == false
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
# ── Rust ────────────────────────────────────────────────────────────
build-rust:
name: "Rust scenarios"
if: github.event.repository.fork == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@1.94.0
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
test/scenarios/**/rust/target
key: ${{ runner.os }}-cargo-scenarios-${{ hashFiles('rust/Cargo.toml', 'test/scenarios/**/rust/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-scenarios-
- name: Build all Rust scenarios
run: |
PASS=0; FAIL=0; FAILURES=""
for manifest in $(find test/scenarios -path '*/rust/Cargo.toml' | sort); do
dir=$(dirname "$manifest")
scenario="${dir#test/scenarios/}"
echo "::group::$scenario"
if (cd "$dir" && cargo build --quiet 2>&1); then
echo "✅ $scenario"
PASS=$((PASS + 1))
else
echo "❌ $scenario"
FAIL=$((FAIL + 1))
FAILURES="$FAILURES\n $scenario"
fi
echo "::endgroup::"
done
echo ""
echo "Rust builds: $PASS passed, $FAIL failed"
if [ "$FAIL" -gt 0 ]; then
echo -e "Failures:$FAILURES"
exit 1
fi