Skip to content

Commit

Permalink
Resurrect CI
Browse files Browse the repository at this point in the history
  • Loading branch information
tschoonj committed Dec 26, 2023
1 parent c05c4c0 commit a5e780d
Show file tree
Hide file tree
Showing 15 changed files with 271 additions and 265 deletions.
468 changes: 211 additions & 257 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

5 changes: 2 additions & 3 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 "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:${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,10 +134,9 @@ 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 "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:${top_builddir}/python/.libs\" $(PYTHON) ${top_srcdir}/example/xrlexample13.py" > xrlexample13.sh
@chmod +x xrlexample13.sh


#testing the Pascal-Delphi bindings
xrlexample14.sh: ../pascal/xraylib.ppu xrlexample14.pas
@echo "Testing Pascal bindings"
Expand Down
5 changes: 4 additions & 1 deletion example/xrlexample13.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
#THIS SOFTWARE IS PROVIDED BY Tom Schoonjans ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Tom Schoonjans BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


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):
os.add_dll_directory(path)
import numpy as np
import xraylib_np as xrl_np
import sys



if __name__ == '__main__' :
xrl_np.XRayInit()
print ("Example of python-numpy program using xraylib")
Expand Down
5 changes: 4 additions & 1 deletion example/xrlexample5.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@

"""Example of using various xraylib functionality in python."""


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):
os.add_dll_directory(path)
import xraylib
import math
import numpy as np
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 = 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 ;
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 ;

if ENABLE_PYTHON
dist_check_SCRIPTS = \
Expand Down
5 changes: 3 additions & 2 deletions python/tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ test_env = environment()
test_env.prepend('PYTHONPATH', pydir)
if host_system == 'windows'
test_env.prepend('PATH', src_build_dir)
# see https://github.com/xhochy/python-feedstock/blob/6efc12d0479e958a138bfaf3d1eb6b47a10d5f68/recipe/patches/0014-Add-CondaEcosystemModifyDllSearchPath.patch
test_env.prepend('CONDA_DLL_SEARCH_MODIFICATION_ENABLE', '1')
# # see https://github.com/xhochy/python-feedstock/blob/6efc12d0479e958a138bfaf3d1eb6b47a10d5f68/recipe/patches/0014-Add-CondaEcosystemModifyDllSearchPath.patch
# test_env.prepend('CONDA_DLL_SEARCH_MODIFICATION_ENABLE', '1')
test_env.append('EXTRA_DLL_SEARCH_PATHS', src_build_dir)
endif

foreach _test : tests
Expand Down
5 changes: 5 additions & 0 deletions python/tests/test-atomiclevelwidth.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
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):
os.add_dll_directory(path)
import unittest
import xraylib


class TestAtomicLevelWidth(unittest.TestCase):
def test_Fe_K(self):
width = xraylib.AtomicLevelWidth(26, xraylib.K_SHELL)
Expand Down
5 changes: 5 additions & 0 deletions python/tests/test-atomicweight.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
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):
os.add_dll_directory(path)
import unittest
import xraylib


class TestAtomicWeight(unittest.TestCase):
def test_Fe(self):
weight = xraylib.AtomicWeight(26)
Expand Down
5 changes: 5 additions & 0 deletions python/tests/test-auger.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
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):
os.add_dll_directory(path)
import unittest
import xraylib


class TestAugerRate(unittest.TestCase):
def test_Pb_K_L3M5(self):
rate = xraylib.AugerRate(82, xraylib.K_L3M5_AUGER)
Expand Down
5 changes: 5 additions & 0 deletions python/tests/test-compoundparser.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
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):
os.add_dll_directory(path)
import unittest
import xraylib


class TestCompoundParser(unittest.TestCase):
def test_good_compounds(self):
self.assertIsInstance(xraylib.CompoundParser("C19H29COOH"), dict)
Expand Down
5 changes: 5 additions & 0 deletions python/tests/test-comptonprofiles.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
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):
os.add_dll_directory(path)
import unittest
import xraylib


class TestComptonProfiles(unittest.TestCase):
def test_pz_0(self):
profile = xraylib.ComptonProfile(26, 0.0)
Expand Down
5 changes: 5 additions & 0 deletions python/tests/test-crystal_diffraction.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
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):
os.add_dll_directory(path)
import unittest
import xraylib
import math


class TestCrystalDiffraction(unittest.TestCase):
def test_crystal_diffraction(self):
crystals_list = xraylib.Crystal_GetCrystalsList()
Expand Down
5 changes: 5 additions & 0 deletions python/tests/test-nist-compounds.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
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):
os.add_dll_directory(path)
import unittest
import xraylib


class TestNISTCompounds(unittest.TestCase):
def test_good(self):
list = xraylib.GetCompoundDataNISTList()
Expand Down
6 changes: 6 additions & 0 deletions python/tests/test-numpy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
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):
os.add_dll_directory(path)
import unittest
import xraylib
import numpy as np



class TestNumpy(unittest.TestCase):
def _test_np(self, dtype):
for Z in np.arange(10, 20, dtype=dtype):
Expand Down
5 changes: 5 additions & 0 deletions python/tests/test-radionuclides.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
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):
os.add_dll_directory(path)
import unittest
import xraylib


class TestRadionuclides(unittest.TestCase):
def test_good(self):
list = xraylib.GetRadioNuclideDataList()
Expand Down

0 comments on commit a5e780d

Please sign in to comment.