Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
tschoonj committed Jul 21, 2024
1 parent 62848a2 commit b9014d5
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 27 deletions.
52 changes: 28 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# https://github.com/actions/runner-images/issues/3342#issuecomment-2206538745
- name: Install swig on macOS
run: brew install swig
if: ${{ matrix.os == 'macos-latest' }}
- name: Install xraylib with pip
run: |
python -m pip install -U numpy pip
Expand Down Expand Up @@ -149,6 +153,8 @@ jobs:
./configure --enable-python --enable-python-numpy PYTHON=python3 --disable-ruby
make -j$(nproc)
find . -name '*pyd' -print0 | xargs -0 ls -l
find . -name 'xraylib.py' -print0 | xargs -0 ls -l
make check || (cat python/tests/test-suite.log && exit 1)
make distclean
Expand Down Expand Up @@ -181,11 +187,11 @@ jobs:
- llvm
- gcc@13
include:
- ldflags: ""
- ldflags: "-Wl,-ld_classic"
- compiler: llvm
cc: /usr/local/opt/llvm/bin/clang
cxx: /usr/local/opt/llvm/bin/clang++
ldflags: -L/usr/local/opt/llvm/lib
cc: /opt/homebrew/opt/llvm/bin/clang
cxx: /opt/homebrew/opt/llvm/bin/clang++
# ldflags: -L/opt/homebrew/opt/llvm/lib
enable_ruby: enable
- compiler: gcc@13
cc: gcc-13
Expand All @@ -197,27 +203,23 @@ jobs:
- name: Install Homebrew dependencies
run: |
set -ex
rm -f /usr/local/bin/2to3
rm -f /opt/homebrew/bin/2to3
brew uninstall -f bazel bazelisk mongodb-community
brew update
brew upgrade
brew install git autoconf automake libtool pkg-config ${{ matrix.compiler }} swig ruby fpc lua bash numpy meson ninja
brew install git autoconf automake libtool pkg-config ${{ matrix.compiler }} swig ruby fpc lua bash numpy meson ninja cython
brew link --overwrite python
brew unlink python && brew link --overwrite python
ls -l /usr/local/bin/python3
ls -l /opt/homebrew/bin/python3
echo "/opt/homebrew/opt/cython/bin" >> "${GITHUB_PATH}"
set +ex
env:
HOMEBREW_CURL_RETRIES: 5

- name: Install Cython
run: |
/usr/local/bin/python3 -m pip install Cython
- name: Primary Build and test with Meson
if: matrix.buildsystem == 'meson'
run: |
set -ex
meson setup meson-build -Dpython=/usr/local/bin/python3 -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled
meson setup meson-build -Dpython=/opt/homebrew/bin/python3 -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled
meson compile -C meson-build
meson test -C meson-build
meson dist -C meson-build
Expand All @@ -231,27 +233,28 @@ jobs:
if: matrix.buildsystem == 'meson'
run: |
set -ex
export SHELL="$(which bash)"
cd meson-build/meson-dist/
TARBALL=$(ls *.tar.xz)
tar xfJ $TARBALL
cd ${TARBALL%.tar.xz}
autoreconf -fi
./configure --enable-python SHELL=${SHELL} PYTHON=/usr/local/bin/python3
./configure --enable-python SHELL=${SHELL} PYTHON=/opt/homebrew/bin/python3
make -j$(nproc)
make check
set +ex
env:
CC: ${{matrix.cc}}
CXX: ${{matrix.cxx}}
SHELL: /usr/local/bin/bash
- name: Build with Autotools
if: matrix.buildsystem == 'autotools'
run: |
set -ex
export SHELL="$(which bash)"
autoreconf -fi
# Build without python
./configure --disable-python --disable-python-numpy --disable-perl --enable-lua --enable-pascal --disable-java --disable-php --${{matrix.enable_ruby}}-ruby SHELL=${SHELL} RUBY=/usr/local/opt/ruby/bin/ruby
./configure --disable-python --disable-python-numpy --disable-perl --enable-lua --enable-pascal --disable-java --disable-php --${{matrix.enable_ruby}}-ruby SHELL=${SHELL} RUBY=/opt/homebrew/opt/ruby/bin/ruby
make -j$(nproc)
make check
make distclean
Expand All @@ -276,14 +279,13 @@ jobs:
# Run make distcheck
./configure
make distcheck SHELL=${SHELL} PYTHON=${XRL_PYTHON3} DISTCHECK_CONFIGURE_FLAGS="--${{matrix.enable_ruby}}-ruby" RUBY=/usr/local/opt/ruby/bin/ruby
make distcheck SHELL=${SHELL} PYTHON=${XRL_PYTHON3} DISTCHECK_CONFIGURE_FLAGS="--${{matrix.enable_ruby}}-ruby" RUBY=/opt/homebrew/opt/ruby/bin/ruby
set +ex
env:
CC: ${{matrix.cc}}
CXX: ${{matrix.cxx}}
SHELL: /usr/local/bin/bash
XRL_PYTHON3: /usr/local/bin/python3
XRL_PYTHON3: /opt/homebrew/bin/python3
- name: Secondary build with Meson
if: matrix.buildsystem == 'autotools'
run: |
Expand All @@ -299,7 +301,7 @@ jobs:
CC: ${{matrix.cc}}
CXX: ${{matrix.cxx}}
LDFLAGS: ${{matrix.ldflags}}
XRL_PYTHON3: /usr/local/bin/python3
XRL_PYTHON3: /opt/homebrew/bin/python3

linux:
timeout-minutes: 60
Expand All @@ -318,9 +320,11 @@ jobs:
buildsystem:
- autotools
- meson
# exclude:
# - image: rockylinux:8
# buildsystem: meson
exclude:
# there's some weird segfault
- image: rockylinux:8
buildsystem: autotools
cc: clang
include:
- cc: gcc
cxx: g++
Expand Down Expand Up @@ -445,7 +449,7 @@ jobs:
make distclean
./configure --disable-ruby --disable-perl --disable-lua --disable-fortran2003 --${PYTHON_ENABLE}-python-numpy --${PYTHON_ENABLE}-python PYTHON=${XRL_PYTHON3}
make -j$(nproc)
make check
make check || (cat example/xrlexample13.sh.log && exit 1)
make distclean
./configure --disable-all-bindings --disable-shared --enable-static
make -j$(nproc)
Expand Down
4 changes: 2 additions & 2 deletions example/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ xrlexample2.sh: ../perl/xraylib.la xrlexample2.pl
#test the python bindings
xrlexample5.sh: ../python/_xraylib.la xrlexample5.py
@echo "Testing python bindings"
@echo "EXTRA_DLL_SEARCH_PATHS=\"${abs_top_builddir}/src/.libs\" LD_LIBRARY_PATH=\"${top_builddir}/src/.libs\" DYLD_LIBRARY_PATH=\"${top_builddir}/src/.libs\" PATH=\"${top_builddir}/src/.libs\" PYTHONPATH=\"${top_builddir}/python:${top_builddir}/python/.libs\" $(PYTHON) ${top_srcdir}/example/xrlexample5.py" > xrlexample5.sh
@echo "EXTRA_DLL_SEARCH_PATHS=\"${abs_top_builddir}/src/.libs\" LD_LIBRARY_PATH=\"${top_builddir}/src/.libs\" DYLD_LIBRARY_PATH=\"${top_builddir}/src/.libs\" PATH=\"${top_builddir}/src/.libs\" PYTHONPATH=\"${top_builddir}/python$(PATH_SEPARATOR)${top_builddir}/python/.libs\" $(PYTHON) ${top_srcdir}/example/xrlexample5.py" > xrlexample5.sh
@chmod +x xrlexample5.sh

#test the java bindings
Expand Down Expand Up @@ -134,7 +134,7 @@ xrlexample12.sh: ../php/xraylib.la xrlexample12.php
#test the numpy-python bindings
xrlexample13.sh: ../python/xraylib_np.la xrlexample13.py
@echo "Testing python-numpy bindings"
@echo "EXTRA_DLL_SEARCH_PATHS=\"${abs_top_builddir}/src/.libs\" LD_LIBRARY_PATH=\"${top_builddir}/src/.libs\" DYLD_LIBRARY_PATH=\"${top_builddir}/src/.libs\" PATH=\"${top_builddir}/src/.libs\" PYTHONPATH=\"${top_builddir}/python:${top_builddir}/python/.libs\" $(PYTHON) ${top_srcdir}/example/xrlexample13.py" > xrlexample13.sh
@echo "EXTRA_DLL_SEARCH_PATHS=\"${abs_top_builddir}/src/.libs\" LD_LIBRARY_PATH=\"${top_builddir}/src/.libs\" DYLD_LIBRARY_PATH=\"${top_builddir}/src/.libs\" PATH=\"${top_builddir}/src/.libs\" PYTHONPATH=\"${top_builddir}/python$(PATH_SEPARATOR)${top_builddir}/python/.libs\" $(PYTHON) ${top_srcdir}/example/xrlexample13.py" > xrlexample13.sh
@chmod +x xrlexample13.sh

#testing the Pascal-Delphi bindings
Expand Down
2 changes: 1 addition & 1 deletion python/tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ NULL=
TEST_EXTENSIONS = .py
PY_LOG_COMPILER = $(PYTHON)
AM_PY_LOG_FLAGS =
AM_TESTS_ENVIRONMENT = EXTRA_DLL_SEARCH_PATHS='${abs_top_builddir}/src/.libs' LD_LIBRARY_PATH='${top_builddir}/src/.libs' DYLD_LIBRARY_PATH='${top_builddir}/src/.libs' PATH='${top_builddir}/src/.libs' PYTHONPATH='${top_builddir}/python:${top_builddir}/python/.libs' ; export LD_LIBRARY_PATH DYLD_LIBRARY_PATH PATH PYTHONPATH EXTRA_DLL_SEARCH_PATHS ;
AM_TESTS_ENVIRONMENT = EXTRA_DLL_SEARCH_PATHS='${abs_top_builddir}/src/.libs' LD_LIBRARY_PATH='${top_builddir}/src/.libs' DYLD_LIBRARY_PATH='${top_builddir}/src/.libs' PATH='${top_builddir}/src/.libs' PYTHONPATH='${top_builddir}/python$(PATH_SEPARATOR)${top_builddir}/python/.libs' ; export LD_LIBRARY_PATH DYLD_LIBRARY_PATH PATH PYTHONPATH EXTRA_DLL_SEARCH_PATHS ;

if ENABLE_PYTHON
dist_check_SCRIPTS = \
Expand Down
2 changes: 2 additions & 0 deletions python/tests/test-atomiclevelwidth.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sys
print(f"{sys.path}")
import os
if "EXTRA_DLL_SEARCH_PATHS" in os.environ and hasattr(os, "add_dll_directory"):
for path in os.environ["EXTRA_DLL_SEARCH_PATHS"].split(os.pathsep):
Expand Down

0 comments on commit b9014d5

Please sign in to comment.