Skip to content

Commit 76037ee

Browse files
mpywclaude
andcommitted
ci: Add GitHub Actions workflow for CI
- Add CI workflow that runs on push/PR to main branch - Add JSON Schema validation for structure.json - Add metatest validation as separate job - Create structure.schema.json with JSON Schema 2020-12 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f7c46e9 commit 76037ee

File tree

2 files changed

+138
-0
lines changed

2 files changed

+138
-0
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version-file: go.mod
19+
20+
- name: Run tests
21+
run: go test -v ./...
22+
23+
validate-schema:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Set up Go
29+
uses: actions/setup-go@v5
30+
with:
31+
go-version-file: go.mod
32+
33+
- name: Validate structure.json schema
34+
working-directory: testdata/metatest
35+
run: go run github.com/santhosh-tekuri/jsonschema/cmd/jv@29cbed9 structure.schema.json structure.json
36+
37+
metatest:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- name: Set up Go
43+
uses: actions/setup-go@v5
44+
with:
45+
go-version-file: go.mod
46+
47+
- name: Run metatest validation
48+
working-directory: testdata/metatest
49+
run: go test -v ./...
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "structure.schema.json",
4+
"title": "Test Structure",
5+
"description": "Schema for ctxrelay test metadata structure",
6+
"type": "object",
7+
"required": ["targets", "tests"],
8+
"additionalProperties": false,
9+
"properties": {
10+
"targets": {
11+
"type": "array",
12+
"description": "List of available checker targets",
13+
"items": {
14+
"type": "string",
15+
"minLength": 1
16+
},
17+
"minItems": 1,
18+
"uniqueItems": true
19+
},
20+
"tests": {
21+
"type": "object",
22+
"description": "Map of test name to test definition",
23+
"additionalProperties": {
24+
"$ref": "#/$defs/test"
25+
},
26+
"minProperties": 1
27+
}
28+
},
29+
"$defs": {
30+
"test": {
31+
"type": "object",
32+
"required": ["title", "targets", "level", "variants"],
33+
"additionalProperties": false,
34+
"properties": {
35+
"title": {
36+
"type": "string",
37+
"description": "Human-readable test title (heading-like)",
38+
"minLength": 1
39+
},
40+
"targets": {
41+
"type": "array",
42+
"description": "List of checker targets this test applies to",
43+
"items": {
44+
"type": "string",
45+
"minLength": 1
46+
},
47+
"minItems": 1
48+
},
49+
"level": {
50+
"type": "string",
51+
"description": "Complexity level of the test",
52+
"enum": ["basic", "advanced", "evil", "carrier", "creator", "goroutinederive"]
53+
},
54+
"variants": {
55+
"type": "object",
56+
"description": "Map of variant name to variant definition (null means variant not applicable)",
57+
"additionalProperties": {
58+
"oneOf": [
59+
{ "$ref": "#/$defs/variant" },
60+
{ "type": "null" }
61+
]
62+
},
63+
"minProperties": 1
64+
}
65+
}
66+
},
67+
"variant": {
68+
"type": "object",
69+
"required": ["description", "functions"],
70+
"additionalProperties": false,
71+
"properties": {
72+
"description": {
73+
"type": "string",
74+
"description": "Explanatory description of this variant",
75+
"minLength": 1
76+
},
77+
"functions": {
78+
"type": "object",
79+
"description": "Map of target to function name",
80+
"additionalProperties": {
81+
"type": "string",
82+
"minLength": 1
83+
},
84+
"minProperties": 1
85+
}
86+
}
87+
}
88+
}
89+
}

0 commit comments

Comments
 (0)