Test Multiple Python Versions #17
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: build-and-test | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- "**" | |
concurrency: | |
group: build-and-test-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
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 pip dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pyyaml pygccxml castxml | |
- name: Set PYTHONPATH | |
run: | | |
echo "PYTHONPATH=${{ github.workspace }}/cppwg:$PYTHONPATH" >> ${GITHUB_ENV} | |
- name: Test wrapper generation | |
run: python -m unittest tests/test_shapes.py | |
- name: Generate new wrappers | |
run: | | |
rm -rf shapes/wrapper/geometry \ | |
shapes/wrapper/math_funcs \ | |
shapes/wrapper/primitives | |
python shapes/wrapper/generate.py \ | |
--source_root shapes/src/ \ | |
--wrapper_root shapes/wrapper/ \ | |
--castxml_binary $(which castxml) \ | |
--package_info shapes/wrapper/package_info.yaml \ | |
--includes shapes/src/ | |
- name: Build Python module | |
run: | | |
cd shapes | |
mkdir build | |
cd build | |
cmake .. | |
make -j $(nproc) | |
- name: Test built module | |
run: | | |
cd shapes/build | |
python -m unittest test_functions.py | |
python -m unittest test_classes.py |