Skip to content

Added python setup info + building wheels locally + GH Action. #8

Added python setup info + building wheels locally + GH Action.

Added python setup info + building wheels locally + GH Action. #8

Workflow file for this run

name: CI
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
jobs:
cpp_edlib:
name: "Check that CPP edlib correctly builds and passes tests."
strategy:
matrix:
os: [ubuntu-22.04, macos-14]
compiler: [gcc-11, clang-17]
# exclude:
# - os: macos-14
# compiler: gcc-11
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.compiler }} valgrind
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Python packages
run: |
python3 -m pip install --upgrade pip setuptools meson ninja
- name: Set C/CPP compiler to use
run: |
if [ ${{ matrix.compiler }} == "clang-17" ]; then
export CC=clang-17 && export CXX=clang++-17
fi
if [ ${{ matrix.compiler }} == "gcc-11" ]; then
export CC=gcc-11 && export CXX=g++-11
fi
- name: Build binaries and libraries and test them (with Meson)
run: |
make CXXFLAGS="-Werror" LIBRARY_TYPE=static BUILD_DIR=meson-build-static
make CXXFLAGS="-Werror" LIBRARY_TYPE=shared BUILD_DIR=meson-build-shared
# Check for memory leaks.
# I run this only on linux because osx returns errors from
# system libraries, which I would have to supress.
if [ ${{ runner.os }} == "Linux" ]; then
make check-memory-leaks BUILD_DIR=meson-build-static
fi
- name: Build binaries and libraries and test them (with CMake)
run: |
mkdir -p build && cd build
CXXFLAGS="-Werror" cmake -GNinja ..
ninja -v
bin/runTests
python_edlib:
name: "Build, test and possibly deploy python bindings for edlib"
strategy:
matrix:
include:
- os: ubuntu-22.04
deploy-sdist: true
- os: macos-14
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: bindings/python
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Python deps
run: |
python3 -m pip install setuptools cibuildwheel==2.20.0
- name: Build edlib python module
run: |
make build
- name: Test edlib python module
run: |
python3 test.py
- name: Build sdist
run: |
make sdist
- name: Build wheels
run: |
CIBW_SKIP="pp* *-manylinux_i686" \
CIBW_TEST_COMMAND="python3 {project}/test.py" \
python3 -m cibuildwheel --output-dir wheelhouse
- name: Deploy sdist and Linux and Mac wheels to PyPI
if: github.ref_type == 'tag'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python3 -m pip install twine
python3 -m twine upload wheelhouse/*.whl
# While I do want to upload wheels for both Mac and Linux,
# it makes no sense to upload sdist twice.
if [ ${{ matrix.deploy-sdist }} == "true" ]; then
python3 -m twine upload dist/edlib-*.tar.gz
fi