smoke_test: split into separate check_sip_register and check_sip_unre… #30
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 Wheels | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| pjsip_ref: | |
| description: "Optional pjproject tag, branch, or commit override" | |
| required: false | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v*" | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.runner }} wheels | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runner: ubuntu-22.04 | |
| archs: x86_64 | |
| macosx_deployment_target: "" | |
| - runner: macos-15-intel | |
| archs: x86_64 | |
| macosx_deployment_target: "15.0" | |
| - runner: macos-14 | |
| archs: arm64 | |
| macosx_deployment_target: "14.0" | |
| - runner: windows-2022 | |
| archs: AMD64 | |
| macosx_deployment_target: "" | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install shared build frontend | |
| run: python -m pip install --upgrade pip cibuildwheel build | |
| - name: Install Linux wheel repair tools | |
| if: startsWith(matrix.runner, 'ubuntu-') | |
| run: python -m pip install auditwheel | |
| - name: Install macOS wheel repair tools | |
| if: startsWith(matrix.runner, 'macos-') | |
| run: python -m pip install delocate | |
| - name: Determine bundled PJSIP version | |
| id: version | |
| shell: bash | |
| run: | | |
| package_version="$(python scripts/get_package_version.py)" | |
| requested_ref="${{ github.event.inputs.pjsip_ref }}" | |
| if [[ -n "${requested_ref}" ]]; then | |
| echo "pjsip_ref=${requested_ref}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "pjsip_ref=${package_version}" >> "$GITHUB_OUTPUT" | |
| fi | |
| echo "package_version=${package_version}" >> "$GITHUB_OUTPUT" | |
| - name: Build wheels | |
| env: | |
| CIBW_ARCHS: ${{ matrix.archs }} | |
| MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macosx_deployment_target }} | |
| PJSIP_REF: ${{ steps.version.outputs.pjsip_ref }} | |
| run: python -m cibuildwheel --output-dir dist | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.runner }} | |
| path: dist/* | |
| package-check: | |
| name: Build source package | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install packaging validators | |
| run: python -m pip install --upgrade pip build twine | |
| - name: Build sdist | |
| run: python -m build --sdist | |
| - name: Validate package metadata | |
| run: python -m twine check dist/* | |
| - name: Upload source distribution | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sdist | |
| path: dist/* | |
| verify: | |
| name: Verify ${{ matrix.runner }} / Python ${{ matrix.python }} | |
| needs: | |
| - build | |
| - package-check | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runner: ubuntu-22.04 | |
| artifact: wheels-ubuntu-22.04 | |
| python: "3.8" | |
| - runner: ubuntu-22.04 | |
| artifact: wheels-ubuntu-22.04 | |
| python: "3.9" | |
| - runner: ubuntu-22.04 | |
| artifact: wheels-ubuntu-22.04 | |
| python: "3.10" | |
| - runner: ubuntu-22.04 | |
| artifact: wheels-ubuntu-22.04 | |
| python: "3.11" | |
| - runner: ubuntu-22.04 | |
| artifact: wheels-ubuntu-22.04 | |
| python: "3.12" | |
| - runner: macos-15-intel | |
| artifact: wheels-macos-15-intel | |
| python: "3.8" | |
| - runner: macos-15-intel | |
| artifact: wheels-macos-15-intel | |
| python: "3.9" | |
| - runner: macos-15-intel | |
| artifact: wheels-macos-15-intel | |
| python: "3.10" | |
| - runner: macos-15-intel | |
| artifact: wheels-macos-15-intel | |
| python: "3.11" | |
| - runner: macos-15-intel | |
| artifact: wheels-macos-15-intel | |
| python: "3.12" | |
| - runner: macos-14 | |
| artifact: wheels-macos-14 | |
| python: "3.8" | |
| - runner: macos-14 | |
| artifact: wheels-macos-14 | |
| python: "3.9" | |
| - runner: macos-14 | |
| artifact: wheels-macos-14 | |
| python: "3.10" | |
| - runner: macos-14 | |
| artifact: wheels-macos-14 | |
| python: "3.11" | |
| - runner: macos-14 | |
| artifact: wheels-macos-14 | |
| python: "3.12" | |
| - runner: windows-2022 | |
| artifact: wheels-windows-2022 | |
| python: "3.8" | |
| - runner: windows-2022 | |
| artifact: wheels-windows-2022 | |
| python: "3.9" | |
| - runner: windows-2022 | |
| artifact: wheels-windows-2022 | |
| python: "3.10" | |
| - runner: windows-2022 | |
| artifact: wheels-windows-2022 | |
| python: "3.11" | |
| - runner: windows-2022 | |
| artifact: wheels-windows-2022 | |
| python: "3.12" | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Download wheels for this platform | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: dist | |
| - name: Get expected version | |
| id: version | |
| shell: bash | |
| run: echo "package_version=$(python scripts/get_package_version.py)" >> "$GITHUB_OUTPUT" | |
| - name: Find and install matching wheel | |
| shell: bash | |
| run: | | |
| py_tag=$(python -c "import sys; v=sys.version_info; print(f'cp{v.major}{v.minor}')") | |
| whl=$(ls dist/pjsua2_python-*-${py_tag}-${py_tag}-*.whl 2>/dev/null | head -1) | |
| if [[ -z "$whl" ]]; then | |
| echo "ERROR: no wheel found for tag ${py_tag} in dist/" | |
| ls dist/ | |
| exit 1 | |
| fi | |
| echo "Installing: $whl" | |
| python -m pip install --upgrade pip | |
| python -m pip install "$whl" | |
| - name: Run smoke test | |
| shell: bash | |
| env: | |
| EXPECTED_VERSION: ${{ steps.version.outputs.package_version }} | |
| SIP_REGISTRAR: ${{ vars.SIP_SERVER }} | |
| SIP_USER: ${{ vars.SIP_USER }} | |
| SIP_PASSWORD: ${{ vars.SIP_PASSWORD }} | |
| run: | | |
| python scripts/smoke_test.py \ | |
| --expected-version "$EXPECTED_VERSION" \ | |
| ${SIP_REGISTRAR:+--sip-registrar "$SIP_REGISTRAR"} \ | |
| ${SIP_USER:+--sip-user "$SIP_USER"} \ | |
| ${SIP_PASSWORD:+--sip-password "$SIP_PASSWORD"} | |
| github-release: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| name: Create GitHub release | |
| needs: | |
| - verify | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download built wheels | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| pattern: wheels-* | |
| merge-multiple: true | |
| - name: Download source distribution | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| pattern: sdist | |
| merge-multiple: true | |
| - name: Generate checksums | |
| shell: bash | |
| run: | | |
| cd dist | |
| sha256sum * > SHA256SUMS.txt | |
| - name: Publish GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: | | |
| dist/* | |
| publish: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| name: Publish to PyPI | |
| needs: | |
| - verify | |
| - github-release | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download built wheels | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| pattern: wheels-* | |
| merge-multiple: true | |
| - name: Download source distribution | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| pattern: sdist | |
| merge-multiple: true | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |