Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python 3.10 and 3.11 #13

Merged
merged 6 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 51 additions & 38 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
# Weekly build to make sure dependencies are OK
- cron: '30 14 * * 3'
workflow_dispatch:
inputs:
guard:
Expand All @@ -17,10 +20,10 @@ on:

jobs:
Source:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true

Expand All @@ -29,83 +32,94 @@ jobs:

- name: Generate source distribution tarball
run: python3 setup.py sdist

- name: Build source distribution
run: |
sudo apt-get install -y libboost-system-dev libboost-thread-dev libeigen3-dev ninja-build
pip3 install wheel
pip3 wheel dist/*.tar.gz

- name: Upload Build Artifact
uses: actions/upload-artifact@v2.1.4
uses: actions/upload-artifact@v3
with:
name: source-build
path: "dist/*.tar.gz"

Linux:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: Source


strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true

- name: Pull builder image
run: docker pull quay.io/pypa/manylinux2014_x86_64

- name: Python version
run: python --version

- name: Build wheels
run: tools/build/build-wheels.sh
run: tools/build/build-wheels.sh ${{ matrix.python }}

- name: Upload Build Artifact
uses: actions/upload-artifact@v2.1.4
uses: actions/upload-artifact@v3
with:
name: linux-build
path: "dist/*.whl"

MacOS:
runs-on: macos-10.15
runs-on: macos-12
needs: Source

strategy:
matrix:
python: [3.8, 3.9]
python: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install dependencies
run: |
brew install python@${{ matrix.python }} eigen boost
brew link --overwrite python@${{ matrix.python }}
pip3 install cmake ninja wheel

brew install eigen boost
pip install cmake ninja wheel

- name: Build
run: python3 setup.py bdist_wheel
run: python setup.py bdist_wheel

- name: Upload Build Artifact
uses: actions/upload-artifact@v2.1.4
uses: actions/upload-artifact@v3
with:
name: macos-build
path: "dist/*.whl"

Windows:
runs-on: windows-2019
runs-on: windows-2022
needs: Source

strategy:
matrix:
python: [3.6, 3.7, 3.8, 3.9]
python: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

Expand All @@ -128,28 +142,28 @@ jobs:
CMAKE_TOOLCHAIN_FILE: "C:/vcpkg/scripts/buildsystems/vcpkg.cmake"

- name: Upload Build Artifact
uses: actions/upload-artifact@v2.1.4
uses: actions/upload-artifact@v3
with:
name: win-build
path: "dist/*.whl"

Publish:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs: [Source, Linux, MacOS, Windows]
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.guard == 'do-release' }}

steps:
- uses: actions/download-artifact@v2
steps:
- uses: actions/download-artifact@v3

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.8'

- name: Check match between the build version and the current git tag
run: |
sudo apt-get install -y jq
pip3 install wheel-inspect

export TAG=$(echo ${{ github.ref }} | cut -d/ -f3)
python3 -m wheel_inspect *-build/*.whl | jq .version | grep ^\\\"$TAG\\\"$

Expand All @@ -162,14 +176,13 @@ jobs:
run: |
pip3 install setuptools
pip3 install twine

python3 -m twine check source-build/*
python3 -m twine check linux-build/*
python3 -m twine check macos-build/*
python3 -m twine check win-build/*

python3 -m twine upload --skip-existing --repository-url ${{ github.event.inputs.repository_url }} source-build/*
python3 -m twine upload --skip-existing --repository-url ${{ github.event.inputs.repository_url }} linux-build/*
python3 -m twine upload --skip-existing --repository-url ${{ github.event.inputs.repository_url }} macos-build/*
python3 -m twine upload --skip-existing --repository-url ${{ github.event.inputs.repository_url }} win-build/*

21 changes: 11 additions & 10 deletions tools/build/build-wheels.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash
set -ex

DOCKER=docker
PYVERSION=${1?"Error: expected the python version"}

# Prefer running with podman
DOCKER=docker
if which podman
then
DOCKER=podman
Expand All @@ -13,21 +14,21 @@ fi
if [ ! -d /opt/python ]
then
# We are not in the image, start the image with the build script
$DOCKER run --rm -v $(realpath $(dirname $0)/../..):/io quay.io/pypa/manylinux2014_x86_64 /io/tools/build/build-wheels.sh
$DOCKER run --rm -v $(realpath $(dirname $0)/../..):/io quay.io/pypa/manylinux2014_x86_64 /io/tools/build/build-wheels.sh $PYVERSION
else
# We are in the image, building!
PYVERCL=${PYVERSION//./}
# Bins located in paths similar to /opt/python/cp38-cp38/bin
PYBIN="/opt/python/cp${PYVERCL}-cp${PYVERCL}/bin"
echo "Using python path $PYBIN"

yum install -y boost-devel eigen3-devel

cd /io

PREV_PATH=$PATH

for PYBIN in /opt/python/cp{36,37,38,39}*/bin; do
PATH=${PYBIN}:$PREV_PATH
rm -rf build/
"${PYBIN}/pip" install -U "setuptools>=42" wheel ninja "cmake>=3.12"
"${PYBIN}/python" setup.py bdist_wheel
done
PATH=${PYBIN}:$PATH
"${PYBIN}/pip" install -U "setuptools>=42" wheel ninja "cmake>=3.12"
"${PYBIN}/python" setup.py bdist_wheel

WHEELS=$(echo dist/*.whl)

Expand Down
Loading