-
Notifications
You must be signed in to change notification settings - Fork 37
451 lines (413 loc) · 16 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
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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
# SPDX-License-Identifier: FSFAP
# Copyright (C) 2022-2024 Colin B. Macdonald
# Copyright (C) 2022 Chris Gorman
# Copyright (C) 2022 Alex Vong
# Copyright (C) 2023 Markus Mützel
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
#
# Github Actions configuration for Octave's Symbolic package.
name: CI
on:
push:
pull_request:
schedule:
- cron: '17 0 * * 0'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
# Just some misc stuff, minimal testing, diagnostics etc
try_stuff:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Run a one-line script
run: echo Hello, world!
- name: Run a multi-line script
run: |
echo Hello world
uname -a
docker pull docker.io/gnuoctave/octave
# sudo apt-get install --no-install-recommends -y octave
# octave --version
ls
cd inst
ls
docker run --rm -v $PWD:/workdir:rw gnuoctave/octave octave-cli --eval 'pwd; ls; disp(42); help sympref'
docker run --rm -v $PWD:/workdir:rw gnuoctave/octave octave-cli --eval "sympref diagnose"
docker run --rm -v $PWD:/workdir:rw gnuoctave/octave octave-cli --eval "x=sym('x'); y=sin(x/17); disp(y)"
echo "Try a test"
docker run --rm -v $PWD:/workdir:rw gnuoctave/octave octave-cli --eval "x=sym('x'); test @sym/qr"
appstream-validate:
# maybe a later Ubuntu will have appstream >= 1, for now we pull from flatpak
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install Flatpak and add Flathub
run: |
whoami
uname -a
sudo apt-get update
sudo apt-get install -y flatpak
sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
sudo flatpak install -y org.freedesktop.appstream.cli
- name: List appstream.cli version
run: |
flatpak run org.freedesktop.appstream.cli --version
- name: Validate
run: |
flatpak run org.freedesktop.appstream.cli validate --strict --pedantic --explain io.github.gnu_octave.symbolic.metainfo.xml
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@v2
with:
ignore_words_file: .codespell-ignorewords
exclude_file: .codespell-ignorelines
check_filenames: true
check_hidden: true
# Built-in Self Tests and Doctests for various supported Octave and SymPy
# Test newest Octave and all supported SymPy
# Older Octave tend to need slightly different setup for pip setup
bist_doc:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
octave: [9.2.0]
sympy: [1.5.1, 1.6.2, 1.7.1, 1.8, 1.9, 1.10.1, 1.11.1, 1.12.1, 1.13.0, 1.13.3]
include:
- octave: 9.1.0
sympy: 1.13.3
steps:
- uses: actions/checkout@v4
- name: Container setup
env:
OCT: ${{ matrix.octave }}
SYMPY: ${{ matrix.sympy }}
run: |
uname -a
docker pull docker.io/gnuoctave/octave:$OCT
docker run --name=oc --detach --init \
--volume=$PWD:/workdir/octsympy:rw \
gnuoctave/octave:$OCT sleep inf
# FIXME: workaround "fatal: unsafe repository" error
# For more details, see https://stackoverflow.com/q/71901632
# and https://github.com/actions/checkout/issues/760
docker exec oc git config --global --add safe.directory /workdir/octsympy
docker exec oc pip --version
A=`docker exec oc pip --version | awk '{print $2}'`
echo $A
docker exec oc pip install --break-system-packages packaging
docker exec oc pip install --break-system-packages sympy==$SYMPY
docker exec oc octave-cli --eval "pkg install -forge doctest"
- name: Run BIST in-place
run: docker exec oc make -C octsympy test
- name: Run doctests in-place
run: docker exec oc make -C octsympy doctest
- name: Make package, then install-load-unload-uninstall
run: |
docker exec oc make -C octsympy install
docker exec oc octave --eval "pkg load symbolic; sympref diagnose; syms x; clear all; pkg unload symbolic; pkg uninstall symbolic"
- name: Stop container
run: |
docker stop oc
docker rm oc
# Test other supported Octave releases with latest available SymPy
# Note that 1.10.1 not supported on Python 3.6 (Ubuntu 18.04-based systems)
# Ubuntu 20.04: Octave 5.2.0
# Ubuntu 22.04: Octave 6.4.0
bist_doc_old:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- octave: 6.1.0
sympy: 1.13.3
- octave: 6.2.0
sympy: 1.13.3
- octave: 6.3.0
sympy: 1.13.3
- octave: 6.4.0
sympy: 1.13.3
- octave: 7.1.0
sympy: 1.13.3
- octave: 7.2.0
sympy: 1.13.3
- octave: 7.3.0
sympy: 1.13.3
- octave: 8.1.0
sympy: 1.13.3
- octave: 8.2.0
sympy: 1.13.3
- octave: 8.3.0
sympy: 1.13.3
- octave: 8.4.0
sympy: 1.13.3
steps:
- uses: actions/checkout@v4
- name: Container setup
env:
OCT: ${{ matrix.octave }}
SYMPY: ${{ matrix.sympy }}
run: |
uname -a
docker pull docker.io/gnuoctave/octave:$OCT
docker run --name=oc --detach --init \
--volume=$PWD:/workdir/octsympy:rw \
gnuoctave/octave:$OCT sleep inf
# FIXME: workaround "fatal: unsafe repository" error
# For more details, see https://stackoverflow.com/q/71901632
# and https://github.com/actions/checkout/issues/760
docker exec oc git config --global --add safe.directory /workdir/octsympy
# < 8.x containers don't have pip, must install
# Can just pip (not pip3) once we drop 5.x support
docker exec oc apt-get update
docker exec oc apt-get install -y python3-pip
docker exec oc pip3 --version
docker exec oc pip3 install packaging
docker exec oc pip3 install sympy==$SYMPY
docker exec oc octave-cli --eval "pkg install -forge doctest"
- name: Run BIST in-place
run: docker exec oc make -C octsympy test
- name: Run doctests in-place
run: docker exec oc make -C octsympy doctest
- name: Make package, then install-load-unload-uninstall
run: |
docker exec oc make -C octsympy install
docker exec oc octave --eval "pkg load symbolic; sympref diagnose; syms x; clear all; pkg unload symbolic; pkg uninstall symbolic"
- name: Stop container
run: |
docker stop oc
docker rm oc
# Built-in Self Tests and Doctests using the Pythonic interface
# Currently, we only test with newer Octave and SymPy since the support for
# the Pythonic interface is experimental. We may change this in the future.
pythonic-bist-doctest:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
octave: [8.4.0]
sympy: [1.12]
steps:
- uses: actions/checkout@v4
- name: Container setup
env:
OCT: ${{ matrix.octave }}
SYMPY: ${{ matrix.sympy }}
run: |
uname -a
docker pull docker.io/gnuoctave/octave:"$OCT"
docker run --name=oc --detach --init \
--volume="$PWD":/workdir/octsympy:rw \
gnuoctave/octave:"$OCT" sleep inf
# FIXME: workaround "fatal: unsafe repository" error
# For more details, see https://stackoverflow.com/q/71901632
# and https://github.com/actions/checkout/issues/760
docker exec oc git config --global --add safe.directory /workdir/octsympy
docker exec oc apt-get update
docker exec oc apt-get install --no-install-recommends -y libpython3-dev
docker exec oc pip3 install packaging
docker exec oc pip3 install sympy=="$SYMPY"
docker exec oc octave-cli --eval "pkg install -forge doctest"
docker exec oc octave-cli --eval "pkg install -forge pythonic"
- name: Run BIST
run: |
docker exec oc make -C /workdir/octsympy install
docker exec oc octave-cli --eval "pkg list"
docker exec oc octave-cli \
--eval "pkg load pythonic; pkg load symbolic; sympref diagnose; pkg unload symbolic"
docker exec oc octave-cli \
--eval "pkg load pythonic; pkg load symbolic; \
r = octsympy_tests; if r, type ('fntests.log') end; exit (r)"
- name: Run Doctests
run: |
docker exec oc octave-cli \
--eval "pkg load doctest; pkg load pythonic; pkg load symbolic; \
sym ('x'); success = doctest ('octsympy/inst/'); exit (!success)"
- name: Stop container
run: |
docker stop oc
docker rm oc
# Built-in Self Tests and Doctests using the Pythonic main branch
pythonic-dev-bist-doctest:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
octave: [8.4.0]
sympy: [1.12]
steps:
- uses: actions/checkout@v4
- name: Container setup
env:
OCT: ${{ matrix.octave }}
SYMPY: ${{ matrix.sympy }}
run: |
uname -a
docker pull docker.io/gnuoctave/octave:"$OCT"
docker run --name=oc --detach --init \
--volume="$PWD":/workdir/octsympy:rw \
gnuoctave/octave:"$OCT" sleep inf
# FIXME: workaround "fatal: unsafe repository" error
# For more details, see https://stackoverflow.com/q/71901632
# and https://github.com/actions/checkout/issues/760
docker exec oc git config --global --add safe.directory /workdir/octsympy
docker exec oc apt-get update
docker exec oc apt-get install --no-install-recommends -y libpython3-dev
docker exec oc pip3 install packaging
docker exec oc pip3 install sympy=="$SYMPY"
docker exec oc octave-cli --eval "pkg install -forge doctest"
docker exec oc octave-cli --eval \
"pkg install https://gitlab.com/gnu-octave/octave-pythonic/-/archive/main/octave-pythonic-main.tar.gz"
- name: Run BIST
run: |
docker exec oc make -C /workdir/octsympy install
docker exec oc octave-cli --eval "pkg list"
docker exec oc octave-cli \
--eval "pkg load pythonic; pkg load symbolic; sympref diagnose; pkg unload symbolic"
docker exec oc octave-cli \
--eval "pkg load pythonic; pkg load symbolic; \
r = octsympy_tests; if r, type ('fntests.log') end; exit (r)"
- name: Run Doctests
run: |
docker exec oc octave-cli \
--eval "pkg load doctest; pkg load pythonic; pkg load symbolic; \
sym ('x'); success = doctest ('octsympy/inst/'); exit (!success)"
- name: Stop container
run: |
docker stop oc
docker rm oc
ubuntu2204_ootb:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install Octave, Python and SymPy
run: |
uname -a
sudo apt-get update
sudo apt-get install --no-install-recommends -y octave python3
octave --version
python3 --version
sudo apt-get install --no-install-recommends -y python3-sympy
python3 -c "import sympy; print(sympy.__version__)"
- name: Install package, verify
run: |
pwd
make install
octave --eval "pkg load symbolic; sympref diagnose; pkg unload symbolic"
- name: Load package, run tests
run: |
octave --eval "pkg test symbolic"
- name: uninstall package
run: |
octave --eval "pkg uninstall symbolic; pkg list"
ubuntu2204_pip_sympy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install Octave and Python
run: |
uname -a
sudo apt-get update
sudo apt-get install --no-install-recommends -y octave python3 python3-pip
octave --version
python3 --version
pip3 --version
- name: Install SymPy from pip
run: |
pip3 install sympy
python3 -c "import sympy; print(sympy.__version__)"
- name: Install package, verify
run: |
pwd
make install
octave --eval "pkg load symbolic; sympref diagnose; pkg unload symbolic"
- name: Load package, run tests
run: |
octave --eval "pkg test symbolic"
- name: Build HTML documentation
run: |
octave --eval "pkg install -forge generate_html"
make html
octave --eval "pkg uninstall generate_html; pkg list"
- name: uninstall package
run: |
octave --eval "pkg uninstall symbolic; pkg list"
windows_msys2_mingw:
runs-on: windows-latest
name: mingw-w64 ${{ matrix.msystem }}
defaults:
run:
# Use MSYS2 as default shell
shell: msys2 {0}
strategy:
# Allow other runners in the matrix to continue if some fail
fail-fast: false
matrix:
msystem: [MINGW64, UCRT64]
include:
- msystem: MINGW64
target-prefix: mingw-w64-x86_64
- msystem: UCRT64
target-prefix: mingw-w64-ucrt-x86_64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install packages from MSYS2
uses: msys2/setup-msys2@v2
with:
update: true
release: false
install: >-
base-devel
git
${{ matrix.target-prefix }}-autotools
${{ matrix.target-prefix }}-cc
${{ matrix.target-prefix }}-fltk
${{ matrix.target-prefix }}-octave
${{ matrix.target-prefix }}-python
${{ matrix.target-prefix }}-python-sympy
msystem: ${{ matrix.msystem }}
- name: Show package versions
run: |
uname -a
octave --version
python --version
python -c "import sympy; print(sympy.__version__)"
- name: Install package, verify
id: install-package
run: |
pwd
make install
octave --eval "pkg load symbolic; sympref diagnose; pkg unload symbolic"
- name: Load package, run tests
id: test-package
# For some reason, Octave distributed by MSYS2 crashes on the GitHub
# runner when trying to plot with qt. `--no-gui-libs` avoids that crash
# during the test for `@sym/ezplot.m`.
# For some reason, Octave exits with error 127 after the test suite.
# This is reproducible locally and not limited to the GitHub runner.
# Ignore that error for now.
run: |
( octave --no-gui-libs --eval "pkg test symbolic" | tee ./test-suite.log ) || true
echo Checking test results...
[ -n "$(grep -e "FAIL\s*0" ./test-suite.log)" ] || \
( echo "::error::At least one test failed" && exit 1 )
[ -z "$(grep -e "REGRESSION" ./test-suite.log)" ] || \
( echo "::error::At least one regression in test suite" && exit 1 )
echo Test suite completed successfully
- name: Display test log
if: always() && (steps.test-package.outcome != 'skipped')
run: cat ./fntests.log
- name: Uninstall package
if: always() && (steps.install-package.outcome == 'success')
run: |
octave --eval "pkg uninstall symbolic; pkg list"