c34340aaaf
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
91 lines
3 KiB
YAML
91 lines
3 KiB
YAML
name: Format validation
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '*'
|
|
- '!rc/*'
|
|
paths:
|
|
- 'test/writer.jats_articleauthoring'
|
|
- 'test/writer.jats_publishing'
|
|
- 'test/writer.jats_archiving'
|
|
- 'test/tables.jats_archiving'
|
|
- 'test/tables/nordics.jats_archiving'
|
|
- 'test/tables/planets.jats_archiving'
|
|
- 'test/tables/students.jats_archiving'
|
|
pull_request:
|
|
branches:
|
|
- '*'
|
|
- '!rc/*'
|
|
paths:
|
|
- 'test/writer.jats_articleauthoring'
|
|
- 'test/writer.jats_publishing'
|
|
- 'test/writer.jats_archiving'
|
|
- 'test/tables.jats_archiving'
|
|
- 'test/tables/nordics.jats_archiving'
|
|
- 'test/tables/planets.jats_archiving'
|
|
- 'test/tables/students.jats_archiving'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
jats:
|
|
name: JATS
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
VALIDATOR_URL: "https://jats-validator.hubmed.org/dtd/"
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
tagset:
|
|
- articleauthoring
|
|
- publishing
|
|
- archiving
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Validate writer output
|
|
run: |
|
|
filename=test/writer.jats_${{ matrix.tagset }}
|
|
printf "Validating file %s\n" "$filename"
|
|
json="$(curl --form "xml=@${filename}" --silent "$VALIDATOR_URL")"
|
|
err_count="$(printf '%s' "$json" | jq '.errors | length')"
|
|
if [ "$err_count" -eq 0 ]; then
|
|
printf "File was validated successfully.\n"
|
|
exit 0
|
|
else
|
|
printf "Validator report:\n%s" "$json"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Validate tables
|
|
# Archiving has the simplest template, so we only check with that.
|
|
if: matrix.tagset == 'archiving'
|
|
run: |
|
|
tmpl="$(cat <<EOF
|
|
<?xml version="1.0" encoding="utf-8" ?>
|
|
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN"
|
|
"JATS-archivearticle1.dtd">
|
|
<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other">
|
|
<front><article-meta></article-meta></front>
|
|
<body>%s</body></article>
|
|
EOF
|
|
)"
|
|
jats_file="$(mktemp jats-tables.XXXXX)"
|
|
exit_code=0
|
|
for f in tables tables/nordics tables/planets tables/students; do
|
|
filename=test/$f.jats_archiving
|
|
printf "Validating %s...\n" "$filename"
|
|
printf "$tmpl" "$(cat $filename)" > "$jats_file"
|
|
json="$(curl --form "xml=@${jats_file}" --silent "$VALIDATOR_URL")"
|
|
err_count="$(printf "%s" "$json" | jq '.errors | length')"
|
|
if [ "$err_count" -eq 0 ]; then
|
|
printf "Table output is valid when used as body content.\n"
|
|
else
|
|
printf "Validator report:\n%s" "$json"
|
|
exit_code=1
|
|
fi
|
|
done
|
|
exit "$exit_code"
|