-
Notifications
You must be signed in to change notification settings - Fork 142
84 lines (84 loc) · 3.28 KB
/
ebnf.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# The MIT License (MIT)
#
# Copyright (c) 2016-2024 Objectionary.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
---
name: ebnf
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
ebnf:
runs-on: ubuntu-24.04
env:
CONVERT_PATH: /tmp/antlr4-to-bnf-converter
steps:
- uses: actions/checkout@v4
- run: |
sudo apt-get update
sudo apt-get -y install ghostscript imagemagick texlive-extra-utils pdf2svg inkscape
- uses: teatimeguest/setup-texlive-action@v3.3.4
with:
update-all-packages: true
packages: scheme-basic geometry xcolor naive-ebnf microtype etoolbox
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 20
- uses: actions/cache@v4
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: |
convert --version
convert --help | grep Delegates
pdfcrop --version
set -x
for p in Eo Phi; do
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"
mkdir -p gh-pages/ebnf
cp "${p}.png" gh-pages/ebnf
cp "${p}.svg" gh-pages/ebnf
done
- uses: JamesIves/github-pages-deploy-action@v4.7.2
with:
branch: gh-pages
folder: gh-pages
clean: false
if: github.ref == 'refs/heads/master'