Add support for building on Windows with Ninja #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Main | |
on: | |
push: | |
branches: [ master, develop**, ci ] | |
tags: | |
- '*' | |
pull_request: | |
branches: [ master, develop** ] | |
jobs: | |
build_and_test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-11, windows-latest] | |
python-version: [3.9] | |
cmake_flags: ['', '-DUNITTESTS=ON -DCOVERAGE=ON'] | |
cmake_flags_extra: ['', '-DENABLE_MKL_PARDISO=OFF', '-DDFLOAT=ON', '-DDLONG=OFF', '-DEMBEDDED=1', | |
'-DEMBEDDED=2', '-DPROFILING=OFF', '-DCTRLC=OFF', '-DPRINTING=OFF'] | |
exclude: | |
- cmake_flags: '-DUNITTESTS=ON -DCOVERAGE=ON' | |
cmake_flags_extra: '-DEMBEDDED=1' | |
- cmake_flags: '-DUNITTESTS=ON -DCOVERAGE=ON' | |
cmake_flags_extra: '-DEMBEDDED=2' | |
include: | |
- os: ubuntu-latest | |
cmake_generator: "Unix Makefiles" | |
- os: macos-11 | |
cmake_generator: "Unix Makefiles" | |
- os: windows-latest | |
cmake_generator: "MinGW Makefiles" | |
defaults: | |
run: | |
# Required when using an activated conda environment in steps | |
# See https://github.com/conda-incubator/setup-miniconda#IMPORTANT | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
lfs: false | |
submodules: recursive | |
- name: Set up conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
# ----------------- | |
# OS-specific setup | |
# ----------------- | |
- name: Setup (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
echo "LD_LIBRARY_PATH=$CONDA_PREFIX/lib" >> $GITHUB_ENV | |
- name: Setup (macOS) | |
if: runner.os == 'macOS' | |
# Newer versions of MacOS effectively block DYLD_LIBRARY_PATH being set (System Integrity Protection) | |
# Explicitly setting RPATH using `install_name_tool -add_rpath $CONDA_PREFIX/lib ./build/out/osqp_tester` | |
# doesn't work either. | |
# Here we get around it by using a standard non-root location for .dylib files as a soft link | |
run: | | |
echo "DYLD_LIBRARY_PATH=$CONDA_PREFIX/lib" >> $GITHUB_ENV | |
ln -s $CONDA_PREFIX/lib ~/lib | |
- name: Setup (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
echo "$CONDA_PREFIX/Library/bin" >> $GITHUB_PATH | |
# ----------------- | |
# Fetching mkl from the anaconda channel instead of defaults gives us the MKL runtime dynamic libraries | |
# as well (mkl_rt.<dll/so>), required during the runtime testing steps. | |
# MKL on Anaconda 2021.* seems to have inexplicably renamed mkl_rt.dll to mkl_rt.1.dll, so we insist on | |
# a version earlier than 2021 | |
- name: Install python dependencies | |
run: | | |
conda install -c anaconda "mkl<2021" numpy scipy | |
conda info | |
conda list | |
- name: Build | |
run: | | |
cmake -G "${{ matrix.cmake_generator }}" -S . -B build ${{ matrix.cmake_flags }} ${{ matrix.cmake_flags_extra }} | |
cmake --build build | |
# useful for inspecting the OSQP version information | |
- name: OSQP Demo | |
run: | | |
./build/out/osqp_demo | |
if: ${{ !contains(matrix.cmake_flags_extra, 'EMBEDDED') }} | |
- name: Test | |
run: | | |
./build/out/osqp_tester | |
if: ${{ matrix.cmake_flags == '-DUNITTESTS=ON -DCOVERAGE=ON' }} | |
- name: Valgrid check | |
run: | | |
sudo apt-get install valgrind | |
valgrind --suppressions=.valgrind-suppress.supp --leak-check=full --gen-suppressions=all \ | |
--track-origins=yes --error-exitcode=1 build/out/osqp_tester | |
if: ${{ runner.os == 'Linux' && matrix.cmake_flags == '-DUNITTESTS=ON -DCOVERAGE=ON' && matrix.cmake_flags_extra == '-DENABLE_MKL_PARDISO=OFF' }} | |
- name: Generate coverage | |
uses: imciner2/run-lcov@v1 | |
with: | |
input_directory: '${{ runner.workspace }}/osqp/build' | |
exclude: '"$GITHUB_WORKSPACE/tests/*" "$GITHUB_WORKSPACE/lin_sys/direct/qdldl/amd/*" "$GITHUB_WORKSPACE/lin_sys/direct/qdldl/qdldl_sources/*" "/usr/include/*"' | |
output_file: '${{ runner.workspace }}/osqp/build/coverage.info' | |
if: ${{ runner.os == 'Linux' && matrix.cmake_flags == '-DUNITTESTS=ON -DCOVERAGE=ON' && matrix.cmake_flags_extra == '' }} | |
- name: Coveralls | |
uses: coverallsapp/github-action@master | |
with: | |
path-to-lcov: '${{ runner.workspace }}/osqp/build/coverage.info' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
if: ${{ runner.os == 'Linux' && matrix.cmake_flags == '-DUNITTESTS=ON -DCOVERAGE=ON' && matrix.cmake_flags_extra == '' }} |