-
Notifications
You must be signed in to change notification settings - Fork 134
Implement git
submodules for specs
#182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: add-github-workflow
Are you sure you want to change the base?
Changes from all commits
9ee13f0
b7086a5
342e7a2
5732daf
1fc8668
d984f26
592168c
e3de074
c195dcd
4a813dd
05df321
60654ae
d2f7920
0435f6a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[submodule "specifications/json-ld-api"] | ||
path = specifications/json-ld-api | ||
url = [email protected]:w3c/json-ld-api.git | ||
|
||
[submodule "specifications/json-ld-framing"] | ||
path = specifications/json-ld-framing | ||
url = [email protected]:w3c/json-ld-framing.git | ||
|
||
[submodule "specifications/rdf-dataset-canonicalization"] | ||
path = specifications/rdf-dataset-canonicalization | ||
url = [email protected]:w3c-ccg/rdf-dataset-canonicalization.git |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
upgrade-submodules: | ||
git submodule update --remote --init --recursive | ||
anatoly-scherbakov marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do you remove all the checked out dirs without leaving git thinking there are unstaged changes? Put another way, how do you undo this command? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you want to undo the version upgrade of the submodules, you can do:
If you've modified the submodules locally, after having them upgraded (for debugging purposes perhaps) then you do:
|
||
|
||
test: | ||
python tests/runtests.py |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,8 @@ | |
import unittest | ||
import re | ||
from argparse import ArgumentParser | ||
from pathlib import Path | ||
from typing import List | ||
from unittest import TextTestResult | ||
|
||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'lib')) | ||
|
@@ -32,9 +34,20 @@ | |
LOCAL_BASES = [ | ||
'https://w3c.github.io/json-ld-api/tests', | ||
'https://w3c.github.io/json-ld-framing/tests', | ||
'https://github.com/json-ld/normalization/tests' | ||
'https://github.com/w3c-ccg/rdf-dataset-canonicalization/tree/main/tests', | ||
] | ||
|
||
|
||
def default_test_targets() -> List[Path]: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about changing this so it works something like the jsonld.js test runner and checks for the local test suite dir, then for the sibling dir if not found. That allows for alternate workflows. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It didn't consider missing test suites an error before. I'm not sure what should happen for that. Never seemed a problem in practice. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you believe there is a use case for it? Probably the main goal of turning specifications into submodules is to automate the connection to them, standardizing it across the developers' clones of Having the specifications cloned into the root directory of the repo, for instance, will require We can later add an error message to this function. If the default test locations are used, and if tests are missing, then probably something is wrong. For instance, the developer forgot to check out the submodules. Their tests will be incorrectly green locally, and then, after a push, failing CI will pose an unpleasant surprise. |
||
"""Default test directories from specifications.""" | ||
specifications = Path(__file__).parent.parent / 'specifications' | ||
return [ | ||
specifications / 'json-ld-api/tests', | ||
specifications / 'json-ld-framing/tests', | ||
specifications / 'rdf-dataset-canonicalization/tests', | ||
] | ||
|
||
|
||
class TestRunner(unittest.TextTestRunner): | ||
""" | ||
Loads test manifests and runs tests. | ||
|
@@ -95,18 +108,7 @@ def main(self): | |
test_targets = self.options.tests | ||
else: | ||
# default to find known sibling test dirs | ||
test_targets = [] | ||
sibling_dirs = [ | ||
'../json-ld-api/tests/', | ||
'../json-ld-framing/tests/', | ||
'../normalization/tests/', | ||
] | ||
for dir in sibling_dirs: | ||
if os.path.exists(dir): | ||
print('Test dir found', dir) | ||
test_targets.append(dir) | ||
else: | ||
print('Test dir not found', dir) | ||
test_targets = default_test_targets() | ||
|
||
# ensure a manifest or a directory was specified | ||
if len(test_targets) == 0: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the specs, but since their sole purpose here is for testing, could this be named
test-suites/
? That's what the scripts in jsonld.js use.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing!
I can rename those. A few things concern me a bit though:
tests
directory which will not be using the specifications, and the existence of bothtests
andtest-suites
will be confusing;What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the
specifications/
folder name, as I do hope/expect we'll get more unit tests added totests/
at some point, andtest-suites/
would certainly be confusing.