build #343
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 | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths-ignore: | |
| - "**.md" | |
| - ".github/workflows/claude.yml" | |
| # - "tests/**" | |
| branches-ignore: | |
| - "feature/e2e-test*" | |
| tags: | |
| - "*" | |
| schedule: | |
| # UTC の 01:00 は JST だと 10:00 。 | |
| # 1-5 で 月曜日から金曜日 | |
| - cron: "0 1 * * 1-5" | |
| permissions: | |
| contents: write | |
| jobs: | |
| # まず pyi を生成する | |
| # クロスコンパイル環境だと pyi が生成できないので、 | |
| # 1箇所で pyi を生成してアーティファクトにアップロードして、 | |
| # それを各ビルドで利用する形にする。 | |
| build_pyi: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python_version: | |
| - "3.13" | |
| - "3.14" | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Export OPENH264_VERSION from DEPS | |
| run: | | |
| ver=$(grep '^OPENH264_VERSION=' DEPS | cut -d= -f2) | |
| ver=${ver#v} | |
| echo "OPENH264_VERSION=$ver" >> $GITHUB_ENV | |
| - run: | | |
| sudo apt-get -y install libx11-dev nasm | |
| - uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: false | |
| python-version: ${{ matrix.python_version }} | |
| - run: | | |
| uv sync | |
| - name: Generate pyi | |
| run: | | |
| uv run python run.py build ubuntu-24.04_x86_64 | |
| mkdir libdatachannel/ | |
| cp src/libdatachannel/py.typed libdatachannel/ | |
| cp src/libdatachannel/libdatachannel_ext.pyi libdatachannel/ | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libdatachannel_python-${{ matrix.python_version }} | |
| path: libdatachannel/ | |
| build_ubuntu: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - name: ubuntu-24.04_x86_64 | |
| target: ubuntu-24.04_x86_64 | |
| runs_on: ubuntu-24.04 | |
| - name: ubuntu-24.04_armv8 | |
| target: ubuntu-24.04_armv8 | |
| runs_on: ubuntu-24.04-arm | |
| python_version: | |
| # - "3.11" | |
| # - "3.12" | |
| - "3.13" | |
| - "3.14" | |
| needs: [build_pyi] | |
| runs-on: ${{ matrix.platform.runs_on }} | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Export OPENH264_VERSION from DEPS | |
| run: | | |
| ver=$(grep '^OPENH264_VERSION=' DEPS | cut -d= -f2) | |
| ver=${ver#v} | |
| echo "OPENH264_VERSION=$ver" >> $GITHUB_ENV | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| name: libdatachannel_python-${{ matrix.python_version }} | |
| path: libdatachannel/ | |
| - run: | | |
| cp libdatachannel/py.typed src/libdatachannel/py.typed | |
| cp libdatachannel/libdatachannel_ext.pyi src/libdatachannel/libdatachannel_ext.pyi | |
| # libx11-dev は Ubuntu 24.04 の時に必要になる | |
| - run: | | |
| sudo apt-get update | |
| sudo apt-get -y install libx11-dev nasm | |
| - uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: false | |
| python-version: ${{ matrix.python_version }} | |
| - run: | | |
| uv sync | |
| - run: | | |
| uv run python run.py build ${{ matrix.platform.target }} | |
| uv build | |
| - name: Download OpenH264 | |
| uses: shiguredo/github-actions/.github/actions/download-openh264@main | |
| id: openh264 | |
| with: | |
| platform_name: ${{ matrix.platform.target }} | |
| openh264_version: ${{ env.OPENH264_VERSION }} | |
| - run: uv run pytest tests/ -v | |
| env: | |
| OPENH264_PATH: ${{ steps.openh264.outputs.openh264_path }} | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.platform.name }}_python-${{ matrix.python_version }} | |
| path: "dist/" | |
| build_debug_ubuntu: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - name: ubuntu-24.04_x86_64 | |
| target: ubuntu-24.04_x86_64 | |
| runs_on: ubuntu-24.04 | |
| - name: ubuntu-24.04_armv8 | |
| target: ubuntu-24.04_armv8 | |
| runs_on: ubuntu-24.04-arm | |
| python_version: | |
| # - "3.11" | |
| # - "3.12" | |
| - "3.13" | |
| - "3.14" | |
| needs: [build_pyi] | |
| runs-on: ${{ matrix.platform.runs_on }} | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Export OPENH264_VERSION from DEPS | |
| run: | | |
| ver=$(grep '^OPENH264_VERSION=' DEPS | cut -d= -f2) | |
| ver=${ver#v} | |
| echo "OPENH264_VERSION=$ver" >> $GITHUB_ENV | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| name: libdatachannel_python-${{ matrix.python_version }} | |
| path: libdatachannel/ | |
| - run: | | |
| cp libdatachannel/py.typed src/libdatachannel/py.typed | |
| cp libdatachannel/libdatachannel_ext.pyi src/libdatachannel/libdatachannel_ext.pyi | |
| # libx11-dev は Ubuntu 24.04 の時に必要になる | |
| - run: | | |
| sudo apt-get update | |
| sudo apt-get -y install libx11-dev nasm | |
| - uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: false | |
| python-version: ${{ matrix.python_version }} | |
| - run: | | |
| uv sync | |
| - run: | | |
| uv run python run.py build ${{ matrix.platform.target }} --debug | |
| uv build --out-dir dist_debug | |
| env: | |
| BUILD_PROFILE: debug | |
| - name: Download OpenH264 | |
| uses: shiguredo/github-actions/.github/actions/download-openh264@main | |
| id: openh264 | |
| with: | |
| platform_name: ${{ matrix.platform.name }} | |
| openh264_version: ${{ env.OPENH264_VERSION }} | |
| - run: uv run pytest tests/ -v | |
| env: | |
| OPENH264_PATH: ${{ steps.openh264.outputs.openh264_path }} | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.platform.name }}_python-${{ matrix.python_version }}_debug | |
| path: "dist_debug/" | |
| build_macos: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - name: macos-26_arm64 | |
| target: macos_arm64 | |
| runs_on: macos-26 | |
| os: macos | |
| python_host_platform: "macosx-26.0-arm64" | |
| archflags: "-arch arm64" | |
| - name: macos-15_arm64 | |
| target: macos_arm64 | |
| runs_on: macos-15 | |
| os: macos | |
| python_host_platform: "macosx-15.0-arm64" | |
| archflags: "-arch arm64" | |
| # - name: macos-14_arm64 | |
| # target: macos_arm64 | |
| # runs_on: macos-14 | |
| # os: macos | |
| # python_host_platform: "macosx-14.0-arm64" | |
| # archflags: "-arch arm64" | |
| python_version: | |
| # - "3.11" | |
| # - "3.12" | |
| - "3.13" | |
| - "3.14" | |
| needs: [build_pyi] | |
| runs-on: ${{ matrix.platform.runs_on }} | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Export OPENH264_VERSION from DEPS | |
| run: | | |
| ver=$(grep '^OPENH264_VERSION=' DEPS | cut -d= -f2) | |
| ver=${ver#v} | |
| echo "OPENH264_VERSION=$ver" >> $GITHUB_ENV | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| name: libdatachannel_python-${{ matrix.python_version }} | |
| path: libdatachannel/ | |
| - run: | | |
| cp libdatachannel/py.typed src/libdatachannel/py.typed | |
| cp libdatachannel/libdatachannel_ext.pyi src/libdatachannel/libdatachannel_ext.pyi | |
| - run: | | |
| brew install nasm | |
| - uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: false | |
| python-version: ${{ matrix.python_version }} | |
| - run: | | |
| uv sync | |
| - run: | | |
| uv run python run.py build ${{ matrix.platform.target }} | |
| uv build | |
| env: | |
| _PYTHON_HOST_PLATFORM: ${{ matrix.platform.python_host_platform }} | |
| ARCHFLAGS: ${{ matrix.platform.archflags }} | |
| - name: Download OpenH264 | |
| uses: shiguredo/github-actions/.github/actions/download-openh264@main | |
| id: openh264 | |
| with: | |
| platform_name: ${{ matrix.platform.target }} | |
| openh264_version: ${{ env.OPENH264_VERSION }} | |
| - run: uv run pytest tests/ -v | |
| env: | |
| OPENH264_PATH: ${{ steps.openh264.outputs.openh264_path }} | |
| ENABLE_VIDEOTOOLBOX: 1 | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.platform.name }}_python-${{ matrix.python_version }} | |
| path: "dist/" | |
| build_debug_macos: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - name: macos-15_arm64 | |
| target: macos_arm64 | |
| runs_on: macos-15 | |
| os: macos | |
| python_host_platform: "macosx-15.0-arm64" | |
| archflags: "-arch arm64" | |
| # - name: macos-14_arm64 | |
| # target: macos_arm64 | |
| # runs_on: macos-14 | |
| # os: macos | |
| # python_host_platform: "macosx-14.0-arm64" | |
| # archflags: "-arch arm64" | |
| python_version: | |
| # - "3.11" | |
| # - "3.12" | |
| - "3.13" | |
| - "3.14" | |
| needs: [build_pyi] | |
| runs-on: ${{ matrix.platform.runs_on }} | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Export OPENH264_VERSION from DEPS | |
| run: | | |
| ver=$(grep '^OPENH264_VERSION=' DEPS | cut -d= -f2) | |
| ver=${ver#v} | |
| echo "OPENH264_VERSION=$ver" >> $GITHUB_ENV | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| name: libdatachannel_python-${{ matrix.python_version }} | |
| path: libdatachannel/ | |
| - run: | | |
| cp libdatachannel/py.typed src/libdatachannel/py.typed | |
| cp libdatachannel/libdatachannel_ext.pyi src/libdatachannel/libdatachannel_ext.pyi | |
| - run: | | |
| brew install nasm | |
| - uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: false | |
| python-version: ${{ matrix.python_version }} | |
| - run: | | |
| uv sync | |
| - run: | | |
| uv run python run.py build ${{ matrix.platform.target }} --debug | |
| uv build --out-dir dist_debug | |
| env: | |
| BUILD_PROFILE: debug | |
| _PYTHON_HOST_PLATFORM: ${{ matrix.platform.python_host_platform }} | |
| ARCHFLAGS: ${{ matrix.platform.archflags }} | |
| - name: Download OpenH264 | |
| uses: shiguredo/github-actions/.github/actions/download-openh264@main | |
| id: openh264 | |
| with: | |
| platform_name: ${{ matrix.platform.target }} | |
| openh264_version: ${{ env.OPENH264_VERSION }} | |
| - run: uv run pytest tests/ -v | |
| env: | |
| OPENH264_PATH: ${{ steps.openh264.outputs.openh264_path }} | |
| ENABLE_VIDEOTOOLBOX: 1 | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.platform.name }}_python-${{ matrix.python_version }}_debug | |
| path: "dist_debug/" | |
| # build_windows: | |
| # needs: [build_pyi] | |
| # runs-on: windows-2025 | |
| # timeout-minutes: 15 | |
| # strategy: | |
| # fail-fast: false | |
| # matrix: | |
| # python_version: | |
| # # - "3.11" | |
| # # - "3.12" | |
| # - "3.13" | |
| # steps: | |
| # - uses: actions/checkout@v5 | |
| # - uses: actions/download-artifact@v5 | |
| # with: | |
| # name: libdatachannel | |
| # path: libdatachannel/ | |
| # - run: | | |
| # cp libdatachannel/py.typed src/libdatachannel/py.typed | |
| # cp libdatachannel/libdatachannel_ext.pyi src/libdatachannel/libdatachannel_ext.pyi | |
| # - uses: astral-sh/setup-uv@v6 | |
| # with: | |
| # enable-cache: false | |
| # - run: | | |
| # uv python pin ${{ matrix.python_version }} | |
| # uv sync | |
| # uv run python run.py windows_x86_64 | |
| slack_notify_failed: | |
| needs: [build_ubuntu, build_macos] | |
| runs-on: ubuntu-24.04 | |
| if: failure() | |
| steps: | |
| - name: Slack Notification | |
| uses: rtCamp/action-slack-notify@v2 | |
| env: | |
| SLACK_CHANNEL: sora-python-sdk | |
| SLACK_COLOR: danger | |
| SLACK_TITLE: "FAILED" | |
| SLACK_ICON_EMOJI: ":japanese_ogre:" | |
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
| publish_wheel: | |
| if: contains(github.ref, 'tags/202') | |
| needs: | |
| - build_ubuntu | |
| - build_macos | |
| # - build_windows | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - name: ubuntu-24.04_x86_64 | |
| - name: ubuntu-24.04_armv8 | |
| - name: macos-15_arm64 | |
| # - name: macos-14_arm64 | |
| # - name: windows-2025 | |
| python_version: | |
| # - "3.11" | |
| # - "3.12" | |
| - "3.13" | |
| - "3.14" | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| environment: pypi | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| name: ${{ matrix.platform.name }}_python-${{ matrix.python_version }} | |
| path: dist | |
| - run: | | |
| if [ -e dist/*.tar.gz ]; then | |
| mv dist/*.tar.gz ./ | |
| fi | |
| # matrix の中で1個だけソースディストリビューション用のデータを残しておく | |
| - run: mv *.tar.gz dist/ | |
| if: ${{ matrix.platform.name == 'macos-15_arm64' && matrix.python_version == '3.14' }} | |
| # テスト用 | |
| # - name: Publish package to TestPyPI | |
| # uses: pypa/gh-action-pypi-publish@release/v1 | |
| # with: | |
| # repository-url: https://test.pypi.org/legacy/ | |
| # verbose: true | |
| # 本番用 | |
| - name: Publish package to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| - name: Slack Notification | |
| if: failure() | |
| uses: rtCamp/action-slack-notify@v2 | |
| env: | |
| SLACK_CHANNEL: sora-python-sdk | |
| SLACK_COLOR: danger | |
| SLACK_TITLE: Build failed | |
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
| create-release: | |
| if: contains(github.ref, 'tags/202') | |
| needs: | |
| - build_ubuntu | |
| - build_macos | |
| #- build_windows | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| # - uses: ./.github/actions/download | |
| # with: | |
| # platform: "ubuntu-24.04_x86_64" | |
| # python_version: "3.11" | |
| # - uses: ./.github/actions/download | |
| # with: | |
| # platform: "ubuntu-24.04_x86_64" | |
| # python_version: "3.12" | |
| - uses: ./.github/actions/download | |
| with: | |
| platform: "ubuntu-24.04_x86_64" | |
| python_version: "3.13" | |
| - uses: ./.github/actions/download | |
| with: | |
| platform: "ubuntu-24.04_x86_64" | |
| python_version: "3.14" | |
| - uses: ./.github/actions/download | |
| with: | |
| platform: "ubuntu-24.04_armv8" | |
| python_version: "3.13" | |
| - uses: ./.github/actions/download | |
| with: | |
| platform: "ubuntu-24.04_armv8" | |
| python_version: "3.14" | |
| # - uses: ./.github/actions/download | |
| # with: | |
| # platform: "macos-15_arm64" | |
| # python_version: "3.11" | |
| # - uses: ./.github/actions/download | |
| # with: | |
| # platform: "macos-15_arm64" | |
| # python_version: "3.12" | |
| - uses: ./.github/actions/download | |
| with: | |
| platform: "macos-15_arm64" | |
| python_version: "3.13" | |
| - uses: ./.github/actions/download | |
| with: | |
| platform: "macos-15_arm64" | |
| python_version: "3.14" | |
| # - uses: ./.github/actions/download | |
| # with: | |
| # platform: "macos-14_arm64" | |
| # python_version: "3.11" | |
| # - uses: ./.github/actions/download | |
| # with: | |
| # platform: "macos-14_arm64" | |
| # python_version: "3.12" | |
| # - uses: ./.github/actions/download | |
| # with: | |
| # platform: "macos-14_arm64" | |
| # python_version: "3.13" | |
| # - uses: ./.github/actions/download | |
| # with: | |
| # platform: "windows-2025" | |
| # python_version: "3.11" | |
| # - uses: ./.github/actions/download | |
| # with: | |
| # platform: "windows-2025" | |
| # python_version: "3.12" | |
| # - uses: ./.github/actions/download | |
| # with: | |
| # platform: "windows-2025" | |
| # python_version: "3.13" | |
| - name: Download Ubuntu x86_64 Debug Artifact (3.13) | |
| uses: ./.github/actions/download | |
| with: | |
| platform: ubuntu-24.04_x86_64 | |
| python_version: "3.13" | |
| debug: "true" | |
| - name: Download Ubuntu x86_64 Debug Artifact (3.14) | |
| uses: ./.github/actions/download | |
| with: | |
| platform: ubuntu-24.04_x86_64 | |
| python_version: "3.14" | |
| debug: "true" | |
| - name: Download Ubuntu armv8 Debug Artifact (3.13) | |
| uses: ./.github/actions/download | |
| with: | |
| platform: ubuntu-24.04_armv8 | |
| python_version: "3.13" | |
| debug: "true" | |
| - name: Download Ubuntu armv8 Debug Artifact (3.14) | |
| uses: ./.github/actions/download | |
| with: | |
| platform: ubuntu-24.04_armv8 | |
| python_version: "3.14" | |
| debug: "true" | |
| - name: Download macOS arm64 Debug Artifact (3.13) | |
| uses: ./.github/actions/download | |
| with: | |
| platform: macos-15_arm64 | |
| python_version: "3.13" | |
| debug: "true" | |
| - name: Download macOS arm64 Debug Artifact (3.14) | |
| uses: ./.github/actions/download | |
| with: | |
| platform: macos-15_arm64 | |
| python_version: "3.14" | |
| debug: "true" | |
| - name: Env to output | |
| run: | | |
| echo "package_paths<<EOF" >> $GITHUB_OUTPUT | |
| cat package_paths.env >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| id: env | |
| - name: Release (Prerelease) | |
| if: contains(github.ref, 'dev') | |
| run: | | |
| gh release create ${{ github.ref_name }} \ | |
| --title "${{ github.ref_name }}" \ | |
| --prerelease \ | |
| $(cat package_paths.env) | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Release | |
| if: ${{ !contains(github.ref, 'dev') }} | |
| run: | | |
| gh release create ${{ github.ref_name }} \ | |
| --title "${{ github.ref_name }}" \ | |
| $(cat package_paths.env) | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Verify Release Creation | |
| run: | | |
| gh release view ${{ github.ref_name }} --json url | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Slack Notification | |
| if: failure() | |
| uses: rtCamp/action-slack-notify@v2 | |
| env: | |
| SLACK_CHANNEL: sora-python-sdk | |
| SLACK_COLOR: danger | |
| SLACK_ICON_EMOJI: ":japanese_ogre:" | |
| SLACK_TITLE: Release failed | |
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |