Skip to content

Commit

Permalink
Merge pull request #32 from danini/feat/support-python-3.12
Browse files Browse the repository at this point in the history
Add Python 3.12 build
  • Loading branch information
akaszynski authored Jan 4, 2024
2 parents 4a9bbca + e3e97f3 commit db121cf
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 36 deletions.
67 changes: 33 additions & 34 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
os: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'

Expand All @@ -30,20 +30,7 @@ jobs:
uses: TheMrMilchmann/setup-msvc-dev@v2.0.1
with:
arch: x64
toolset: 14.36.32532

- name: Cache gflags build
if: matrix.os == 'windows-latest'
id: cache-gflags
uses: actions/cache@v3
with:
path: D:/a/magsac/magsac/gflags/build_
key: opencv-${{ runner.os }}-${{ hashFiles('scripts/build-gflags.ps1') }}

- name: Build gflags on Windows
if: matrix.os == 'windows-latest' && steps.cache-gflags.outputs.cache-hit != 'true'
run: scripts/build-gflags.ps1
shell: pwsh
toolset: "14"

- name: Cache OpenCV build
if: matrix.os == 'windows-latest'
Expand Down Expand Up @@ -71,13 +58,28 @@ jobs:
run: graph-cut-ransac/scripts/build-eigen3.ps1
shell: pwsh

- name: Cache gflags build
if: matrix.os == 'windows-latest'
id: cache-gflags
uses: actions/cache@v3
with:
path: D:/a/magsac/magsac/gflags/build_
key: opencv-${{ runner.os }}-${{ hashFiles('scripts/build-gflags.ps1') }}

- name: Build gflags on Windows
if: matrix.os == 'windows-latest' && steps.cache-gflags.outputs.cache-hit != 'true'
run: |
choco install ninja
scripts/build-gflags.ps1
shell: pwsh

- name: Build wheels
uses: pypa/cibuildwheel@v2.14.1
uses: pypa/cibuildwheel@v2.16.2
env:
CIBW_ENVIRONMENT_WINDOWS: 'OpenCV_DIR="D:/a/magsac/magsac/opencv/build" Eigen3_DIR="C:/eigen3" gflags_DIR=D:/a/magsac/magsac/gflags/build_'
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel} --add-path D:/a/magsac/magsac/opencv/build/bin"

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: pymagsac-wheels-${{ runner.os }}
path: ./wheelhouse/*.whl
Expand All @@ -86,19 +88,21 @@ jobs:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Build
run: pipx run build --sdist
run: |
rm -rf build # remove conflicting directory
pipx run build --sdist
- name: Validate
run: |
pip install twine
twine check dist/*
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: pygcransac-sdist
path: dist/*.tar.gz
Expand All @@ -108,24 +112,19 @@ jobs:
runs-on: ubuntu-latest
# upload to PyPI on every tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
permissions:
id-token: write # this permission is mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

# Download all artifacts
- uses: actions/download-artifact@v3
- name: Flatten directory structure
run: |
mkdir -p dist/
find . -name '*.whl' -exec mv {} dist/ \;
find . -name '*.tar.gz' -exec mv {} dist/ \;
- name: Upload to Public PyPi
run: |
pip install twine
twine upload --skip-existing ./**/*.whl
twine upload --skip-existing ./**/*.tar.gz
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
uses: pypa/gh-action-pypi-publish@release/v1

- name: Release
uses: softprops/action-gh-release@v1
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repos:
# Validate github workflow files
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.3
hooks:
- id: check-github-workflows
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ testpaths = 'tests'

[tool.cibuildwheel]
archs = ["auto64"] # 64-bit only
build = "cp38-* cp39-* cp310-* cp311-*" # Only build Python 3.8-3.11 wheels
build = "cp38-* cp39-* cp310-* cp311-* cp312-*" # Only build Python 3.8-3.12 wheels
skip = ["pp*", "*musllinux*"] # disable PyPy and musl-based wheels
manylinux-x86_64-image = "ghcr.io/akaszynski/manylinux2014-centos7-opencv/manylinux2014_x86_64_opencv3:v3.4.5.1"
test-requires = "pytest"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

setup(
name='pymagsac',
version='0.2.0',
version='0.3.dev0',
author='Daniel Barath, Dmytro Mishkin',
author_email='barath.daniel@sztaki.hu',
description='MAGSAC and MAGSAC++',
Expand Down

0 comments on commit db121cf

Please # to comment.