diff --git a/.github/workflows/build-multiarch.yaml b/.github/workflows/build-multiarch.yaml new file mode 100644 index 0000000..dec199b --- /dev/null +++ b/.github/workflows/build-multiarch.yaml @@ -0,0 +1,95 @@ +name: Build Multiarch + +on: + push: + branches: [release] + pull_request: + branches: [master, release] + +jobs: + multi-arch-test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - arch: armv6 + distro: bookworm + - arch: armv7 + distro: bookworm + - arch: aarch64 + distro: bookworm + - arch: s390x + distro: bookworm + - arch: ppc64le + distro: bookworm + + - arch: armv7 + distro: ubuntu_latest + - arch: aarch64 + distro: ubuntu_latest + - arch: riscv64 + distro: ubuntu_devel + - arch: s390x + distro: ubuntu_latest + - arch: ppc64le + distro: ubuntu_latest + + - arch: armv7 + distro: ubuntu22.04 + - arch: aarch64 + distro: ubuntu22.04 + # - arch: riscv64 + # distro: ubuntu22.04 + - arch: s390x + distro: ubuntu22.04 + - arch: ppc64le + distro: ubuntu22.04 + # ubuntu with riscv64 has three failures and a crash on test_SolverInterface_basics in scipy's root function; also test_is_poly_positive and test_bend_rounded_Miller_Re_correction + # ubuntu20.04 is too old, fluids dropped support with numpy 2.0 compat + + - arch: armv6 + distro: alpine_latest + - arch: armv7 + distro: alpine_latest + - arch: aarch64 + distro: alpine_latest + - arch: riscv64 + distro: alpine_latest + - arch: s390x + distro: alpine_latest + - arch: ppc64le + distro: alpine_latest + # fedora-latest doesn't work not sure why + + steps: + - uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: all + - name: Run on ${{ matrix.arch }} + uses: uraimo/run-on-arch-action@v2 + with: + arch: ${{ matrix.arch }} + distro: ${{ matrix.distro }} + githubToken: ${{ github.token }} + install: | + if [[ "${{ matrix.distro }}" == "alpine_latest" ]]; then + apk update + apk add python3 py3-pip py3-scipy py3-matplotlib py3-numpy py3-pandas + elif [[ "${{ matrix.distro }}" == "ubuntu_latest" || "${{ matrix.distro }}" == "ubuntu_rolling" || "${{ matrix.distro }}" == "ubuntu_devel" || "${{ matrix.distro }}" == "ubuntu20.04" || "${{ matrix.distro }}" == "ubuntu22.04" || "${{ matrix.distro }}" == "bookworm" ]]; then + apt-get update + apt-get install -y libatlas-base-dev liblapack-dev gfortran libgmp-dev libmpfr-dev libsuitesparse-dev ccache libmpc-dev python3 python3-pip python3-scipy python3-matplotlib python3-numpy python3-pandas + fi + run: | + if python3 -c "import subprocess; exit('no such option' not in subprocess.getoutput('pip3 install --break-system-packages'))"; then + # If the exit status is 0 (True), this means the option is not supported + python3 -m pip install wheel + pip3 install -r requirements_test_multiarch.txt + else + # If the exit status is 1 (False), this means the option is supported + python3 -m pip install wheel --break-system-packages + pip3 install -r requirements_test_multiarch.txt --break-system-packages + fi + python3 -m pytest . -v -m "not online and not thermo and not numba" \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4c208b2..fa63bf0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -132,5 +132,8 @@ jobs: runs-on: ubuntu-latest steps: - name: Coveralls Finished + env: + COVERALLS_REPO_TOKEN: ${{ secrets.coveralls }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | curl https://coveralls.io/webhook?repo_token=${{ secrets.coveralls }} -d "payload[build_num]=${{ github.sha }}&payload[status]=done" diff --git a/.github/workflows/build_multi_numpy_scipy.yml b/.github/workflows/build_multi_numpy_scipy.yml new file mode 100644 index 0000000..134403d --- /dev/null +++ b/.github/workflows/build_multi_numpy_scipy.yml @@ -0,0 +1,130 @@ +name: Build-Test-Multi-Scipy-Numpy +on: + push: + branches: [release] + pull_request: + branches: [master, release] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + numpy: ['2.0.1'] #['1.16.5', '1.18.5', '1.20.3', '1.22.4', '1.24.4', '1.26.4', '2.0.1'] + scipy: ['1.14.0'] #['1.7.3', '1.8.1', '1.9.3', '1.10.1', '1.12.0', '1.14.0'] + python-version: ['3.10'] #['3.7', '3.8', '3.9', '3.10'] + os: [ubuntu-latest] + architecture: ['x64'] + include: + - numpy: '1.16.5' + scipy: '1.7.3' + python-version: '3.7' + - numpy: '1.18.5' + scipy: '1.7.3' + python-version: '3.7' + - numpy: '1.18.5' + scipy: '1.8.1' + python-version: '3.8' + - numpy: '1.18.5' + scipy: '1.9.3' + python-version: '3.8' + - numpy: '1.20.3' + scipy: '1.7.3' + python-version: '3.7' + - numpy: '1.20.3' + scipy: '1.7.3' + python-version: '3.8' + - numpy: '1.20.3' + scipy: '1.8.1' + python-version: '3.8' + - numpy: '1.20.3' + scipy: '1.9.3' + python-version: '3.8' + - numpy: '1.20.3' + scipy: '1.10.1' + python-version: '3.8' + - numpy: '1.22.4' + scipy: '1.7.3' + python-version: '3.8' + - numpy: '1.22.4' + scipy: '1.9.3' + python-version: '3.8' + - numpy: '1.22.4' + scipy: '1.10.1' + python-version: '3.8' + - numpy: '1.24.4' + scipy: '1.8.1' + python-version: '3.8' + - numpy: '1.24.4' + scipy: '1.9.3' + python-version: '3.10' + - numpy: '1.24.4' + scipy: '1.10.1' + python-version: '3.8' + - numpy: '1.24.4' + scipy: '1.12.0' + python-version: '3.9' + - numpy: '1.26.4' + scipy: '1.10.1' + python-version: '3.9' + - numpy: '1.26.4' + scipy: '1.12.0' + python-version: '3.9' + - numpy: '1.26.4' + scipy: '1.14.0' + python-version: '3.10' + - numpy: '2.0.1' + scipy: '1.14.0' + python-version: '3.10' + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} ${{ matrix.architecture }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.architecture }} + - name: cache Linux + uses: actions/cache@v4 + if: startsWith(runner.os, 'Linux') + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements_test.txt') }} + restore-keys: | + ${{ runner.os }}-${{ runner.architecture }}-${{ runner.python-version }}pip- + - name: Install Ubuntu dependencies + if: startsWith(runner.os, 'Linux') + run: | + # Taken from scipy + sudo apt-get update + sudo apt-get install -y libopenblas-dev libatlas-base-dev liblapack-dev gfortran libgmp-dev libmpfr-dev libsuitesparse-dev ccache libmpc-dev + + - name: Install dependencies + run: | + python -c "import platform; print(platform.platform()); print(platform.architecture())" + python -m pip install --upgrade pip + python -m pip install wheel + pip install -r requirements_test.txt + pip install numpy==${{ matrix.numpy }} scipy==${{ matrix.scipy }} + - name: Add numba + if: ${{ matrix.python-version == '3.6' || matrix.python-version == '3.7' || matrix.python-version == '3.8' || matrix.python-version == '3.9' || matrix.python-version == '3.10' || matrix.python-version == '3.11' || matrix.python-version == '3.12' }} + run: | + pip install numba + - name: Test with pytest + run: | + pytest . -v --cov-report html --cov=fluids --cov-report term-missing -m "not online and not thermo and not numba" + coveralls + env: + COVERALLS_REPO_TOKEN: ${{ secrets.coveralls }} + COVERALLS_PARALLEL: true + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + finish: + needs: build + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + env: + COVERALLS_REPO_TOKEN: ${{ secrets.coveralls }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + curl https://coveralls.io/webhook?repo_token=${{ secrets.coveralls }} -d "payload[build_num]=${{ github.sha }}&payload[status]=done" \ No newline at end of file diff --git a/conftest.py b/conftest.py index 536920c..6052d17 100644 --- a/conftest.py +++ b/conftest.py @@ -5,6 +5,10 @@ ver_tup = platform.python_version_tuple()[0:2] ver_tup = tuple(int(i) for i in ver_tup) + +is_x86_or_x86_64 = platform.machine().lower() in ('i386', 'i686', 'x86', 'x86_64', 'amd64') + + def pytest_ignore_collect(path): path = str(path) if 'manual_runner' in path or 'make_test_stubs' in path or 'plot' in path or 'prerelease' in path: @@ -15,7 +19,7 @@ def pytest_ignore_collect(path): return True if 'is_pypy' and 'test_spa' in path: return True - if ver_tup < (3, 7) or ver_tup >= (3, 13) or is_pypy: + if ver_tup < (3, 7) or ver_tup >= (3, 13) or is_pypy or not is_x86_or_x86_64: # numba does not yet run under pypy if 'numba' in path: return True diff --git a/requirements_test_multiarch.txt b/requirements_test_multiarch.txt new file mode 100644 index 0000000..4a1b1da --- /dev/null +++ b/requirements_test_multiarch.txt @@ -0,0 +1,9 @@ +pytest +pytest-cov +sympy +thefuzz +pint +pytz +IPython +sphinx +wheel diff --git a/tests/test_numerics.py b/tests/test_numerics.py index 00d7823..1d41fa5 100644 --- a/tests/test_numerics.py +++ b/tests/test_numerics.py @@ -512,7 +512,7 @@ def to_solve(x): def test_is_poly_positive(): assert not is_poly_positive([4, 3, 2, 1]) - for high in range(0, 100, 5): + for high in range(0, 30, 5): assert is_poly_positive([4, 3, 2, 1], domain=(0, 10**high)) coeffs_4alpha = [2.1570803657937594e-10, 2.008831101045556e-06, -0.004656598178209313, 2.8575882247542514]