Merge branch '34-optimise-dotty-grid-point-detector' #15
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Test | |
| on: | |
| push: | |
| branches: ["*"] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: [master, main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # ========================================================================= | |
| # C++ tests (quick feedback, no wheel building) | |
| # ========================================================================= | |
| test-cpp: | |
| name: C++ Tests (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Cache CMake FetchContent | |
| uses: actions/cache@v5 | |
| with: | |
| path: build/_deps | |
| key: deps-${{ matrix.os }}-${{ hashFiles('CMakeLists.txt') }} | |
| restore-keys: | | |
| deps-${{ matrix.os }}- | |
| - name: Configure | |
| run: cmake -B build -DBUILD_TESTING=ON -DBUILD_PYTHON_BINDINGS=OFF -DCMAKE_BUILD_TYPE=Release | |
| - name: Build | |
| run: cmake --build build --config Release --parallel | |
| - name: Test | |
| run: ctest --test-dir build --build-config Release --output-on-failure | |
| # ========================================================================= | |
| # Build wheels: Python 3.9-3.13 on all platforms | |
| # Only runs on tagged releases or manual dispatch. | |
| # 3.9 and 3.10 are optional (failures don't block the overall build) | |
| # ========================================================================= | |
| build-wheels: | |
| name: Wheels ${{ matrix.python.version }} (${{ matrix.os }})${{ matrix.python.optional && ' [optional]' || '' }} | |
| if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' | |
| needs: [test-cpp] | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: ${{ matrix.python.optional }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python: | |
| - { version: "cp313", optional: false } | |
| - { version: "cp312", optional: false } | |
| - { version: "cp311", optional: false } | |
| - { version: "cp310", optional: true } | |
| - { version: "cp39", optional: true } | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: pypa/cibuildwheel@v2.21 | |
| env: | |
| CIBW_BUILD: "${{ matrix.python.version }}-*" | |
| CIBW_BUILD_VERBOSITY: 1 | |
| CIBW_TEST_COMMAND: "python -c \"import sksurgeryopencvpython; print('Import OK')\"" | |
| - uses: actions/upload-artifact@v7 | |
| if: success() | |
| with: | |
| name: wheels-${{ matrix.os }}-${{ matrix.python.version }} | |
| path: wheelhouse/*.whl | |
| # ========================================================================= | |
| # Publish to PyPI on tagged release | |
| # ========================================================================= | |
| publish: | |
| name: Publish to PyPI | |
| needs: [build-wheels] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| environment: pypi | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| pattern: wheels-* | |
| path: dist | |
| merge-multiple: true | |
| - uses: pypa/gh-action-pypi-publish@release/v1 |