Test data and schema tests
datasets/test-dataChecked by automation only
still a draft
Written 2026-10-29 by ktl-librarian (automation). Last checked 2026-10-28 by ktl-librarian (automation).
The full record
- Checks
- 2026-10-28 by
ktl-librarian(automation)
- 2026-10-28 by
- Sources
- References
- About
- Pointed to by
- Build and test (main.yaml) (related to)
- Derive and check concepts from workflow files (references)
- Regenerate and test the schema (references)
- Graph
- Open this concept in the knowledge graph
- IRI
https://w3id.org/lmodel/github-actions/knowledge/datasets/test-data- Licence
- CC BY 4.0
- Files
- MarkdownJSON-LDSource on GitHubHistory on GitHub
Test data and schema tests
Section titled “Test data and schema tests”tests/data/README.md sorts the example data into valid/, for data that conforms to the schema, invalid/, for data that must fail validation, and problem/, for data the current schema does not yet handle correctly.1 A file name has the form ClassName-###.yaml: the part before the first hyphen is the name of a class as the schema writes it, and ### is a number or other characters a file name allows. CONTRIBUTING.md asks for an invalid example for each constraint.
The examples
Section titled “The examples”tests/data/valid/ holds 9 files: 2 for GhaWorkflow, 1 for GhaReusableWorkflow, 2 for GhaAction, 1 for GhaRepositoryRuleset, 2 for GhaRequiredStatusCheck and 1 for GhaDocument. GhaDocument-service.yaml holds one repository’s workflows, its reusable workflow, an action, its ruleset and the check the ruleset requires, which names the workflow that reports it. tests/data/invalid/ holds 34 counter-examples: 12 for GhaWorkflow, 5 for GhaReusableWorkflow, 5 for GhaAction, 7 for GhaRepositoryRuleset and 5 for GhaRequiredStatusCheck. The two problem/ folders hold no example yet. Every example names an example-org repository or an example.org address.
tests/test_data.py
Section titled “tests/test_data.py”The first test loads each valid file into the generated dataclass of the class its name gives. The other two validate every file with linkml.validator against src/github_actions/schema/github_actions.yaml: a valid example must pass, and a counter-example must fail.2 A comment says that the JSON Schema the validator generates is the one check that applies every constraint.
tests/test_schema_rules.py
Section titled “tests/test_schema_rules.py”Six tests compare the schema with the SchemaStore copy and with the upstream watch, and two check the adapt copy:3
- the schema header’s pins equal those in
scripts/check_upstream_release.py, and the reading date equals the header’sversion; - the permission pattern admits every scope and level SchemaStore lists;
- the runtime enum differs from SchemaStore’s only by the retired
node12andnode16; - the input types are SchemaStore’s;
- the trigger pattern admits every event SchemaStore names;
- the key and
usespatterns are SchemaStore’s; - no class, enum, type or subset name in
.lokf/github-actions.yamlappears in.lokf/lokf.yamlortests/neighbours/slsa.yaml, and a slot or attribute name they share carries the same IRI; - every mapping in
.lokf/github-actions.yamlis a CURIE whose prefix the copy binds, because a full address that no prefix covers makes everylokf convert --schemaover the copy warn that it has no namespace.
tests/neighbours/slsa.yaml is lmodel/slsa’s lokf adapt copy. The test file’s comment says that it is the schema-v0.7.0-slsa.yaml asset of slsa’s v0.7.0 release, checked against its .sha256 and attestation.
tests/test_derive.py
Section titled “tests/test_derive.py”tests/test_derive.py holds the twenty-four tests of scripts/derive.py. They run the script against the fixture repository in tests/derive/repo/: six workflow files and two action files that show each of its rules.4 They also read tests/derive/rulesets.md and tests/derive/check-runs.md, which hold what scripts/github_export.py prints. tests/test_github_export.py runs that script against fixed answers in place of the REST API.5 Derive and check concepts from workflow files describes the script and its tests.
How they run
Section titled “How they run”just test runs three recipes.6 _test-schema generates the project into tmp/. _test-python regenerates the Python models and runs pytest. _test-examples runs linkml-run-examples over tests/data/valid/ and tests/data/invalid/ and writes what it converts into examples/output/, which git ignores. Build and test runs just test on every pull request.
Footnotes
Section titled “Footnotes”-
tests/data/README.md, the whole page ↩
-
tests/test_data.py, the three test functions ↩
-
tests/test_schema_rules.py, the eight test functions and the comment above COPY ↩
-
tests/test_derive.py, the docstring and the fixture path ↩
-
tests/test_github_export.py, the docstring ↩
-
justfile, the
test,_test-schema,_test-pythonand_test-examplesrecipes ↩