travis: Choose schema based on USE_OLD_SCHEMA file (strict)#1074
travis: Choose schema based on USE_OLD_SCHEMA file (strict)#1074petertseng merged 3 commits intoexercism:masterfrom petertseng:ci-new-schema-strict
Conversation
|
Warning. Confusing CI output. This is saying:
Since alphametics intends to use the old schema, it must be the case that it is valid under the old schema and invalid under the new schema, so this is correct, but confusing. I'd suggest that I suppress the output from the invalid-under-new check! |
|
#1075 demonstrates all three possible modes of failure. |
|
Rebased |
| { "description": { "$ref": "#/definitions/description" } | ||
| , "comments" : { "$ref": "#/definitions/comments" } | ||
| , "property" : { "$ref": "#/definitions/property" } | ||
| , "input" : { "$ref": "#/definitions/input" } |
There was a problem hiding this comment.
how did I cause this to get misaligned?
|
@petertseng I was wondering if you could re-run the script to see how many (and which) exercises don't conform to the new schema? |
|
The way to track progress is to merge this PR, not to keep rebasing it. However, you are in luck, because to merge this it needs to be rebased anyway. |
|
Ugh, request for review request was accidental on my part... |
|
@petertseng This PR looks good and the CI is green. Is there anything we should be waiting for before we merge this? |
Derived from the list of invalid exercises listed in: #998 (comment)
This schema was proposed and accepted in #996
No, there is nothing to wait for. As a rule, if I have not marked a PR as "DO NOT MERGE" I intend for it to be merged. But nobody Approved (in the GitHub sense of the word), so I did not merge it. Only potential thing to watch out for: If some exercise has moved to the new schema since the last time this PR was rebased[1], then the CI will appear to pass, but will actually fail when this PR is merged. [1]: Not quite true, since Travis CI checks the result of merging, but I'd need to figure out whether Restart Build button recalculates the commit to merge with. |
| if ajv -s canonical-schema.json -d $json 2>/dev/null; then | ||
| forgotten="$forgotten $ex" | ||
| fi | ||
| schema="old-schema.json" |
There was a problem hiding this comment.
sorry, what? is this necessary?
There was a problem hiding this comment.
Yeah no, it was not necessary. This line has been removed.
If it is present, use the old schema, else use the new schema. This plan is proposed in: #998 Its merits are that it allows us to: * Track progress by simply counting number of USE_OLD_SCHEMA file. * Verify, as each PR is made, that each JSON file intending to use new schema does in fact validate. * Otherwise we have to manually run a schema check at periodic intervals. * Keep compatibility with old schema, to support moving over one file at a time instead of all at once. Note that old-schema.json is the same canonical-schema.json as is currently on master. The intention is that when all exercises use the new schema, **this commit can/should be reverted** and then all exercises will in fact use the new schema, which will replace the old completely.
petertseng
left a comment
There was a problem hiding this comment.
OK, With apologies, I made some changes since the last approval, but I have confidence in them, and if I'm wrong, the responsibility on that lies with me alone.
git diff -u 3051deb36d2293baff9f3e5a47fa9e391f7ac388 HEAD
diff --git a/.travis.yml b/.travis.yml
index 7b98a41..b129a48 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,7 +15,6 @@ script:
dir=$(dirname $json)
ex=$(basename $dir)
- schema="canonical-schema.json"
if [ -f "$dir/USE_OLD_SCHEMA" ]; then
if ! ajv -s old-schema.json -d $json; then
invalid_old="$invalid_old $ex"
@@ -25,13 +24,11 @@ script:
if ajv -s canonical-schema.json -d $json 2>/dev/null; then
forgotten="$forgotten $ex"
fi
- schema="old-schema.json"
else
if ! ajv -s canonical-schema.json -d $json; then
invalid_new="$invalid_new $ex"
fi
fi
-
done
stat=0I am pretty sure those schema lines were in there because of #1072, and were not being used in this PR.
| forgotten="$forgotten $ex" | ||
| fi | ||
| else | ||
| if ! ajv -s canonical-schema.json -d $json; then |
There was a problem hiding this comment.
this could have been an elsif but I didn't think it would make the code sufficiently clear.
The strict version of #1072: Enforces that we will not forget to remove the USE_OLD_SCHEMA file.
If it is present, use the old schema, else use the new schema.
This plan is proposed in:
#998
Its merits are that it allows us to:
schema does in fact validate.
intervals.
a time instead of all at once.
Note that old-schema.json is the same canonical-schema.json as is
currently on master.
The intention is that when all exercises use the new schema, the
commit "travis: Choose schema based on USE_OLD_SCHEMA file" can/should
be reverted and then all exercises will in fact use the new schema,
which will replace the old completely.