-
Notifications
You must be signed in to change notification settings - Fork 1
173 lines (169 loc) · 6.2 KB
/
main.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Automated Build
on:
push:
branches:
- master
paths:
- data/**
- configs/**
- layouts/**
- .github/workflows/**
workflow_dispatch:
env:
THERION_VERSION: 6.2.1
THERION_PATH: ./therion-6.2.1
EXPECTED_OUTPUTS: >-
brezno_pod_vrhom_planje.3d
brezno_pod_vrhom_planje_plan_EN.pdf
brezno_pod_vrhom_planje_ee_EN.pdf
brezno_pod_vrhom_planje_plan_EN.svg
brezno_pod_vrhom_planje_ee_EN.svg
nakljucja.3d
nakljucja_plan_EN.pdf
nakljucja_ee_EN.pdf
nakljucja_plan_SLO.pdf
nakljucja_ee_SLO.pdf
nakljucja_plan_EN.svg
nakljucja_ee_EN.svg
nakljucja_plan_SLO.svg
nakljucja_ee_SLO.svg
m2_m16_m18.3d
m2_m16_m18_plan_SLO.pdf
m2_m16_m18_plan_SLO.svg
m2_m16_m18_plan_ENG.pdf
m2_m16_m18_plan_ENG.svg
m2_m16_m18_EE_SLO.pdf
m2_m16_m18_EE_SLO.svg
m2_m16_m18_EE_ENG.pdf
m2_m16_m18_EE_ENG.svg
plateau.3d
plateau.kml
primadona_ubend_mona_tip_plan_SLO.pdf
primadona_ubend_mona_tip_plan_SLO.svg
primadona_ubend_mona_tip_plan_ENG.pdf
primadona_ubend_mona_tip_plan_ENG.svg
primadona_ubend_mona_tip_EE_ENG.pdf
primadona_ubend_mona_tip_EE_ENG.svg
primadona_ubend_mona_tip_EE_SLO.pdf
primadona_ubend_mona_tip_EE_SLO.svg
primadona_ubend_mona_tip.3d
symbology.pdf
symbology.svg
system_migovec.3d
system_migovec_plan_SLO.pdf
system_migovec_plan_SLO.svg
system_migovec_plan_ENG.pdf
system_migovec_plan_ENG.svg
system_migovec_EE_SLO.pdf
system_migovec_EE_SLO.svg
system_migovec_EE_ENG.pdf
system_migovec_EE_ENG.svg
vrtnarija.3d
vrtnarija_EE_SLO.pdf
vrtnarija_EE_SLO.svg
vrtnarija_EE_ENG.pdf
vrtnarija_EE_ENG.svg
vrtnarija_plan_SLO.pdf
vrtnarija_plan_SLO.svg
vrtnarija_plan_ENG.pdf
vrtnarija_plan_ENG.svg
# Cause seg faults:
# m2_m16_m18.lox
# primadona_ubend_mona_tip.lox
# vrtnarija.lox
# system_migovec.lox
# plateau.lox
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Cache Therion
id: cache-therion
uses: actions/cache@v1
with:
path: ${{ env.THERION_PATH }}/bin
key: ${{ runner.os }}-${{ env.THERION_VERSION }}
#========================= INSTALL DEPENDENCIES ========================#
- name: Run apt update
run: sudo apt update
- name: Install Therion compilation dependencies
if: steps.cache-therion.outputs.cache-hit != 'true'
run: sudo apt install -y bwidget lcdf-typetools libtk-img-dev libvtk7-dev libwxgtk3.0-gtk3-dev tcl-dev survex texlive-latex-base libfmt-dev # Pre-installed: gcc ghostscript imagemagick libfreetype6-dev libjpeg-dev libpng-dev zlib1g zlib1g-dev
- name: Install Therion runtime dependencies
run: sudo apt install -y libproj-dev lcdf-typetools texlive-metapost survex libfmt-dev
- name: Download and unpack Therion
if: steps.cache-therion.outputs.cache-hit != 'true'
run: |
curl https://github.com/therion/therion/archive/v${THERION_VERSION}.tar.gz -L -O
tar xvzf v${THERION_VERSION}.tar.gz
- name: Build Therion
if: steps.cache-therion.outputs.cache-hit != 'true'
run: |
make -C $THERION_PATH
mkdir ${THERION_PATH}/bin
mv ${THERION_PATH}/therion ${THERION_PATH}/bin/therion
- name: Install svgo
run: sudo npm install -g svgo
#=========================== GENERATE OUTPUT ===========================#
- name: Generate output files
run: for file in configs/automation/*.thconfig; do echo "Generating $file" && ${THERION_PATH}/bin/therion -q $file || echo "Generating $file failed"; done
- name: Check outputs exist
run: |
for file in $EXPECTED_OUTPUTS; do
if test ! -f outputs/$file; then
GONE="$GONE $file"
fi
done
if test -n "$GONE"; then
echo "These outputs are missing: $GONE"
exit 1
fi
- name: Create GPX from KML
run: python3 ./scripts/kml_to_gpx.py --fname_in ./outputs/plateau.kml --fname_out ./outputs/plateau.gpx
#=========================== PROCESS OUTPUT ===========================#
- name: Compress PDFs
run: |
for file in ./outputs/*.pdf; do
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=temp.pdf $file;
mv temp.pdf $file;
done
- name: Replace invalid characters in SVGs
# See https://github.com/svg/svgo/issues/1498
run: |
for file in ./outputs/*.svg; do
sed -i 's/\&/\&/' $file;
sed -i 's/\</\</' $file;
sed -i 's/\>/\>/' $file;
done
- name: Compress SVGs
run: svgo --config .github/svgo.conf.js -f ./outputs/
- name: Add fonts to SVGs
run: |
for file in ./outputs/*.svg; do
sed -i 's/<\/svg>//' $file
echo "<style>$(cat docs/static/fonts/open-sans.css | tr -d '[:space:]')text{font-family: \"Open Sans\"}</style></svg>" >>$file
done
#=========================== CREATE LISTING ===========================#
- name: Generate listing
run: python3 ./scripts/create_file_listing.py ./outputs/ ./outputs/listing.json
#=========================== GENERATE STATS ===========================#
- name: Generate stats
run: python3 ./scripts/create_system_stats.py data/system_migovec.th --json ./outputs/stats.json --therion-path ${THERION_PATH}/bin/therion
#=============================== UPLOADS ===============================#
- name: Upload Files
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
title: Build ${{ github.run_number }}
automatic_release_tag: "latest"
prerelease: false
files: |
./outputs/listing.json
./outputs/stats.json
./outputs/*.3d
./outputs/*.lox
./outputs/*.pdf
./outputs/*.svg
./outputs/*.kml
./outputs/*.gpx