Skip to content

Commit 54f3fb5

Browse files
committed
Add validation to ensure TiDB versions stay in sync
Add validation step that checks env.TIDB_VERSIONS matches test matrix entries. Fails workflow if versions are out of sync, preventing mismatches between pre-download and test execution.
1 parent 237943f commit 54f3fb5

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

.github/workflows/main.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,31 @@ jobs:
3535
with:
3636
fetch-depth: 1
3737

38+
- name: Validate TiDB versions sync
39+
run: |
40+
# Extract TiDB versions from test matrix and compare with env.TIDB_VERSIONS
41+
EXPECTED_VERSIONS="${{ env.TIDB_VERSIONS }}"
42+
MATRIX_VERSIONS=$(grep -E "testtidb[0-9]" .github/workflows/main.yml | sed 's/.*testtidb\([0-9.]*\).*/\1/' | tr '\n' ' ' | xargs)
43+
44+
echo "Expected versions (from env): $EXPECTED_VERSIONS"
45+
echo "Matrix versions (from test targets): $MATRIX_VERSIONS"
46+
47+
# Check if versions match (simple check - both should contain same versions)
48+
MISSING=""
49+
for version in $EXPECTED_VERSIONS; do
50+
if ! echo "$MATRIX_VERSIONS" | grep -q "$version"; then
51+
MISSING="$MISSING $version"
52+
fi
53+
done
54+
55+
if [ -n "$MISSING" ]; then
56+
echo "ERROR: TiDB versions in env.TIDB_VERSIONS not found in test matrix: $MISSING"
57+
echo "Please ensure test matrix includes testtidb* entries for all versions in env.TIDB_VERSIONS"
58+
exit 1
59+
fi
60+
61+
echo "✓ TiDB versions are in sync"
62+
3863
- name: Set up Go
3964
uses: actions/setup-go@v4
4065
with:

0 commit comments

Comments
 (0)