Modernize CI/CD: switch to uv, fix Python 3.11+ compatibility (#576) #120
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 wheels osx/amd64 | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| osx-build: | |
| name: Build wheel for OSX | |
| runs-on: macos-14 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Prepare snap7 archive | |
| uses: ./.github/actions/prepare_snap7 | |
| - name: Prepare files | |
| run: | | |
| cp .github/build_scripts/arm64_osx.mk snap7-full-1.4.2/build/osx/ | |
| cp .github/build_scripts/x86_64_osx.mk snap7-full-1.4.2/build/osx/ | |
| pushd snap7-full-1.4.2/build/osx/ | |
| make -f x86_64_osx.mk all | |
| make -f arm64_osx.mk all | |
| mkdir -p snap7/lib/ | |
| lipo -create -output snap7/lib/libsnap7.dylib ../bin/x86_64-osx/libsnap7.dylib ../bin/arm64-osx/libsnap7.dylib | |
| install_name_tool -id @rpath/libsnap7.dylib snap7/lib/libsnap7.dylib | |
| popd | |
| mkdir -p snap7/lib/ | |
| cp snap7-full-1.4.2/build/osx/snap7/lib/libsnap7.dylib snap7/lib/ | |
| - name: Build wheel | |
| run: | | |
| python3 -m build . --wheel -C="--build-option=--plat-name=macosx_10_9_universal2" | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-osx-universal | |
| path: dist/*.whl | |
| osx-test: | |
| name: Testing wheels for OSX | |
| needs: osx-build | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: ["macos-14", "macos-15"] | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist-osx-universal | |
| path: dist | |
| - name: Install python-snap7 | |
| run: | | |
| uv venv | |
| uv pip install pytest | |
| uv pip install dist/*.whl | |
| # Use --no-project to prevent uv from syncing pyproject.toml, | |
| # which would rebuild from source and lose the bundled snap7 library. | |
| - name: Run tests | |
| run: | | |
| uv run --no-project pytest -m "server or util or client or mainloop" | |
| sudo .venv/bin/pytest -m partner |