Skip to content

Add method to procedurally generate matrices #331

Add method to procedurally generate matrices

Add method to procedurally generate matrices #331

Workflow file for this run

name: tests
on:
push:
pull_request:
jobs:
build:
name: Tests on ${{ matrix.os }} - ${{ matrix.python-version }}
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@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Integrations (Ubuntu)
if: contains(matrix.os, 'ubuntu')
run: 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/7.4.4/download/linux-64/graphblas-7.4.4-hcb278e6_0.conda
unzip graphblas-7.4.4-hcb278e6_0.conda
tar xvf pkg-graphblas-7.4.4-hcb278e6_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
if: ${{ !contains(matrix.python-version, 'pypy') }}
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
if: ${{ !contains(matrix.python-version, 'pypy') }}
env:
CMAKE_BUILD_PARALLEL_LEVEL: 2
run: |
cmake --build build --config Debug
- name: Test
if: ${{ !contains(matrix.python-version, 'pypy') }}
run: |
cd build
ctest -C Debug --output-on-failure --verbose
- name: Python Build and Install
if: ${{ !contains(matrix.python-version, 'pypy') }}
# 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/.[test] -v && pip install pytest-subtests
shell: bash
- name: Python Build and Install (PyPy)
if: contains(matrix.python-version, 'pypy')
# SciPy does not ship PyPy wheels, so to avoid building scipy from source each time instead only
# install numpy and skip the tests that require scipy.
run: |
export FMM_PYTHON_DIR="$(pwd)" && pip install python/. -v && pip install numpy pytest pytest-subtests
shell: bash
- name: Python Test
run: |
cd python/tests
pytest
- name: Python Test with Coverage
if: contains(matrix.os, 'ubuntu')
run: |
pip install pytest-cov
cd python/tests
pytest --cov=fast_matrix_market --cov-report term --cov-report=xml
- name: Upload Coverage to Codecov
if: ${{ contains(matrix.os, 'ubuntu') && !contains(matrix.python-version, 'pypy') }}
uses: codecov/codecov-action@v3
with:
gcov: true
gcov_include: include/* # C++ coverage
# directory: python/tests # Python coverage. This seems to confuse codecov, disable for now.
#################################################################################
linux_32bit:
name: Tests on 32-bit Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- 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"