Improve API doc (#150) #128
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: Wheel-Builder | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| permissions: {} | |
| jobs: | |
| build_wheels: | |
| name: Build wheel for ${{ matrix.platform }} ${{ matrix.archs }} ${{ matrix.build }} (runs on ${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-24.04] | |
| archs: [x86_64, i686, aarch64, ppc64le, s390x] | |
| build: [manylinux, musllinux] | |
| include: | |
| - os: windows-2022 | |
| archs: AMD64 | |
| - os: windows-2022 | |
| archs: x86 | |
| - os: windows-2022 | |
| archs: ARM64 | |
| - os: macos-13 | |
| archs: x86_64 | |
| - os: macos-14 | |
| archs: arm64 | |
| - os: macos-14 | |
| archs: universal2 | |
| - os: ubuntu-24.04 | |
| platform: android | |
| archs: x86_64 | |
| build: android | |
| - os: macos-14 | |
| platform: android | |
| archs: arm64_v8a | |
| build: android | |
| - os: macos-14 | |
| platform: ios | |
| archs: arm64_iphoneos | |
| - os: macos-14 | |
| platform: ios | |
| archs: arm64_iphonesimulator | |
| - os: macos-13 | |
| platform: ios | |
| archs: x86_64_iphonesimulator | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| - name: Set up QEMU | |
| if: runner.os == 'Linux' && matrix.platform != 'android' | |
| uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0 | |
| # https://github.blog/changelog/2024-04-02-github-actions-hardware-accelerated-android-virtualization-now-available/ | |
| - name: Set up KVM for Android emulation | |
| if: runner.os == 'Linux' && matrix.platform == 'android' | |
| run: | | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@c923d83ad9c1bc00211c5041d0c3f73294ff88f6 # v3.1.4 | |
| with: | |
| output-dir: wheelhouse | |
| env: | |
| CIBW_BUILD: "{cp39,cp310,cp311,cp312,cp313,cp314,cp314t}-${{ matrix.build }}*" | |
| CIBW_PLATFORM: ${{ matrix.platform || 'auto' }} | |
| CIBW_ARCHS: ${{ matrix.archs }} | |
| CIBW_BUILD_FRONTEND: "build" | |
| CIBW_TEST_REQUIRES: "pytest" | |
| CIBW_TEST_SOURCES_ANDROID: "./tests" | |
| CIBW_TEST_SOURCES_IOS: "./tests" | |
| CIBW_TEST_COMMAND: "pytest {project}" | |
| CIBW_TEST_COMMAND_ANDROID: "python -m pytest ./tests" | |
| CIBW_TEST_COMMAND_IOS: "python -m pytest ./tests" | |
| CIBW_TEST_SKIP: "*-win_arm64 *-android_arm64_v8a" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: Wheel-${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.build }}${{ matrix.archs }} | |
| path: ./wheelhouse/*.whl | |
| build_sdist: | |
| name: Build a source distribution | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| - name: Build sdist | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install setuptools build | |
| python -m build --sdist | |
| - name: Test building from the source distribution | |
| shell: bash | |
| run: | | |
| pip install ".[test,type]" | |
| pip uninstall -y mmh3 | |
| python -m pip install dist/*.tar.gz | |
| python -m pytest | |
| mypy --strict tests | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| path: dist/*.tar.gz | |
| publish-to-pypi: | |
| name: "Publish artifacts to PyPI" | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: [build_wheels, build_sdist] | |
| runs-on: ubuntu-24.04 | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/mmh3 | |
| permissions: | |
| id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
| steps: | |
| - name: Set up built items | |
| uses: actions/download-artifact@v5 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 | |
| publish-to-testpypi: | |
| name: "Publish artifacts to TestPyPI" | |
| if: startsWith(github.ref, 'refs/heads/master') | |
| needs: [build_wheels, build_sdist] | |
| runs-on: ubuntu-24.04 | |
| environment: | |
| name: testpypi | |
| url: https://test.pypi.org/p/mmh3 | |
| permissions: | |
| id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
| steps: | |
| - name: Set up built items | |
| uses: actions/download-artifact@v5 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Publish package distributions to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ |