Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build PDF in GitHub Actions (but works locally) #17

Closed
ronaldtse opened this issue May 24, 2024 · 6 comments
Closed

Unable to build PDF in GitHub Actions (but works locally) #17

ronaldtse opened this issue May 24, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@ronaldtse
Copy link
Contributor

Not sure why?

https://github.com/metanorma/mn-samples-plateau/actions/runs/9217100051/job/25358519329

[FATAL] "fo:flow" is missing child elements. Required content model: marker* (%block;)+ (See position 7:4975)
Can't obtain table's widths information: javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException: null:7:4975: "fo:flow" is missing child elements. Required content model: marker* (%block;)+ (See position 7:4975)
[INFO] XSL-FO file preparation...
Transforming to PDF...
Rendered page #1.
Rendered page #2.
Rendered page #3.
"fo:flow" is missing child elements. Required content model: marker* (%block;)+ (See position 7:4977)
org.apache.fop.fo.ValidationException: null:7:4977: "fo:flow" is missing child elements. Required content model: marker* (%block;)+ (See position 7:4977)
javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException: null:7:4977: "fo:flow" is missing child elements. Required content model: marker* (%block;)+ (See position 7:4977)
	at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:502)
	at org.metanorma.fop.PDFGenerator.runFOP(PDFGenerator.java:610)
	at org.metanorma.fop.PDFGenerator.convertmn2pdf(PDFGenerator.java:458)
	at org.metanorma.fop.PDFGenerator.process(PDFGenerator.java:295)
	at org.metanorma.fop.mn2pdf.main(mn2pdf.java:338)
Caused by: org.apache.fop.fo.ValidationException: null:7:4977: "fo:flow" is missing child elements. Required content model: marker* (%block;)+ (See position 7:4977)
	at org.apache.fop.events.ValidationExceptionFactory.createException(ValidationExceptionFactory.java:38)
	at org.apache.fop.events.EventExceptionManager.throwException(EventExceptionManager.java:58)
	at org.apache.fop.events.DefaultEventBroadcaster$1.invoke(DefaultEventBroadcaster.java:173)
	at com.sun.proxy.$Proxy8.missingChildElement(Unknown Source)
	at org.apache.fop.fo.FONode.missingChildElementError(FONode.java:608)
	at org.apache.fop.fo.pagination.Flow.endOfNode(Flow.java:93)
	at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:390)
	at org.apache.fop.fo.FOTreeBuilder$3.run(FOTreeBuilder.java:207)
	at org.apache.fop.fo.FOTreeBuilder$3.run(FOTreeBuilder.java:204)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:203)
	at org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1102)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:610)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:184)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2710)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
	at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:485)
	... 4 more
---------
@ronaldtse ronaldtse added the bug Something isn't working label May 24, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in Metanorma May 24, 2024
@Intelligent2013
Copy link
Contributor

@ronaldtse the latest mn2pdf is 1.89, but 1.87 is using in GH:
java -Xss10m -Xmx3g -Djava.awt.headless=true -Duser.home=/github/home -jar /usr/local/bundle/gems/mn2pdf-1.87.1/lib/../bin/mn2pdf.jar

@Intelligent2013
Copy link
Contributor

@CAMOBAP in the https://github.com/metanorma/mn-samples-plateau/blob/main/.github/workflows/docker.yml there is an instruction to install the metanorma-plateau gem:

      - name: Setup Flavor
        uses: actions-mn/setup-flavors@v1
        with:
          extra-flavors: plateau
          github-pakages-token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
          use-bundler: true

But we need to install the latest mn2pdf and isodoc gems also. Is there any way to do this?

I've tried to add this:

      - name: Install latest mn2pdf
        run: bundle add mn2pdf

or

      - name: Install latest mn2pdf
        run: gem install mn2pdf

but again the version 1.87.1 is using in the Metanorma generate site step:
java -Xss10m -Xmx3g -Djava.awt.headless=true -Duser.home=/github/home -jar /usr/local/bundle/gems/mn2pdf-1.87.1/lib/../bin/mn2pdf.jar --xml-file

@ronaldtse
Copy link
Contributor Author

I think instructions for overriding gems in the docker container will be useful in the website

@CAMOBAP
Copy link
Contributor

CAMOBAP commented May 24, 2024

Because we use docker workflow which has 'pre-installed' gems, it will use mn2pdf that was installed during docker build

We have a dedicated action to override gems that are delivered with the docker container:

- uses: metanorma/ci/docker-gem-install@main

Just add required gems into Gemfile in the repo

I think instructions for overriding gems in the docker container will be useful in the website

Good Idea but to be honest I'm not really understand the issue why we need a such workaround to install gems (to me it's important to describe the root of the issue). Let me know if you wanna to dig it and write a post about it

Intelligent2013 added a commit that referenced this issue May 24, 2024
Intelligent2013 added a commit that referenced this issue May 24, 2024
Intelligent2013 added a commit that referenced this issue May 24, 2024
Gemfile updated for fixing issue #17
@Intelligent2013
Copy link
Contributor

@CAMOBAP thanks!

@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in Metanorma May 24, 2024
@Intelligent2013
Copy link
Contributor

docker.yml and Gemfile updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

3 participants