Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/check-generated-tests-in-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Check Generated Tests In Sync

on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
paths:
- "test_generator/**"
- "test_templates/**"
workflow_dispatch:

permissions:
contents: read

jobs:
check_generated_tests:
name: Check generated tests in sync
runs-on: ubuntu-24.04

steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
submodules: true

- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
with:
node-version: 24.x
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Check generated tests in sync
run: bin/check-generated-tests-in-sync
18 changes: 18 additions & 0 deletions bin/check-generated-tests-in-sync
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

# Synopsis:
# Check that test suites are in sync with their current templates.

set -euo pipefail

npm run res:build
make generate-tests

if [[ -n "$(git status --porcelain -- exercises/practice)" ]]; then
echo "::error:: Generated test template output does not match committed test output."
git status --short -- exercises/practice
git diff -- exercises/practice
exit 1
fi

echo "Generated test template output matches committed test output."