Skip to content

Merge pull request #293 from robander/draftcomment #1

Merge pull request #293 from robander/draftcomment

Merge pull request #293 from robander/draftcomment #1

Workflow file for this run

name: Test
on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-latest
env:
DITA_OT_VERSION: '4.4'
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'gradle'
- name: Compare DTD and Relax NG grammar reports
run: |
set -e
mkdir -p build/grammar-compare/classes build/grammar-compare/reports
javac -d build/grammar-compare/classes \
specification/baseSpec/.github/resources/DtdToJson.java \
specification/baseSpec/.github/resources/RngToJson.java
compare_grammar_pair() {
name="$1"
dtd_path="$2"
rng_path="$3"
dtd_json="build/grammar-compare/reports/${name}-dtd.json"
rng_json="build/grammar-compare/reports/${name}-rng.json"
java -cp build/grammar-compare/classes DtdToJson \
--catalog doctypes/catalog.xml \
--catalog specification/baseSpec/doctypes/catalog.xml \
-o "$dtd_json" \
"$dtd_path"
java -cp build/grammar-compare/classes RngToJson \
--catalog doctypes/catalog.xml \
--catalog specification/baseSpec/doctypes/catalog.xml \
-o "$rng_json" \
"$rng_path"
python3 specification/baseSpec/.github/resources/compare_json_reports.py \
"$dtd_json" \
"$rng_json" \
--quiet
}
compare_grammar_pair bookmap \
doctypes/dtd/bookmap/bookmap.dtd \
doctypes/rng/bookmap/bookmap.rng
for name in concept ditabase generalTask glossentry glossgroup map reference task topic troubleshooting; do
compare_grammar_pair "$name" \
"doctypes/dtd/technicalContent/${name}.dtd" \
"doctypes/rng/technicalContent/${name}.rng"
done
- name: Cache DITA-OT
uses: actions/cache@v4
with:
path: |
dita-ot-${{ env.DITA_OT_VERSION }}.zip
key: ${{ runner.os }}-${{ env.DITA_OT_VERSION }}
- name: Set up DITA-OT
run: |
set -e
if [ -f "dita-ot-$DITA_OT_VERSION.zip" ]; then
echo "Use cached $PWD/dita-ot-$DITA_OT_VERSION.zip"
else
curl -sfL https://github.com/dita-ot/dita-ot/releases/download/$DITA_OT_VERSION/dita-ot-$DITA_OT_VERSION.zip -o dita-ot-$DITA_OT_VERSION.zip
fi
unzip -q dita-ot-$DITA_OT_VERSION.zip
echo "DITA_HOME=$PWD/dita-ot-$DITA_OT_VERSION" >> $GITHUB_ENV
- name: Install plug-ins
run: |
set -e
# Copy latest base doctype updates over the beta version in DITA-OT;
# replace whatever (possibly older) version is currently shipped.
rm -rv $DITA_HOME/plugins/org.oasis-open.dita.v2_0/dtd/
rm -rv $DITA_HOME/plugins/org.oasis-open.dita.v2_0/rng/
cp -av ./specification/baseSpec/doctypes/. $DITA_HOME/plugins/org.oasis-open.dita.v2_0/
# Copy the latest tech comm grammars as well
rm -rv $DITA_HOME/plugins/org.oasis-open.dita.techcomm.v2_0/dtd/
rm -rv $DITA_HOME/plugins/org.oasis-open.dita.techcomm.v2_0/rng/
cp -av .//doctypes/. $DITA_HOME/plugins/org.oasis-open.dita.techcomm.v2_0/
# Install extract codeblock
cp -av .github/resources/extract-codeblock/ $DITA_HOME/plugins/extract-codeblock/
# Install the updated grammar plugins
$DITA_HOME/bin/dita install
# Install RNG support
#curl -sfL https://github.com/oxygenxml/dita-relaxng-defaults/archive/master.zip -o dita-ng.zip
#$DITA_HOME/bin/dita -install dita-ng.zip -v
#rm dita-ng.zip
- name: Extract codeblock content
run: |
$DITA_HOME/bin/dita \
-i $PWD/specification/dita-2.0-technical-content-specification.ditamap \
--filter $PWD/specification/baseSpec/resources/DITA2.0-spec.ditaval \
-f extract-codeblock
- name: Validate codeblock content
working-directory: .github
run: |
./gradlew test \
-Prepository=$GITHUB_REPOSITORY \
-Psha=$GITHUB_SHA \
-Pcatalogs=$DITA_HOME/catalog-dita.xml \
-Pout=$PWD/../out \
-Proot=$GITHUB_WORKSPACE \
--info
- name: Install test files
run: |
set -e
curl --etag-compare testfiles.zip.etag --etag-save testfiles.zip.etag -sfL https://github.com/robander/metadita-sampledocs/archive/master.zip -o testfiles.zip
unzip testfiles.zip
- name: Test DITA 1.3 basemap
run: |
set -e
# Build 1.3 doctype to ensure builds working properly
#$DITA_HOME/bin/dita -i $PWD/metadita-sampledocs-master/doctypes/dita1.3/dtd/base/basemap.ditamap -f html5
- name: Test all-v2-grammars.ditamap
run: |
set -e
# Build beta 2.0 doctype
#$DITA_HOME/bin/dita -i $PWD/metadita-sampledocs-master/doctypes/dita20/dtd/base/basetopic.dita -f html5
#$DITA_HOME/bin/dita -i $PWD/metadita-sampledocs-master/doctypes/dita20/dtd/base/basemap.ditamap -f html5
$DITA_HOME/bin/dita \
-i $PWD/metadita-sampledocs-master/doctypes/all-v2-grammars.ditamap \
-f html5 \
--processing-mode=strict \
-v
- name: Test dita-2.0-technical-content-specification.ditamap
run: |
set -e
$DITA_HOME/bin/dita \
-i $PWD/specification/dita-2.0-technical-content-specification.ditamap \
-f html5 \
--processing-mode=strict \
-v