Skip to content

Support Python 3.12 #14

Support Python 3.12

Support Python 3.12 #14

name: Build and upload
on:
pull_request:
push:
tags:
- "*"
branches:
- "master"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
MSVC_TOOLSET_VERSION: "14"
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Setup MSVC Developer Command Prompt
if: matrix.os == 'windows-latest'
uses: TheMrMilchmann/[email protected]
with:
arch: x64
toolset: ${{ env.MSVC_TOOLSET_VERSION }}
- name: Cache OpenCV build
if: matrix.os == 'windows-latest'
id: cache-opencv
uses: actions/cache@v3
with:
path: D:/a/graph-cut-ransac/graph-cut-ransac/opencv
key: opencv3-4-5-${{ runner.os }}-${{ env.MSVC_TOOLSET_VERSION }}-${{ hashFiles('scripts/build-opencv.ps1') }}
- name: Build OpenCV on Windows
if: matrix.os == 'windows-latest' && steps.cache-opencv.outputs.cache-hit != 'true'
run: scripts/build-opencv.ps1
shell: pwsh
- name: Cache Eigen3 build
if: matrix.os == 'windows-latest'
id: cache-eigen3
uses: actions/cache@v3
with:
path: C:/eigen3
key: eigen3-${{ runner.os }}-${{ hashFiles('scripts/build-eigen3.ps1') }}
- name: Install Eigen3 on Windows
if: matrix.os == 'windows-latest' && steps.cache-eigen3.outputs.cache-hit != 'true'
run: scripts/build-eigen3.ps1
shell: pwsh
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ENVIRONMENT_WINDOWS: 'OpenCV_DIR="D:/a/graph-cut-ransac/graph-cut-ransac/opencv/build" Eigen3_DIR="C:/eigen3"'
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel} --add-path D:/a/graph-cut-ransac/graph-cut-ransac/opencv/build/bin"
- uses: actions/upload-artifact@v4
with:
name: pygcransac-wheels-${{ runner.os }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Build
run: |
rm -rf build # remove conflicting directory
pipx run build --sdist
- name: Validate
run: |
pip install twine
twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: pygcransac-sdist
path: dist/*.tar.gz
upload_pypi:
name: Release and upload to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
id-token: write # this permission is mandatory for trusted publishing
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v4
- name: Display structure of downloaded files
run: ls -R
- name: Flatten directory structure
run: |
mkdir -p dist/
find . -name '*.whl' -exec mv {} dist/ \;
find . -name '*.tar.gz' -exec mv {} dist/ \;
- name: Display final structure
run: ls -R
- name: Upload to Public PyPi
uses: pypa/gh-action-pypi-publish@release/v1
- name: Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
files: |
./**/*.whl