python: wheel: specify Python version as exclusive range to avoid bui… #194
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: Test Matrix | |
on: | |
push: | |
paths-ignore: | |
- 'docs/**' | |
- appveyor.yml | |
- readme.* | |
- README.* | |
- '*.md' | |
- '*.svg' | |
- '*.png' | |
branches: [ "master" ] | |
pull_request: | |
paths-ignore: | |
- 'docs/**' | |
- appveyor.yml | |
- readme.* | |
- README.* | |
- '*.md' | |
- '*.svg' | |
- '*.png' | |
branches: [ "master", "v2" ] | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
CC: gcc | |
CXX: g++ | |
jobs: | |
build: | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
os: [ubuntu-20.04] | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ${{matrix.os}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
bash ./scripts/install-dependencies.sh ${{github.workspace}} ${{matrix.python-version}} | |
- name: Configure CMake | |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
run: | | |
source "${{github.workspace}}/miniconda/etc/profile.d/conda.sh" | |
hash -r | |
conda activate test-environment | |
cmake -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -B build -S . -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/miniconda/envs/test-environment -DBAG_BUILD_TESTS:BOOL=ON -DBAG_BUILD_PYTHON:BOOL=ON | |
- name: Build | |
# Build your program with the given configuration | |
run: | | |
source "${{github.workspace}}/miniconda/etc/profile.d/conda.sh" | |
hash -r | |
conda activate test-environment | |
export CC=${{env.CC}} | |
export CXX=${{env.CXX}} | |
cmake --build build | |
- name: Install | |
# Install into conda environment | |
run: | | |
source "${{github.workspace}}/miniconda/etc/profile.d/conda.sh" | |
hash -r | |
conda activate test-environment | |
cmake --install build | |
python ./build/api/swig/python/setup.py install | |
- name: Tests | |
# Execute C++ and Python tests | |
run: | | |
source "${{github.workspace}}/miniconda/etc/profile.d/conda.sh" | |
hash -r | |
conda activate test-environment | |
BAG_SAMPLES_PATH=${{github.workspace}}/examples/sample-data ./build/tests/bag_tests | |
pytest --cov=bagPy --cov-branch --cov-report=xml --junitxml=python-test-results.xml python/test_*.py |