Expand example #126
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: build-and-test | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- "**" | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
concurrency: | |
group: build-and-test-${{ github.ref }}-${{ matrix.python-version }} | |
cancel-in-progress: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install build dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install cmake | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install cppwg | |
run: | | |
python -m pip install --upgrade pip | |
pip install .[dev] | |
- name: Lint with flake8 | |
run: python -m flake8 | |
- name: Test wrapper generation | |
run: python -m unittest test/test_wrapper_generation.py | |
- name: Generate new wrappers | |
run: | | |
cd examples/shapes/wrapper | |
rm -rf geometry math_funcs primitives | |
cd .. | |
cppwg src/cpp \ | |
--wrapper_root wrapper/ \ | |
--package_info wrapper/package_info.yaml \ | |
--includes src/cpp/*/ \ | |
--std c++17 \ | |
--logfile cppwg.log | |
- name: Check for new classes | |
run: | | |
cd examples/shapes | |
cat cppwg.log | grep "Unknown class" | |
- name: Build Python module | |
run: | | |
cd examples/shapes | |
mkdir build | |
cd build | |
cmake .. | |
make -j $(nproc) | |
- name: Test built module | |
run: | | |
cd examples/shapes/build | |
python -m unittest test_functions.py | |
python -m unittest test_classes.py |