File tree Expand file tree Collapse file tree 5 files changed +75
-1
lines changed Expand file tree Collapse file tree 5 files changed +75
-1
lines changed Original file line number Diff line number Diff line change
1
+ name : CI
2
+ on :
3
+ push :
4
+ branches : [ 'main' ]
5
+ paths-ignore :
6
+ - ' **.md' # Don't run CI on markdown changes.
7
+ pull_request :
8
+ branches : [ 'main', 'feat/**' ]
9
+ paths-ignore :
10
+ - ' **.md'
11
+
12
+ jobs :
13
+ lints :
14
+ runs-on : ubuntu-latest
15
+ steps :
16
+ - uses : actions/checkout@v4
17
+ - name : Validate JSON Formatting
18
+ run : |
19
+ ./scripts/ci/format-json.sh
20
+ git diff-index --quiet HEAD --
21
+ - name : Validate JSON schemas
22
+ run : |
23
+ ./scripts/ci/validate-json-schemas.sh
24
+ - name : Validate all SDKs are represented in data files
25
+ run : |
26
+ ./scripts/ci/sdk-consistency.sh
Load Diff This file was deleted.
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ mapfile -t schemas < <( git grep -Fl ' https://json-schema.org' ' **/*.json' )
4
+
5
+ function runTest() {
6
+ primary=$( realpath --relative-to=" $( pwd) " " $1 " )
7
+
8
+ # Build up a list of reference schemas to use, being careful to ignore the
9
+ # schema under test. If we don't skip that one, ajv will generate an error
10
+ # about duplicate $ids.
11
+ ajvFlags=()
12
+ for schema in " ${schemas[@]} " ; do
13
+ if [[ " $schema " != " $primary " ]]; then
14
+ ajvFlags+=(-r " ${schema} " )
15
+ fi
16
+ done
17
+
18
+ npx --package=ajv-cli --package=ajv-formats ajv validate --spec=draft2020 -s " $primary " " ${ajvFlags[@]} " -d " $2 "
19
+ }
20
+
21
+ runTest ./schemas/features.json ./data/features.json
22
+ runTest ./schemas/types.json ./data/types.json
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Checks that for each SDK ID defined in sdks.json, all other files have an entry for that ID.
4
+ # If not, outputs a diff containing the missing IDs and exits with a non-zero status.
5
+
6
+ cleanup () {
7
+ rm ./data/* .json.keys
8
+ }
9
+
10
+ trap cleanup EXIT
11
+
12
+ jq -r ' values[]' ./data/sdks.json | sort > ./data/sdks.json.keys
13
+
14
+ for file in ./data/* .json; do
15
+ # Skip sdks.json itself
16
+ if [ " $file " == " ./data/sdks.json" ]; then
17
+ continue
18
+ fi
19
+ jq -r ' keys[]' " $file " | sort > " $file .keys"
20
+ if diff -q sdks.json.keys " $file .keys" > /dev/null; then
21
+ echo " $file is consistent"
22
+ else
23
+ echo " $file is missing some SDK IDs:"
24
+ diff ./data/sdks.json.keys " $file .keys"
25
+ exit 1
26
+ fi
27
+ done
You can’t perform that action at this time.
0 commit comments