Skip to content

tests

tests #577

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: windows-latest
mingw-version: "13.2.0"
description: "MinGW 13"
cmake-flags: '-G "MinGW Makefiles"'
- os: ubuntu-20.04
llvm-version: "8"
description: "LLVM 8"
- os: ubuntu-20.04
gcc-version: "8"
description: "GCC 8"
- os: ubuntu-latest
gcc-version: "9"
# test minimum CMake version specified in CMakeLists.txt
cmake-version: '3.14'
description: "GCC 9"
- os: ubuntu-latest
gcc-version: "13"
cmake-version: '3.14'
description: "GCC 13"
- os: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup GCC
uses: egor-tensin/setup-gcc@v1
if: ${{ matrix.gcc-version != '' }}
with:
version: ${{ matrix.gcc-version }}
- name: Setup MinGW (Windows)
if: contains(matrix.os, 'windows') && matrix.mingw-version != ''
run: |
choco install --no-progress mingw --version ${{ matrix.mingw-version }}
Add-Content $env:GITHUB_PATH "C:\ProgramData\mingw64\mingw64\bin"
- name: Setup LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
if: ${{ matrix.llvm-version != '' }}
with:
version: ${{ matrix.llvm-version }}
env: true
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1
if: ${{ matrix.cmake-version != '' }}
with:
cmake-version: ${{ matrix.cmake-version }}
# test that the examples build
- name: Build examples
working-directory: examples
run: |
cmake -S . -B cmake-build-debug/ -D CMAKE_BUILD_TYPE=Debug ${{ matrix.cmake-flags }}
cmake --build cmake-build-debug/
- 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 }} ${{ matrix.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@v5
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
# `--pre` to test against RCs, if any
run: pip install --pre --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
# `--pre` to test against RCs, if any
run: pip install --pre --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"