Test cases for shared library interface (#33) #288
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
# This workflow builds and tests svZeroDSolver. The Python version is tested on | |
# ubuntu and the C++ version is built and tested on different versions of | |
# ubuntu and macOS. | |
name: Build and test | |
on: [push, pull_request] | |
jobs: | |
cpp: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install ubuntu dependencies | |
if: ${{ matrix.os == 'ubuntu-*' }} | |
run: sudo apt update && sudo apt install build-essential cmake | |
- name: Install svZeroDPlus | |
run: | | |
conda create -n zerod python=3.9 | |
conda run -n zerod pip install pytest pytest-cov pytest-mock | |
conda run -n zerod pip install -e . | |
- name: Test the build | |
run: | | |
conda run -n zerod pytest tests/test_integration_cpp.py | |
- name: Build using CMake | |
run: | | |
mkdir Release | |
cd Release | |
cmake -DCMAKE_BUILD_TYPE=Release .. | |
cmake --build . | |
- name: Test interface | |
run: | | |
cd tests/test_interface | |
mkdir build_tests | |
cd build_tests | |
cmake ../ | |
make | |
cd test_01 | |
./svZeroD_interface_test01 ../../../../Release ../../test_01/svzerod_3Dcoupling.json | |
cd ../test_02 | |
./svZeroD_interface_test02 ../../../../Release ../../test_02/svzerod_tuned.json | |
python: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up environment | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
conda create -n zerod python=3.9 | |
conda run -n zerod pip install pytest pytest-cov pytest-mock | |
conda run -n zerod pip install -e . | |
- name: Run pytest | |
run: | | |
conda run -n zerod pytest tests/test_integration.py | |
- name: Save coverage report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage_report | |
path: htmlcov | |