Merge pull request #4859 from tihiyn/4654 #4999
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com | |
| # SPDX-License-Identifier: MIT | |
| --- | |
| # yamllint disable rule:line-length | |
| name: ebnf | |
| 'on': | |
| push: | |
| branches: | |
| - master | |
| concurrency: | |
| group: ebnf-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| ebnf: | |
| timeout-minutes: 15 | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| env: | |
| CONVERT_PATH: /tmp/antlr4-to-bnf-converter | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - run: | | |
| sudo apt-get update --yes --fix-missing | |
| sudo apt-get install --yes ghostscript imagemagick texlive-extra-utils pdf2svg inkscape | |
| - uses: zauguin/[email protected] | |
| with: | |
| packages: scheme-basic geometry xcolor naive-ebnf microtype etoolbox | |
| texlive_version: 2025 | |
| - uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 20 | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-jdk-20-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-jdk-20-maven- | |
| - run: | | |
| mkdir -p "$CONVERT_PATH" | |
| wget --quiet http://public.yegor256.com/convert.zip -O /tmp/convert.zip | |
| unzip -o -d "$CONVERT_PATH" /tmp/convert.zip | |
| - run: sudo sed -i '/disable ghostscript format types/,+6d' /etc/ImageMagick-6/policy.xml | |
| - run: | | |
| mvn com.yegor256:antlr2ebnf-maven-plugin:0.0.7:generate \ | |
| -pl :eo-parser --errors --batch-mode --quiet \ | |
| "-Dantlr2ebnf.convertDir=$CONVERT_PATH" \ | |
| "-Dantlr2ebnf.specials=eof,eol,eop,tab,untab" \ | |
| "-Dantlr2ebnf.margin=40" | |
| - run: | | |
| git fetch --no-tags origin gh-pages | |
| git checkout gh-pages | |
| mkdir -p ebnf | |
| convert --version | |
| convert --help | grep Delegates | |
| pdfcrop --version | |
| set -x | |
| p="Eo" | |
| cp "eo-parser/target/ebnf/org/eolang/parser/${p}.pdf" . | |
| pdfcrop --margins '10 10 10 10' "${p}.pdf" "${p}-cropped.pdf" | |
| pdf2svg "${p}-cropped.pdf" "${p}.svg" | |
| convert -verbose -density 300 -quality 100 -colorspace RGB "${p}.svg" "${p}.png" | |
| cp "${p}.png" ebnf/ | |
| cp "${p}.svg" ebnf/ | |
| - if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| sign-commits: true | |
| branch: ebnf-gh-pages | |
| commit-message: 'update gh-pages with new EBNF' | |
| delete-branch: true | |
| title: 'Update gh-pages with new EBNF' | |
| assignees: yegor256 | |
| base: gh-pages |