-
-
Notifications
You must be signed in to change notification settings - Fork 8
306 lines (254 loc) · 9.2 KB
/
ci.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
name: CI
defaults:
run:
shell: bash
on:
push:
paths-ignore:
- '.github/workflows/gh-pages.yml'
pull_request:
jobs:
build-and-test:
if: contains(toJson(github.event.commits), '[ci skip]') == false && contains(toJson(github.event.commits), '[skip ci]') == false
strategy:
fail-fast: false
matrix:
include:
- os: "windows-latest"
ghc-version: "9.2.7"
- os: "ubuntu-latest"
ghc-version: "9.4.4"
- os: "macos-latest"
ghc-version: "9.0.1"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install cabal/ghc
uses: haskell/actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc-version }}
cabal-version: '3.10.1.0'
- name: Set PATH for cabal-installed executables
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
echo "$HOME\AppData\Roaming\cabal\bin" >> $GITHUB_PATH
else
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
fi
- name: Set Cabal options
# Overwriting prevent cabal from raising an error when installing
# an executable that is already present (because of caching)
run: |
cabal update
cabal freeze
cabal user-config update -f -a "overwrite-policy: always"
cabal user-config update -f -a "install-method: copy"
cabal user-config update -f -a "split-sections: True"
cabal user-config update -f -a "executable-stripping: True"
- name: Cache cabal work
uses: actions/cache@v3
with:
path: |
dist-newstyle
${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-${{ hashFiles('cabal.project.freeze') }}-cabal-install
- name: Build pandoc-plot
shell: bash
# Try building it twice in case of flakey builds on Windows
# See https://github.com/haskell/haskell-language-server
run: |
cabal build --enable-tests || \
cabal build --enable-tests -j1
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- uses: r-lib/actions/setup-r@v2
- uses: actions/cache@v2
name: Cache Python build artifacts
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/requirements.txt') }}
- name: Install Python toolkits
run: |
python -m pip install --upgrade pip
pip install numpy wheel
pip install -r .github/workflows/requirements.txt
- name: Set up MATLAB [Linux]
if: matrix.os == 'ubuntu-latest'
uses: matlab-actions/setup-matlab@v1
- name: Install GGPlot2
run: |
Rscript -e "install.packages('ggplot2', repos='http://cran.rstudio.com/')"
- name: Install Octave, Gnuplot, Graphviz, and PlantUML [Linux]
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get --quiet --yes install octave
sudo apt-get --quiet --yes install gnuplot
sudo apt-get --quiet --yes install graphviz
sudo apt-get --quiet --yes install plantuml
echo $(plantuml -version)
# The ubuntu package version is too old
sudo curl -L "http://sourceforge.net/projects/plantuml/files/plantuml.jar/download" -o "/usr/share/plantuml/plantuml.jar"
echo $(plantuml -version)
- name: Install Graphviz, GNUplot, and PlantUML [Windows]
if: runner.os == 'Windows'
shell: pwsh
run: |
choco install --yes --no-progress graphviz
dot -c
choco install --yes --no-progress gnuplot
choco install --yes --no-progress plantuml
plantuml -h
- name: Install Plots.jl toolkit [Linux]
# Integration tests sometimes hang on MacOS and Windows
if: matrix.os == 'ubuntu-latest'
shell: julia {0}
run: |
using Pkg
Pkg.add("Plots")
# The default GR backend is a bit flaky on Linux, but
# PyPlot doesn't work on MacOS
if ("${{ matrix.os }}" == "ubuntu-latest")
Pkg.add("PyPlot")
end
- name: Set default Plots.jl backend [Linux]
if: matrix.os == 'ubuntu-latest'
run: |
mkdir ~/.julia/config
echo 'ENV["PLOTS_DEFAULT_BACKEND"]="PyPlot"' >> ~/.julia/config/startup.jl
- name: Check installed plotting toolkits
run: |
cabal install exe:pandoc-plot
pandoc-plot toolkits
- name: Unit tests
run: |
cabal test
- name: Integration tests
# Integration tests sometimes hang on MacOS
if: matrix.os == 'ubuntu-latest'
run: |
cabal install pandoc-cli
cabal install exe:pandoc-plot
pandoc --filter pandoc-plot -i tests/integration.md -t html
if [ $(ls "plots" | wc -l) == 0 ]; then
exit 1
fi
pandoc-plot clean tests/integration.md
pandoc --filter pandoc-plot -i tests/issue16.md -t native
if [ $(ls "plots" | wc -l) == 0 ]; then
exit 1
fi
pandoc-plot clean tests/issue16.md
pandoc --filter pandoc-plot -i tests/issue30.md -t native
if [ $(ls "plots" | wc -l) != 2 ]; then
exit 1
fi
pandoc-plot clean tests/issue30.md
# The idea here is to install some random package (npstreams) to
# check whether the plots will be rendered in the appropriate
# environment
python -m venv ./issue46
./issue46/bin/python -m pip install npstreams matplotlib
pandoc --filter pandoc-plot -i tests/issue46.md -t native
if [ $(ls "plots" | wc -l) != 2 ]; then
exit 1
fi
pandoc-plot clean tests/issue46.md
pandoc --filter pandoc-plot -i tests/issue53.md -t native
if [ $(ls "plots" | wc -l) != 2 ]; then
exit 1
fi
pandoc-plot clean tests/issue53.md
- name: Build documentation
run: source tools/mkmanual.sh
- name: Build artifact
run: |
mkdir artifact
cabal install exe:pandoc-plot --installdir artifact
if [[ "${{ runner.os }}" != "Windows" ]]
then
chmod u+x artifact/pandoc-plot
fi
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-artifact
path: artifact/pandoc-plot*
retention-days: 7
- name: Build artifact [Linux - static]
if: runner.os == 'Linux'
run: |
mkdir artifact-static
cabal install exe:pandoc-plot --enable-executable-static --installdir artifact-static
chmod u+x artifact-static/pandoc-plot
- name: Upload artifact [Linux - static]
uses: actions/upload-artifact@v2
if: runner.os == 'Linux'
with:
name: ${{ runner.os }}-artifact-static
path: artifact-static/pandoc-plot
retention-days: 7
- name: Build Installer [Windows]
if: runner.os == 'Windows'
shell: pwsh
run: |
cabal install --installdir ".\installer"
$version = .\installer\pandoc-plot.exe --version
iscc /dAppVersion=$version ".\installer\pandoc-plot-setup.iss"
- name: Upload artifact [Windows - installer]
uses: actions/upload-artifact@v2
if: runner.os == 'Windows'
with:
name: ${{ runner.os }}-artifact-installer
path: installer/pandoc-plot-wininst-x86_64.exe
retention-days: 7
release:
needs: [build-and-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- name: Compress artifacts and move to assets
run: |
mkdir assets
zip -j assets/pandoc-plot-Windows-x86_64.zip Windows-artifact/pandoc-plot.exe
mv Windows-artifact-installer/*.exe assets
zip -j assets/pandoc-plot-Linux-x86_64.zip Linux-artifact/pandoc-plot
zip -j assets/pandoc-plot-Linux-x86_64-static.zip Linux-artifact-static/pandoc-plot
zip -j assets/pandoc-plot-macOS-x86_64.zip macOS-artifact/pandoc-plot
ls -a assets
- name: Create release description
run: |
python tools/release-description.py CHANGELOG.md > description.md
cat description.md
- name: Create release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: description.md
files: |
assets/*
# winget-release:
# needs: [release]
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/download-artifact@v2
# - name: Update Winget package
# shell: pwsh
# env:
# SUBMIT: ${{ startsWith(github.ref, 'refs/tags/') }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# $VERSION = .\Windows-artifact\pandoc-plot.exe --version
# iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
# .\wingetcreate.exe update `
# -i LaurentPRenedeCotret.pandoc-plot `
# --url https://github.com/LaurentRDC/pandoc-plot/releases/download/$VERSION/pandoc-plot-wininst-x86_64.exe `
# --version $VERSION `
# --token $GITHUB_TOKEN `
# --submit $SUBMIT