Skip to content

Commit fe10fc7

Browse files
authored
Improve CI baseline check (microsoft#55418)
1 parent 3afb1e5 commit fe10fc7

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ jobs:
240240
- name: Self build
241241
run: npx hereby build-src --built
242242

243-
unused-baselines:
243+
baselines:
244244
runs-on: ubuntu-latest
245245

246246
steps:
@@ -258,11 +258,22 @@ jobs:
258258
run: npm test &> /dev/null || exit 0
259259

260260
- name: Accept baselines
261-
run: npx hereby baseline-accept
261+
run: |
262+
npx hereby baseline-accept
263+
git add tests/baselines/reference
262264
263-
- name: Check for unused baselines
265+
- name: Check baselines
264266
run: |
265-
if ! git diff --exit-code --quiet; then
266-
echo "Unused baselines:"
267-
git diff --exit-code --name-only
267+
function print_diff() {
268+
if ! git diff --staged --exit-code --quiet --diff-filter=$1; then
269+
echo "$2:"
270+
git diff --staged --name-only --diff-filter=$1
271+
fi
272+
}
273+
274+
if ! git diff --staged --exit-code --quiet; then
275+
print_diff ACR "Missing baselines"
276+
print_diff MTUXB "Modified baselines"
277+
print_diff D "Unused baselines"
278+
exit 1
268279
fi

0 commit comments

Comments
 (0)