Skip to content

Commit 71e66d3

Browse files
update readme (#3)
1 parent bbbb0bd commit 71e66d3

File tree

3 files changed

+132
-0
lines changed

3 files changed

+132
-0
lines changed

.github/workflows/main.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Generate Interop Report
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
schedule:
7+
# update the integration suite once per week at Sunday 5am UTC
8+
- cron: '0 5 * * 0'
9+
10+
jobs:
11+
lint:
12+
if: ${{ github.event_name == 'push' }}
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
node-version: [20.x]
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
- run: npm install
24+
- name: Run eslint
25+
run: npm run lint
26+
test-node:
27+
if: ${{ github.event_name == 'schedule' ||
28+
github.event_name == 'workflow_dispatch' }}
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 15
31+
strategy:
32+
matrix:
33+
node-version: [20.x]
34+
steps:
35+
- uses: actions/checkout@v3
36+
with:
37+
persist-credentials: false
38+
- name: Use Node.js ${{ matrix.node-version }}
39+
uses: actions/setup-node@v3
40+
with:
41+
node-version: ${{ matrix.node-version }}
42+
- name: Install npm dependencies
43+
run: npm install
44+
- name: Run test with Node.js ${{ matrix.node-version }}
45+
run: npm run test
46+
continue-on-error: true
47+
- name: Deploy to Github Pages
48+
uses: JamesIves/[email protected]
49+
with:
50+
branch: gh-pages
51+
folder: reports
52+
token: ${{ secrets.GITHUB_TOKEN }}
53+
- name: Report Github Pages Deployment Status
54+
run: echo $deployment_status

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# IDE
22
.idea
33

4+
# MacOS
5+
*.DS_Store
6+
47
# Reports
58
reports/*.html
69

README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,78 @@
11
# VC JSON Schema Test Suite
22

33
Test suite for the [VC JSON Schema](https://github.com/w3c/vc-json-schema/) specification in the W3C.
4+
5+
The suite makes use Digital Bazaar's [mocha-w3c-interop-reporter](https://github.com/digitalbazaar/mocha-w3c-interop-reporter).
6+
7+
## Building & Testing
8+
9+
To build and test the suite, run the following commands:
10+
11+
```bash
12+
npm install
13+
npm test
14+
```
15+
16+
You can remove all generated test cases by running:
17+
18+
```bash
19+
npm clean
20+
```
21+
22+
A report will be generated to the [reports](reports) directory after a successful run.
23+
24+
## Implementations
25+
26+
Implementations are tested on two dimensions: support for defined types (`JsonSchema` and `JsonSchemaCredential`), and
27+
support for specified JSON Schema versions (`Draft-7`, `2019-09`, and `2020-12`).
28+
29+
### How Implementations Work
30+
Implementations are run using [docker compose](https://docs.docker.com/compose/). Each container is called once
31+
per test case. The container is expected take the following inputs:
32+
33+
* `format` - either `JsonSchema` or `JsonSchemaCredential`
34+
* `schema` - a path to the input schema file
35+
* `credential` - a path to the input credential file
36+
* `output` - a path to where the container will write an output
37+
38+
An example command for a container that takes the above inputs would be:
39+
40+
```bash
41+
docker-compose -f ./implementations/docker-compose.yml \
42+
run -d tbd validate \
43+
--format JsonSchemaCredential \
44+
--schema /tests/input/jsonschemacredential/Draft-7/11-schema.json \
45+
--credential /tests/input/jsonschemacredential/Draft-7/1-credential.json \
46+
--output /tests/output/jsonschemacredential/Draft-7/18-tbd.json
47+
```
48+
49+
### Adding an Implementation
50+
51+
To add an implementation to the test suite, add a new entry to the `implementations` array in `implementations.json`.
52+
The entry should have the following properties: `name` and `specs`, where `specs` is an object with the supported
53+
[JSON Schema versions](https://json-schema.org/) as keys and an array of supported
54+
[VC JSON Schema Types](https://w3c.github.io/vc-json-schema/#data-model) as values.
55+
56+
```json
57+
{
58+
"name": "sample",
59+
"specs": {
60+
"2020-12": [
61+
"JsonSchema",
62+
"JsonSchemaCredential"
63+
],
64+
"2019-09": [
65+
"JsonSchema",
66+
"JsonSchemaCredential"
67+
],
68+
"Draft-7": [
69+
"JsonSchema",
70+
"JsonSchemaCredential"
71+
]
72+
}
73+
}
74+
```
75+
76+
Next, you'll need to add a new entry for the implementation in the [`docker-compose.yml`](implementations/docker-compose.yml)
77+
file. You may optionally add a directory to the [`implementations`](implementations) directory with the same name as the
78+
implementation which houses the implementation's code.

0 commit comments

Comments
 (0)