Skip to content

Support older CMake #453

Support older CMake

Support older CMake #453

Workflow file for this run

name: tests
on:
push:
pull_request:
jobs:
cpptests:
name: C++ Tests on ${{ matrix.os }} ${{ matrix.description }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
- os: ubuntu-latest
- os: ubuntu-latest
gccver: "13"
description: "GCC 13"
- os: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
if: ${{ matrix.gccver != '' }}
with:
version: ${{ matrix.gccver }}
# build on CMake version supported in CMakeLists.txt
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1
if: contains(matrix.os, 'ubuntu')
with:
cmake-version: '3.12'
- name: Install Integrations (Ubuntu)
if: contains(matrix.os, 'ubuntu')
run: sudo apt-get update && sudo apt-get install -y libarmadillo-dev
- name: Install GraphBLAS (ubuntu)
if: contains(matrix.os, 'ubuntu')
# Install pre-built GraphBLAS from conda-forge because GraphBLAS packages in Ubuntu repos are too old to be useful.
# See LAGraph's workflow: https://github.com/GraphBLAS/LAGraph/blob/stable/.github/workflows/build.yml
run: |
mkdir -p grb
cd grb
wget --quiet https://anaconda.org/conda-forge/graphblas/8.2.1/download/linux-64/graphblas-8.2.1-h59595ed_0.conda
unzip graphblas-8.2.1-h59595ed_0.conda
tar xvf pkg-graphblas-8.2.1-h59595ed_0.tar.zst
cd ..
echo "FMM_CMAKE_FLAGS=-DCMAKE_MODULE_PATH=${{ github.workspace }}/grb/lib/cmake/SuiteSparse -DGraphBLAS_ROOT=${{ github.workspace }}/grb/" >> $GITHUB_ENV
- name: Install GraphBLAS (macOS)
if: contains(matrix.os, 'macos')
# install suite-sparse which includes GraphBLAS and also FindGraphBLAS.cmake
run: brew install suite-sparse
- name: Configure
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DFAST_MATRIX_MARKET_TEST=ON -DFAST_MATRIX_MARKET_TEST_COVERAGE=ON ${{ env.FMM_CMAKE_FLAGS }}
- name: Build
env:
CMAKE_BUILD_PARALLEL_LEVEL: 2
run: cmake --build build --config Debug
- name: Test
working-directory: build
run: ctest -C Debug --output-on-failure --verbose
- name: Upload Coverage to Codecov
if: ${{ contains(matrix.os, 'ubuntu') }}
uses: codecov/codecov-action@v3
with:
gcov: true
gcov_include: include/* # C++ coverage
pythontests:
name: Python ${{ matrix.python-version }} Tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.7', '3.11', 'pypy-3.9']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Python Build
# On some platforms pip uses a temporary build directory but only copies the python/ directory there.
# This breaks the relative symbolic links to the C++ library. Workaround is to pass the checkout directory
# as an environment variable so CMakeLists.txt can read it and know where to import the C++ library from.
run: |
export FMM_PYTHON_DIR="$(pwd)" && pip install python/.[testmin] -v && pip install pytest-subtests
shell: bash
- name: Python Test Minimums
working-directory: python/tests
run: pytest
- name: Install NumPy
# --only-binary disables compiling the package from source if a binary wheel is not available, such as some versions of PyPy
run: pip install --only-binary ":all:" numpy || true
- name: Install SciPy
# --only-binary disables compiling the package from source if a binary wheel is not available, such as PyPy
run: pip install --only-binary ":all:" scipy || true
- name: Python Test
working-directory: python/tests
run: pytest
- name: Python Test with Coverage
if: contains(matrix.os, 'ubuntu')
working-directory: python/tests
run: |
pip install pytest-cov
pytest --cov=fast_matrix_market --cov-report term --cov-report=xml
- name: Upload Coverage to Codecov
if: contains(matrix.os, 'ubuntu')
uses: codecov/codecov-action@v3
with:
directory: python/tests
#################################################################################
linux_32bit:
name: Tests on 32-bit Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: build + test
run: |
set -euo pipefail
docker pull quay.io/pypa/manylinux2014_i686
docker run -v $(pwd):/fmm --platform=linux/i386 quay.io/pypa/manylinux2014_i686 /bin/bash -c "cd /fmm && \
uname -a && \
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DFAST_MATRIX_MARKET_TEST=ON && \
cmake --build build --config Debug && \
cd build && \
ctest -C Debug --output-on-failure --verbose && \
cd ../ && \
python3.9 -m venv env && \
source env/bin/activate && \
python -m pip install python/ -v &&\
python -m pip install --only-binary :all: numpy scipy pytest pytest-subtests && \
cd python/tests/ && \
pytest -v"