CI: validate JATS old-style writer test output
commit07e434850d4a1d84179a5e75791e60ca254a4f98
authorAlbert Krewinkel <albert@zeitkraut.de>
dateFri 30 Oct 2020, 21:01 (6 years ago)
parentf1f2728
.github/workflows/format-validation.ymlnew file+47
@@ -0,0 +1,47 @@
1+name: Format validation
2+
3+on:
4+ push:
5+ paths-ignore:
6+ - '*'
7+ - '!/test/writer.*'
8+ - '!/test/tables.*'
9+ pull_request:
10+ paths-ignore:
11+ - '*'
12+ - '!/test/writer.*'
13+ - '!/test/tables.*'
14+
15+jobs:
16+ jats:
17+ name: JATS
18+ runs-on: ubuntu-latest
19+ env:
20+ VALIDATOR_URL: "https://jats-validator.hubmed.org/dtd/"
21+ strategy:
22+ fail-fast: false
23+ matrix:
24+ tagset:
25+ - articleauthoring
26+ - publishing
27+ - archiving
28+ file:
29+ - writer
30+ # tables are not supported yet, the files contain only snippets.
31+ steps:
32+ - name: Checkout
33+ uses: actions/checkout@v2
34+
35+ - name: Validate
36+ run: |
37+ filename=test/${{ matrix.file }}.jats_${{ matrix.tagset }}
38+ echo "$filename"
39+ json="$(curl --form "xml=@${filename}" --silent "$VALIDATOR_URL")"
40+ echo "$json"
41+ err_count="$(echo "$json" | jq '.errors | length')"
42+ if [ "$err_count" -eq 0 ]; then
43+ exit 0
44+ else
45+ printf "Validator report:\n%s" "$json"
46+ exit 1
47+ fi