Clean handling of an unexpected errno zero case #789
This file contains 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-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" |