Skip to content
Open
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
206 changes: 156 additions & 50 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,168 @@ name: Python

on:
push:
branches: [ python ]
tags: [ py* ]
branches: [ master, python ]
tags: [ v* ]

jobs:
python-build:
strategy:
matrix:
pyver:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
python-sdist:
name: python sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: git submodule update --init extlib/mimalloc extlib/eigen
- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.pyver }}
- name: Build and test
working-directory: cython
run: |
python -m pip install -U pip setuptools wheel build
python -m pip install -e .
python -m unittest
python-version: "3.10"
- name: Pack
working-directory: cython
run: python -m build
- if: matrix.os == 'ubuntu-latest'
name: Upload artifact
uses: actions/upload-artifact@v2
shell: bash
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
version="${GITHUB_REF##*/}"
else
# version="$(git describe --tags).dev${GITHUB_RUN_NUMBER}"
version="3.1.0.dev${GITHUB_RUN_NUMBER}"
fi
sed -i.bak "s/^version = .*/version = \"${version}\"/g" pyproject.toml && rm pyproject.toml.bak
python -m pip install -U setuptools build
python -m build --sdist
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-py${{ matrix.pyver }}
name: sdist
path: cython/dist/*.tar.gz
- if: matrix.os != 'ubuntu-latest'
name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}-py${{ matrix.pyver }}
path: cython/dist/*.whl
- if: startsWith(github.ref, 'refs/tags/py')
run: python -m pip install twine
- if: startsWith(github.ref, 'refs/tags/py') && matrix.os == 'ubuntu-latest'
name: release
working-directory: cython
run: python -m twine upload "dist/*.tar.gz" --skip-existing
- if: startsWith(github.ref, 'refs/tags/py') && matrix.os != 'ubuntu-latest'
name: release
working-directory: cython
run: python -m twine upload "dist/*.whl" --skip-existing
python-wheel:
name: ${{ matrix.os_short }} python ${{ matrix.architecture }} cp${{ matrix.python_version }}
runs-on: ${{ matrix.os }}
timeout-minutes: 240
strategy:
fail-fast: false
matrix:
os_arch: [
"windows-ia32",
"windows-x64",
# "windows-arm64",
"macos-x86_64",
"macos-arm64",
"linux-x86_64",
"linux-aarch64",
]
python_version: [
"37",
"38",
"39",
"310",
"311",
]
exclude:
- os_arch: "macos-arm64"
python_version: "37"
include:
- os_arch: "windows-ia32"
os: "windows-2022"
os_short: "windows"
architecture: "ia32"
cibuildwheel_architecture: "x86"
cmake_generator_platform: "Win32"
- os_arch: "windows-x64"
os: "windows-2022"
os_short: "windows"
architecture: "x64"
cibuildwheel_architecture: "AMD64"
cmake_generator_platform: "x64"
# - os_arch: "windows-arm64"
# os: "windows-2022"
# os_short: "windows"
# architecture: "arm64"
# cibuildwheel_architecture: "ARM64"
# cmake_generator_platform: "ARM64"
- os_arch: "macos-x86_64"
os: "macos-11.0"
os_short: "macos"
cibuildwheel_architecture: "x86_64"
architecture: "x86_64"
- os_arch: "macos-arm64"
os: "macos-11.0"
os_short: "macos"
cibuildwheel_architecture: "arm64"
architecture: "arm64"
- os_arch: linux-x86_64
os: "ubuntu-22.04"
os_short: "linux"
cibuildwheel_architecture: "x86_64"
architecture: "x86_64"
- os_arch: linux-aarch64
os: "ubuntu-22.04"
os_short: "linux"
cibuildwheel_architecture: "aarch64"
architecture: "aarch64"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git submodule update --init extlib/mimalloc extlib/eigen
- name: Set version
shell: bash
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
version="${GITHUB_REF##*/}"
else
# version="$(git describe --tags).dev${GITHUB_RUN_NUMBER}"
version="3.1.0.dev${GITHUB_RUN_NUMBER}"
fi
cd cython && sed -i.bak "s/^version = .*/version = \"${version}\"/g" pyproject.toml && rm pyproject.toml.bak
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: matrix.architecture == 'aarch64'
with:
platforms: arm64
- name: Build wheels
uses: pypa/cibuildwheel@v2.11.2
with:
package-dir: cython
env:
CIBW_BUILD: "cp${{ matrix.python_version }}-*"
CIBW_PLATFORM: "${{ matrix.os_short }}"
CIBW_BUILD_VERBOSITY: "1"
CIBW_ARCHS: "${{ matrix.cibuildwheel_architecture }}"
CIBW_ENVIRONMENT_WINDOWS: >
CMAKE_GENERATOR="Visual Studio 17 2022"
CMAKE_GENERATOR_PLATFORM="${{ matrix.cmake_generator_platform }}"
CIBW_ENVIRONMENT_PASS_WINDOWS: "CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM"
CIBW_ENVIRONMENT_LINUX: >
CMAKE_GENERATOR="Unix Makefiles"
CIBW_ENVIRONMENT_PASS_LINUX: "CMAKE_GENERATOR"
- uses: actions/upload-artifact@v3
with:
name: wheel-${{ matrix.os_short }}-${{ matrix.architecture }}
path: |
./wheelhouse/*.whl
publish-pypi:
name: publish to PyPi
needs: [
python-sdist,
python-wheel,
]
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v3
with:
path: prebuilds
- name: prepare
shell: bash
run: |
mkdir dist
ls prebuilds
mv prebuilds/*/* dist
ls dist
- name: Publish wheels to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish wheels to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
8 changes: 4 additions & 4 deletions cython/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
/debian/libslvs1-dev/
/obj-*/
/*.slvs
python_solvespace/*.cpp
python_solvespace/src/
python_solvespace/include/
python_solvespace/extlib/
solvespace/*.cpp
solvespace/src/
solvespace/include/
solvespace/extlib/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
Loading