Skip to content

SDK バージョン情報の出力名を修正し、インストールコマンドを更新する #1772

SDK バージョン情報の出力名を修正し、インストールコマンドを更新する

SDK バージョン情報の出力名を修正し、インストールコマンドを更新する #1772

Workflow file for this run

name: build
on:
workflow_dispatch:
push:
paths-ignore:
- "**.md"
- "tests/**"
branches-ignore:
- "feature/e2e-test*"
tags:
- "*"
schedule:
# UTC の 01:00 は JST だと 10:00 。
# 1-5 で 月曜日から金曜日
- cron: "0 1 * * 1-5"
permissions:
contents: write
env:
TEST_SIGNALING_URLS: ${{ secrets.TEST_SIGNALING_URLS }}
TEST_CHANNEL_ID_PREFIX: ${{ secrets.TEST_CHANNEL_ID_PREFIX }}
TEST_SECRET_KEY: ${{ secrets.TEST_SECRET_KEY }}
TEST_API_URL: ${{ secrets.TEST_API_URL }}
OPENH264_VERSION: 2.6.0
jobs:
# VERSION ファイルからバージョン情報を取得
get_sdk_version:
runs-on: ubuntu-latest
outputs:
sdk_version: ${{ steps.version.outputs.sdk_version }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
VERSION
sparse-checkout-cone-mode: false
- id: version
run: |
SDK_VERSION=$(cat VERSION)
echo "sdk_version=$SDK_VERSION" >> $GITHUB_OUTPUT
echo "SDK Version: $SDK_VERSION"
# まず pyi を生成する
# クロスコンパイル環境だと pyi が生成できないので、
# 1箇所で pyi を生成してアーティファクトにアップロードして、
# それを各ビルドで利用する形にする。
build_pyi:
strategy:
fail-fast: false
matrix:
python_version:
- "3.11"
- "3.12"
- "3.13"
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- run: |
sudo apt-get -y install libx11-dev
- uses: astral-sh/setup-uv@v6
with:
enable-cache: false
- run: uv python pin ${{ matrix.python_version }}
- run: uv sync
- name: Generate pyi
run: |
uv run python run.py ubuntu-24.04_x86_64
mkdir sora_sdk/
cp src/sora_sdk/py.typed sora_sdk/
cp src/sora_sdk/sora_sdk_ext.pyi sora_sdk/
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: sora_sdk_${{ matrix.python_version }}
path: sora_sdk/
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
os: ubuntu
arch: x86_64
- name: ubuntu-22.04_x86_64
target: ubuntu-22.04_x86_64
runs_on: ubuntu-22.04
os: ubuntu
arch: x86_64
- name: ubuntu-24.04_armv8
target: ubuntu-24.04_armv8
runs_on: ubuntu-24.04
os: ubuntu
arch: armv8
- name: ubuntu-22.04_armv8
target: ubuntu-22.04_armv8
runs_on: ubuntu-22.04
os: ubuntu
arch: armv8
python_version:
- "3.11"
- "3.12"
- "3.13"
needs: [build_pyi]
runs-on: ${{ matrix.platform.runs_on }}
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: sora_sdk_${{ matrix.python_version }}
path: sora_sdk/
- run: |
cp sora_sdk/py.typed src/sora_sdk/py.typed
cp sora_sdk/sora_sdk_ext.pyi src/sora_sdk/sora_sdk_ext.pyi
# libx11-dev は Ubuntu 24.04 の時に必要になる
- run: |
sudo apt-get update
sudo apt-get -y install libx11-dev
- if: ${{ matrix.platform.arch == 'armv8' }}
run: |
sudo apt-get -y install multistrap binutils-aarch64-linux-gnu
# multistrap に insecure なリポジトリからの取得を許可する設定を入れる
sudo sed -e 's/Apt::Get::AllowUnauthenticated=true/Apt::Get::AllowUnauthenticated=true";\n$config_str .= " -o Acquire::AllowInsecureRepositories=true/' -i /usr/sbin/multistrap
- uses: astral-sh/setup-uv@v6
with:
enable-cache: false
- run: |
uv python pin ${{ matrix.python_version }}
uv sync
- if: ${{ matrix.platform.arch == 'x86_64' }}
run: |
uv run python run.py ${{ matrix.platform.target }}
uv run python -m build
# Ubuntu armv8 向け
- if: ${{ matrix.platform.arch == 'armv8' }}
run: |
uv run python run.py ${{ matrix.platform.target }}
uv run python -m build
env:
SORA_SDK_TARGET: ${{ matrix.platform.target }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform.name }}_python-${{ matrix.python_version }}
path: "dist/"
# x86_64 でビルドした Ubuntu x86_64/arm64 向けの whl をチェックする
check_ubuntu_wheel:
strategy:
fail-fast: false
matrix:
# 22.04 x86_64 でクロスコンパイルした whl を 22.04 と 24.04 の x86_64/arm64 でチェックする
platform:
- name: ubuntu-22.04_x86_64
download_name: ubuntu-22.04_x86_64
runs_on: ubuntu-22.04
pytag: manylinux_2_31_x86_64
- name: ubuntu-22.04_armv8
download_name: ubuntu-22.04_armv8
runs_on: ubuntu-22.04-arm
pytag: manylinux_2_31_aarch64
- name: ubuntu-24.04_x86_64
download_name: ubuntu-22.04_x86_64
runs_on: ubuntu-24.04
pytag: manylinux_2_31_x86_64
- name: ubuntu-24.04_armv8
download_name: ubuntu-22.04_armv8
runs_on: ubuntu-24.04-arm
pytag: manylinux_2_31_aarch64
version:
- python: "3.11"
pkg: "311"
- python: "3.12"
pkg: "312"
- python: "3.13"
pkg: "313"
needs: [get_sdk_version, build_ubuntu]
runs-on: ${{ matrix.platform.runs_on }}
timeout-minutes: 15
steps:
- uses: astral-sh/setup-uv@v6
with:
enable-cache: false
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.platform.download_name }}_python-${{ matrix.version.python }}
path: dist/
# ここで download した whl ファイルの動作を確認する
- run: |
# 仮想環境を作成してテスト
uv venv --python ${{ matrix.version.python }}
uv pip install dist/sora_sdk-${{ needs.get_sdk_version.outputs.sdk_version }}-cp${{ matrix.version.pkg }}-cp${{ matrix.version.pkg }}-${{ matrix.platform.pytag }}.whl
uv run python -c "import sora_sdk; print(sora_sdk.get_video_codec_capability().to_json())"
build_ubuntu_arm:
strategy:
fail-fast: false
matrix:
platform:
- name: ubuntu-24.04_armv8
target: ubuntu-24.04_armv8
# arm64 でビルド
runs_on: ubuntu-24.04-arm
os: ubuntu
arch: armv8
- name: ubuntu-22.04_armv8
target: ubuntu-22.04_armv8
# arm64 でビルド
runs_on: ubuntu-22.04-arm
os: ubuntu
arch: armv8
python_version:
- "3.11"
- "3.12"
- "3.13"
needs: [build_pyi]
runs-on: ${{ matrix.platform.runs_on }}
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: sora_sdk_${{ matrix.python_version }}
path: sora_sdk/
- run: |
cp sora_sdk/py.typed src/sora_sdk/py.typed
cp sora_sdk/sora_sdk_ext.pyi src/sora_sdk/sora_sdk_ext.pyi
# libx11-dev は Ubuntu 24.04 の時に必要になる模様
- run: |
sudo apt-get update
sudo apt-get -y install libx11-dev
- run: |
sudo apt-get -y install multistrap binutils-aarch64-linux-gnu
# multistrap に insecure なリポジトリからの取得を許可する設定を入れる
sudo sed -e 's/Apt::Get::AllowUnauthenticated=true/Apt::Get::AllowUnauthenticated=true";\n$config_str .= " -o Acquire::AllowInsecureRepositories=true/' -i /usr/sbin/multistrap
# clang-19
- name: Install clang-19
run: |
wget https://apt.llvm.org/llvm.sh
chmod a+x llvm.sh
sudo ./llvm.sh 19
- uses: astral-sh/setup-uv@v6
with:
enable-cache: false
- run: |
uv python pin ${{ matrix.python_version }}
uv sync
uv run python run.py ${{ matrix.platform.target }}
uv run python -m build
env:
SORA_SDK_TARGET: ${{ matrix.platform.target }}
build_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"
needs: [build_pyi]
runs-on: ${{ matrix.platform.runs_on }}
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: sora_sdk_${{ matrix.python_version }}
path: sora_sdk/
- run: |
cp sora_sdk/py.typed src/sora_sdk/py.typed
cp sora_sdk/sora_sdk_ext.pyi src/sora_sdk/sora_sdk_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 ${{ matrix.platform.target }}
uv run python -m build
env:
_PYTHON_HOST_PLATFORM: ${{ matrix.platform.python_host_platform }}
ARCHFLAGS: ${{ matrix.platform.archflags }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform.name }}_python-${{ matrix.python_version }}
path: "dist/"
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@v4
- uses: actions/download-artifact@v4
with:
name: sora_sdk_${{ matrix.python_version }}
path: sora_sdk/
- run: |
cp sora_sdk/py.typed src/sora_sdk/py.typed
cp sora_sdk/sora_sdk_ext.pyi src/sora_sdk/sora_sdk_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
uv run python -m build
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: windows-2025_python-${{ matrix.python_version }}
path: dist/
# slack_notify_succeeded:
# needs: [build_ubuntu, build_ubuntu_arm, build_macos, build_windows]
# runs-on: ubuntu-24.04
# if: success()
# steps:
# - name: Slack Notification
# uses: rtCamp/action-slack-notify@v2
# env:
# SLACK_CHANNEL: sora-python-sdk
# SLACK_COLOR: good
# SLACK_TITLE: SUCCEEDED
# SLACK_ICON_EMOJI: ":star-struck:"
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
slack_notify_failed:
needs: [build_ubuntu, build_ubuntu_arm, build_macos,build_windows]
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-22.04_x86_64
- name: ubuntu-22.04_armv8
- name: macos-15_arm64
- name: macos-14_arm64
- name: windows-2025
python_version:
- "3.11"
- "3.12"
- "3.13"
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- uses: actions/download-artifact@v4
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.11' }}
# テスト用
# - name: Publish package to TestPyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository-url: https://test.pypi.org/legacy/
# verbose: true
# 本番用
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- 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@v4
- uses: ./.github/actions/download
with: { "platform": "ubuntu-22.04_x86_64", "python_version": "3.11" }
- uses: ./.github/actions/download
with: { "platform": "ubuntu-22.04_x86_64", "python_version": "3.12" }
- uses: ./.github/actions/download
with: { "platform": "ubuntu-22.04_x86_64", "python_version": "3.13" }
- 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-22.04_armv8", "python_version": "3.11" }
- uses: ./.github/actions/download
with: { "platform": "ubuntu-22.04_armv8", "python_version": "3.12" }
- uses: ./.github/actions/download
with: { "platform": "ubuntu-22.04_armv8", "python_version": "3.13" }
- uses: ./.github/actions/download
with: { "platform": "ubuntu-24.04_armv8", "python_version": "3.11" }
- uses: ./.github/actions/download
with: { "platform": "ubuntu-24.04_armv8", "python_version": "3.12" }
- uses: ./.github/actions/download
with: { "platform": "ubuntu-24.04_armv8", "python_version": "3.13" }
- 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-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: 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 }}