File tree 4 files changed +1211
-0
lines changed 4 files changed +1211
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # Change to the working directory where the schema files are located
4
+ cd source/unified-test-format || {
5
+ echo " Directory source/unified-test-format not found."
6
+ exit 1
7
+ }
8
+
9
+ # Find the max X in schema-1.X.json
10
+ max=0
11
+ for file in schema-1.* .json; do
12
+ # Extract the version number from the filename
13
+ version=${file##* schema-1.}
14
+ version=${version% .json}
15
+
16
+ if [[ $version =~ ^[0-9]+$ ]]; then
17
+ # Compare the version number with the current max
18
+ if (( version > max)) ; then
19
+ max=$version
20
+ fi
21
+ fi
22
+ done
23
+
24
+ if (( max == 0 )) ; then
25
+ echo " No schema files found."
26
+ exit 1
27
+ fi
28
+
29
+ # Compare that file vs schema-latest.json
30
+ expected=" schema-1.$max .json"
31
+ if ! diff -u " $expected " schema-latest.json > /dev/null; then
32
+ echo " schema-latest.json is not up to date with schema-1.$max .json"
33
+ echo " please run 'make update-schema-latest' from source/ to update it"
34
+ exit 1
35
+ fi
36
+
37
+ exit 0
Original file line number Diff line number Diff line change 28
28
run : make
29
29
- name : Check all unified tests schema version is valid
30
30
run : bash .github/workflows/check_schema_version.sh
31
+ - name : Check schema-latest.json has been updated
32
+ run : bash .github/workflows/check-schema-latest.sh
Original file line number Diff line number Diff line change @@ -17,3 +17,16 @@ HAS_JSYAML:
17
17
echo ' Error: need "npm install -g js-yaml"' 1>&2 ; \
18
18
exit 1; \
19
19
fi
20
+
21
+ VERSION := $(shell \
22
+ find unified-test-format -maxdepth 1 -type f -name 'schema-1.* .json' \
23
+ | sed -E 's:.* /schema-1\.([0-9]+) \.json:\1:' \
24
+ | sort -n \
25
+ | tail -n1 \
26
+ )
27
+
28
+ .PHONY : update-schema-latest
29
+ update-schema-latest :
30
+ cp unified-test-format/schema-1.$(VERSION ) .json \
31
+ unified-test-format/schema-latest.json
32
+
You can’t perform that action at this time.
0 commit comments