dita-ot / dita-ot-action

GitHub Action for building PDFs and static websites using DITA Open Toolkit
https://www.dita-ot.org
Apache License 2.0
8 stars 4 forks source link

The dita-ot-action should fail the GitHub action build, if the DITA-OT fails #8

Closed stefan-jung closed 1 year ago

stefan-jung commented 1 year ago

Expected Behavior

In my particular case, the gen-list stage fails on my local Oxygen XML (which is expected), because the structure is to valid according to the grammar. It looks like this:

gen-list:
[gen-list] Using Xerces grammar pool for DTD and schema caching.
[gen-list] Processing file:/C:/Users/eike/workspace/com.dometic.dita-ot-pdf/test-files/constraint-conflict/ConstraintConflict.ditamap
Error: Failed to run pipeline: [DOTJ012F][FATAL] Failed to parse the input file 'file:/C:/Users/eike/workspace/com.dometic.dita-ot-pdf/test-files/constraint-conflict/ConstraintConflict.ditamap'.: file:/C:/Users/eike/workspace/com.dometic.dita-ot-pdf/test-files/constraint-conflict/ConstraintConflict.ditamap Line 8:element "critdates" not allowed here; expected element "author", "authorinformation", "change-historylist", "linktext", "metadata", "prodinfo", "searchtitle", "shortdesc" or "source"

BUILD FAILED
C:\Program Files\Oxygen XML Editor 25\frameworks\dita\dita_project\build_dita_project.xml:18: exec returned: 1

I expect GitHub Action to also fail.

Actual Behavior

It does not fail.

Possible Solution

No idea.

Steps to Reproduce

Add an invalid XML element to a DITA Map or Topic and publish this with the dita-ot-action.

GitHub Action YAML

      # Install all plugins and build the test files
      - name: 🚀 Build PDF using DITA-OT 3.7.4
        uses: dita-ot/dita-ot-action@master
        with:
          dita-ot-version: 3.7.4

          install : |
            dita install com.dometic.dita-doctypes.zip --force
            dita install com.dometic.dita-technical-data.zip --force
            dita install https://github.com/dita-community/org.dita-community.split-page-sequences/archive/refs/heads/develop.zip --force
            dita install com.dometic.dita-ot-pdf.zip --force
          build: |
            dita --project=test-files/test-files.xml --processing-mode=strict --verbose

Environment

jelovirt commented 1 year ago

@stefan-jung I suggest you add the relevan GitHub Action fragment from https://github.com/orgs/dita-ot/discussions/4286. I think it makes a difference that you're using build.

jason-fox commented 1 year ago

@stefan-jung - I can't reproduce your behaviour - can you supply a full failing test case?When I run an action with:

build: |
            dita --project=.github/dita-ot/html.xml --processing-mode=strict --verbose

The action fails for me with:

gen-list:
 [gen-list] Using Xerces grammar pool for DTD and schema caching.
 [gen-list] Processing file:/github/workspace/flowers/flowers.ditamap
 [gen-list] Processing file:/github/workspace/flowers/concepts/autumnFlowers.dita
Error: ror: Failed to run pipeline: [DOTJ013E][ERROR] Failed to parse the referenced file 'file:/github/workspace/flowers/concepts/autumnFlowers.dita'.: file:/github/workspace/flowers/concepts/autumnFlowers.dita Line 3:Document root element "conceptx", must match DOCTYPE root "concept".

see: https://github.com/jason-fox/test-dita-build/actions/runs/6341148875/job/17224131988

stefan-jung commented 1 year ago

@jason-fox, the code is proprietary, so I don't want to upload it to GitHub. What I could do is, that I send you the build script together with a recorded video in which I reproduce the issue by e-mail, if you would accept that.

jason-fox commented 1 year ago

I took the flowers dita, and amended a single <concept> to <conceptx> which resolved to a [DOTJ013E][ERROR] and a failed action due to a DITA-OT grammar error. It would be helpful if you could fork https://github.com/jason-fox/test-dita-build/ and create a minimal test case since the action is correctly erroring as far as I can see.

stefan-jung commented 1 year ago

@jason-fox, I forked your test-dita-build project, and it fails as expected. It seems to me that the devil is a completely different detail, and I don't really understand the situation. And probably this is not related to dita-ot-action. I'll leave some explanations here, if others should stumble over this issue as well.

I'm building locally with a DITA-OT, which is based on the Oxygen XML Publishing Engine, because we also build Oxygen webhelps locally. On GitHub Actions, I fiddle the DITA-OT together during the build, install all the plugins, and so forth, as it is common practice. We currently do not need the Oxygen publishing engine on GitHub action, because I only want to build PDFs.

SyncroSoft has patched the DITA-OT heavily, which is nice, and it seems to me, that SyncroSoft also altered original DITA-OT files. For example, when you download a fresh Oxygen XML ZIP archive from oxygenxml.com/InstData/Editor/Windows/VM/oxygen.zip, expand it and look at the file oxygen\frameworks\dita\DITA-OT3.x\plugins\org.dita.pdf2\build_template.xml, you will see that the Oxygen XML Publishing engine, which is build on the DITA-OT 3.7.4, still uses preprocess.

<target name="dita2pdf2" depends="dita2pdf2.init, build-init, preprocess, map2pdf2, topic2pdf2"/>

But if you download a fresh DITA-OT 3.7.4 distribution package from github.com/dita-ot/dita-ot/releases/download/3.7.4/dita-ot-3.7.4.zip, you will see that the file dita-ot-3.7.4\plugins\org.dita.pdf2\build_template.xml is using preprocess2

<target name="dita2pdf2" depends="dita2pdf2.init, build-init, preprocess2, map2pdf2, topic2pdf2"/>

This was not clear to me yet.

So, my local build (Oxygen XML Publishing engine) fails here in the gen-list target:

preprocess.init:
[echo] *****************************************************************
[echo] * input = file:/C:/Users/eike/workspace/com.dometic.dita-ot-pdf/test-files/constraint-conflict/ConstraintConflict.ditamap
[echo] * resources = ${args.resources}
[echo] *****************************************************************

ditaval-merge:

gen-list:
[gen-list] Using Xerces grammar pool for DTD and schema caching.
[gen-list] Processing file:/C:/Users/eike/workspace/com.dometic.dita-ot-pdf/test-files/constraint-conflict/ConstraintConflict.ditamap
Error: Failed to run pipeline: [DOTJ012F][FATAL] Failed to parse the input file 'file:/C:/Users/eike/workspace/com.dometic.dita-ot-pdf/test-files/constraint-conflict/ConstraintConflict.ditamap'.: file:/C:/Users/eike/workspace/com.dometic.dita-ot-pdf/test-files/constraint-conflict/ConstraintConflict.ditamap Line 8:element "critdates" not allowed here; expected element "author", "authorinformation", "change-historylist", "linktext", "metadata", "prodinfo", "searchtitle", "shortdesc" or "source"

BUILD FAILED
C:\Program Files\Oxygen XML Editor 25\frameworks\dita\dita_project\build_dita_project.xml:18: exec returned: 1

But GitHub Action with a "normal" DITA-OT, does not call this target after ditaval-merge.

2023-09-29T09:56:38.3851449Z preprocess2.init:
2023-09-29T09:56:38.3851705Z      [echo] *****************************************************************
2023-09-29T09:56:38.3852196Z      [echo] * input = file:/github/workspace/test-files/constraint-conflict/ConstraintConflict.ditamap
2023-09-29T09:56:38.3852589Z      [echo] * resources = ${args.resources}
2023-09-29T09:56:38.3852881Z      [echo] *****************************************************************
2023-09-29T09:56:38.3853050Z 
2023-09-29T09:56:38.3853171Z ditaval-merge:
2023-09-29T09:56:38.3853312Z 
2023-09-29T09:56:38.3853421Z map-reader:
2023-09-29T09:56:38.3853789Z [map-reader] Using Xerces grammar pool for DTD and schema caching.
2023-09-29T09:56:38.3854568Z [map-reader] Processing file:/github/workspace/test-files/constraint-conflict/ConstraintConflict.ditamap to file:/opt/app/temp/temp20230929055638368/5d64977634c01eea5c3da6f6bd828089b76cac39.ditamap
2023-09-29T09:56:38.5588449Z [map-reader] Processing file:/github/workspace/test-files/constraint-conflict/topics/en-US/CTR_ConstraintConflict.ditamap to file:/opt/app/temp/temp20230929055638368/90019db9fbe6689e6d197637b9031ed001bac486.ditamap
2023-09-29T09:56:38.6252479Z [map-reader] Serializing job specification
2023-09-29T09:56:38.6276753Z 
2023-09-29T09:56:38.6277160Z map-mapref:
2023-09-29T09:56:38.6733078Z    [mapref] Processing file:/opt/app/temp/temp20230929055638368/5d64977634c01eea5c3da6f6bd828089b76cac39.ditamap

To explain what I am trying to achieve in general: I want to publish a few DITA test scenarios to test my PDF plugin. But it now seems to me, that I have to work top-down (take an Oxygen XML Publishing engine on GitHub Action and kick-out everything, what I am not allowed to use on the server) instead of building bottom-up from a naked DITA-OT, because I don't know what else SyncroSoft has modified in the original code. I would simply get different results on GitHub actions, which do not help me to identify bugs in my plugin code.

stefan-jung commented 1 year ago

@jelovirt and @jason-fox, I'll close this now, because the dita-ot-action seems to work as normal. The "problem" seems to me, that preprocess2 does not fail where it should (IMHO). But I'm currently at the stage of "guessing", not "knowing".

jason-fox commented 1 year ago

@stefan-jung - I think I know the reason behind your preprocess/ preprocess2 behaviour - my original test case was using DITA-OT 4.1.1, not DITA-OT 3.7.4 - Unfortunately for you, when I do fix the engine version to 3.7.4. the Action runs preprocess and fails as expected and the GitHub Action fails - so the functionality from "raw" DITA-OT preprocess and the DITA-OT GitHub Action is running as expected even on 3.7.4

New log: https://github.com/jason-fox/test-dita-build/actions/runs/6368888092/job/17288625156