Skip to content

Trial using poetry for package build #31

Trial using poetry for package build

Trial using poetry for package build #31

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches: [ "master", "testing" ]
#pull_request:
# branches: [ "testing" ]
jobs:
build:
strategy:
matrix:
# windows requires special handling with sudo make install...
os: [ubuntu-latest, macos-latest]
# os: [ubuntu-latest, macos-latest, windows-latest]
# python-version: ["3.7", "3.8", "3.9", "3.10", pypy-2.7, pypy-3.8]
python-version: ["3.10"]
# exclude:
# - os: macos-latest
# python-version: "3.10"
# - os: windows-latest
# python-version: "3.10"
fail-fast: true
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install C++ headers
run: |
mkdir -p build && cd build
cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_PREFIX_PATH=/usr/local -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ..
sudo make install
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
cd bindings/python/cinterop
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f tests/requirements.txt ]; then pip install -r tests/requirements.txt; fi
#- name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Compile native code for the unit tests
run: |
cd bindings/python/cinterop/tests/test_native_library
cmake -Bbuild .
cmake --build build
- name: Test with pytest
run: |
cd bindings/python/cinterop
pytest tests/ --cov=cinterop --cov-report=xml
# - name: Mypy type check
# run: poetry run mypy .
- name: Use Codecov to track coverage
if: matrix.os == 'linux' && matrix.python-version == '3.10'
uses: codecov/codecov-action@v3
with:
files: coverage.xml # coverage report