Skip to content

Add cmake and ctest to build and run C++/python tests #104

Add cmake and ctest to build and run C++/python tests

Add cmake and ctest to build and run C++/python tests #104

Workflow file for this run

name: Python and C++ package
on:
pull_request:
push:
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
os: ["ubuntu-latest"]
include:
- python-version: "3.9"
os: "macos-latest"
- python-version: "3.9"
os: "windows-latest"
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install -r requirements.txt
- name: Install testing packages
run: |
pip3 install pytest
pip3 install pytest-cov pytest-xdist codecov
# Below are the added steps for CMake
- name: Setup CMake
uses: jwlawson/actions-setup-cmake@v1.9
with:
cmake-version: 3.21.1
- name: Configure and run CMake
shell: bash
run: |
mkdir test_build
cd test_build
PYTHON_PATH=$(which python)
cmake .. -DCMAKE_BUILD_TYPE=Debug -DPYTHON_EXECUTABLE=${PYTHON_PATH}
cmake --build . --target test
- name: Upload coverage to codecov
uses: codecov/codecov-action@v2