Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d3a59da

Browse files
echeraneemeli
andauthored
Validate test cases against a schema (#778)
* Validate test cases against provided schema * Use command line JSON Schema validator from NPM * Insert omitted step to install JSON Schema validator tool * Apply suggestions from code review Co-authored-by: Eemeli Aro <[email protected]> * Add constraint for runs on PRs based on modified paths --------- Co-authored-by: Eemeli Aro <[email protected]>
1 parent d38ff32 commit d3a59da

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/validate_tests.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Validate test data
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- test/**
9+
pull_request:
10+
branches: '**'
11+
paths:
12+
- test/**
13+
14+
jobs:
15+
run_all:
16+
name: Validate tests using schema
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repo
20+
uses: actions/checkout@v4
21+
- name: Install CLI tool for JSON Schema validation
22+
run: npm install --global ajv-cli
23+
- name: Validate tests using the latest schema version
24+
run: >
25+
ajv validate --spec=draft2020
26+
-s $(ls -1v schemas/*/*schema.json | tail -1)
27+
-d 'tests/**/*.json'
28+
working-directory: ./test

0 commit comments

Comments
 (0)