From ce998c3ab4c52808935c2101aa96bbe5f6c0464f Mon Sep 17 00:00:00 2001 From: Alex Kaszynski Date: Tue, 2 Jan 2024 18:42:08 -0700 Subject: [PATCH 1/8] support building python 3.12 --- .github/workflows/build-and-deploy.yml | 35 +++++++++++--------------- pyproject.toml | 2 +- setup.py | 2 +- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 403af21..5b50bd9 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -21,7 +21,7 @@ jobs: os: [ubuntu-latest, windows-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: 'recursive' @@ -72,12 +72,12 @@ jobs: 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 @@ -86,19 +86,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 @@ -109,23 +111,16 @@ jobs: # upload to PyPI on every tag if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') 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 diff --git a/pyproject.toml b/pyproject.toml index 425c102..cd391ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/setup.py b/setup.py index 1bbc4af..6fd6c5d 100644 --- a/setup.py +++ b/setup.py @@ -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++', From 0ff0a48d8915740f0259b939b2d0c6600d36ee84 Mon Sep 17 00:00:00 2001 From: Alex Kaszynski Date: Tue, 2 Jan 2024 18:42:27 -0700 Subject: [PATCH 2/8] add validation of gh workflow files --- .pre-commit-config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..d62a15c --- /dev/null +++ b/.pre-commit-config.yaml @@ -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 From e4c628578203d683d981ce36e45743f32d013037 Mon Sep 17 00:00:00 2001 From: Alex Kaszynski Date: Tue, 2 Jan 2024 19:05:57 -0700 Subject: [PATCH 3/8] add in ninja build --- .github/workflows/build-and-deploy.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 5b50bd9..fe67cf6 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -32,6 +32,8 @@ jobs: arch: x64 toolset: 14.36.32532 + - uses: seanmiddleditch/gha-setup-ninja@master + - name: Cache gflags build if: matrix.os == 'windows-latest' id: cache-gflags @@ -110,6 +112,8 @@ 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 From 351df2de157c27e14bb2d089915ef7a9b1e70109 Mon Sep 17 00:00:00 2001 From: Alex Kaszynski Date: Tue, 2 Jan 2024 19:19:47 -0700 Subject: [PATCH 4/8] move ninja install to after eigen --- .github/workflows/build-and-deploy.yml | 30 +++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index fe67cf6..697f7f5 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -32,21 +32,6 @@ jobs: arch: x64 toolset: 14.36.32532 - - uses: seanmiddleditch/gha-setup-ninja@master - - - 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 - - name: Cache OpenCV build if: matrix.os == 'windows-latest' id: cache-opencv @@ -73,6 +58,21 @@ jobs: run: graph-cut-ransac/scripts/build-eigen3.ps1 shell: pwsh + - uses: seanmiddleditch/gha-setup-ninja@master + + - 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 + - name: Build wheels uses: pypa/cibuildwheel@v2.16.2 env: From a3fe01c9f279b8a901d234d5df4dc7efc24259cb Mon Sep 17 00:00:00 2001 From: Alex Kaszynski Date: Tue, 2 Jan 2024 19:23:10 -0700 Subject: [PATCH 5/8] just use choco --- .github/workflows/build-and-deploy.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 697f7f5..6e48d62 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -32,6 +32,9 @@ jobs: arch: x64 toolset: 14.36.32532 + - name: Install Ninja + run: choco install ninja + - name: Cache OpenCV build if: matrix.os == 'windows-latest' id: cache-opencv @@ -58,8 +61,6 @@ jobs: run: graph-cut-ransac/scripts/build-eigen3.ps1 shell: pwsh - - uses: seanmiddleditch/gha-setup-ninja@master - - name: Cache gflags build if: matrix.os == 'windows-latest' id: cache-gflags From 8a8371c4310139514f6416a0427b4ddcf329e4b9 Mon Sep 17 00:00:00 2001 From: Alex Kaszynski Date: Tue, 2 Jan 2024 19:27:50 -0700 Subject: [PATCH 6/8] choco only on windows --- .github/workflows/build-and-deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 6e48d62..17f3fcb 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -33,6 +33,7 @@ jobs: toolset: 14.36.32532 - name: Install Ninja + if: matrix.os == 'windows-latest' run: choco install ninja - name: Cache OpenCV build From 39bfed0fab3fb991c53027e087205001a85ffe6a Mon Sep 17 00:00:00 2001 From: Alex Kaszynski Date: Tue, 2 Jan 2024 19:56:49 -0700 Subject: [PATCH 7/8] install ninja right before building gflags --- .github/workflows/build-and-deploy.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 17f3fcb..e1dbe52 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -32,10 +32,6 @@ jobs: arch: x64 toolset: 14.36.32532 - - name: Install Ninja - if: matrix.os == 'windows-latest' - run: choco install ninja - - name: Cache OpenCV build if: matrix.os == 'windows-latest' id: cache-opencv @@ -72,7 +68,9 @@ jobs: - name: Build gflags on Windows if: matrix.os == 'windows-latest' && steps.cache-gflags.outputs.cache-hit != 'true' - run: scripts/build-gflags.ps1 + run: | + choco install ninja + scripts/build-gflags.ps1 shell: pwsh - name: Build wheels From e3e97f327d89f8048eef37a16001e74abe55c4cc Mon Sep 17 00:00:00 2001 From: Alex Kaszynski Date: Tue, 2 Jan 2024 19:59:35 -0700 Subject: [PATCH 8/8] use v14 for MSVC --- .github/workflows/build-and-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index e1dbe52..7d91918 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -30,7 +30,7 @@ jobs: uses: TheMrMilchmann/setup-msvc-dev@v2.0.1 with: arch: x64 - toolset: 14.36.32532 + toolset: "14" - name: Cache OpenCV build if: matrix.os == 'windows-latest'