Skip to content

build

build #248

Workflow file for this run

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"
env:
OPENH264_VERSION: "2.6.0"
permissions:
contents: write
jobs:
# まず pyi を生成する
# クロスコンパイル環境だと pyi が生成できないので、
# 1箇所で pyi を生成してアーティファクトにアップロードして、
# それを各ビルドで利用する形にする。
build_pyi:
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- run: |
sudo apt-get -y install libx11-dev nasm
- uses: astral-sh/setup-uv@v6
with:
enable-cache: false
- run: uv python pin 3.13
- run: uv sync
- name: Generate pyi
run: |
uv run python run.py 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
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
openh264_arch: "linux64"
- name: ubuntu-24.04_armv8
target: ubuntu-24.04_armv8
runs_on: ubuntu-24.04-arm
openh264_arch: "linux-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: libdatachannel
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
- run: |
uv python pin ${{ matrix.python_version }}
uv sync
- run: |
uv run python run.py ${{ matrix.platform.target }}
uv run python -m build
- run: |
curl -LO http://ciscobinary.openh264.org/libopenh264-${{ env.OPENH264_VERSION }}-${{ matrix.platform.openh264_arch }}.8.so.bz2
bunzip2 libopenh264-${{ env.OPENH264_VERSION }}-${{ matrix.platform.openh264_arch }}.8.so.bz2
- run: |
export OPENH264_PATH=`pwd`/libopenh264-${{ env.OPENH264_VERSION }}-${{ matrix.platform.openh264_arch }}.8.so
uv run pytest tests/ -v
- 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
openh264_arch: "linux64"
- name: ubuntu-24.04_armv8
target: ubuntu-24.04_armv8
runs_on: ubuntu-24.04-arm
openh264_arch: "linux-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: libdatachannel
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
- run: |
uv python pin ${{ matrix.python_version }}
uv sync
- run: |
uv run python run.py ${{ matrix.platform.target }} --debug
uv run python -m build --outdir dist_debug
env:
BUILD_PROFILE: debug
- run: |
curl -LO http://ciscobinary.openh264.org/libopenh264-${{ env.OPENH264_VERSION }}-${{ matrix.platform.openh264_arch }}.8.so.bz2
bunzip2 libopenh264-${{ env.OPENH264_VERSION }}-${{ matrix.platform.openh264_arch }}.8.so.bz2
- run: |
export OPENH264_PATH=`pwd`/libopenh264-${{ env.OPENH264_VERSION }}-${{ matrix.platform.openh264_arch }}.8.so
uv run pytest tests/ -v
- 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-15_arm64
target: macos_arm64
runs_on: macos-15
os: macos
python_host_platform: "macosx-15.0-arm64"
archflags: "-arch arm64"
openh264_arch: "mac-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: libdatachannel
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
- 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 }}
- run: |
curl -LO http://ciscobinary.openh264.org/libopenh264-${{ env.OPENH264_VERSION }}-${{ matrix.platform.openh264_arch }}.dylib.bz2
bunzip2 libopenh264-${{ env.OPENH264_VERSION }}-${{ matrix.platform.openh264_arch }}.dylib.bz2
- run: |
export OPENH264_PATH=`pwd`/libopenh264-${{ env.OPENH264_VERSION }}-${{ matrix.platform.openh264_arch }}.dylib
export ENABLE_VIDEOTOOLBOX=1
uv run pytest tests/ -v
- 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"
openh264_arch: "mac-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: libdatachannel
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
- run: |
uv python pin ${{ matrix.python_version }}
uv sync
uv run python run.py ${{ matrix.platform.target }} --debug
uv run python -m build --outdir dist_debug
env:
BUILD_PROFILE: debug
_PYTHON_HOST_PLATFORM: ${{ matrix.platform.python_host_platform }}
ARCHFLAGS: ${{ matrix.platform.archflags }}
- run: |
curl -LO http://ciscobinary.openh264.org/libopenh264-${{ env.OPENH264_VERSION }}-${{ matrix.platform.openh264_arch }}.dylib.bz2
bunzip2 libopenh264-${{ env.OPENH264_VERSION }}-${{ matrix.platform.openh264_arch }}.dylib.bz2
- run: |
export OPENH264_PATH=`pwd`/libopenh264-${{ env.OPENH264_VERSION }}-${{ matrix.platform.openh264_arch }}.dylib
export ENABLE_VIDEOTOOLBOX=1
uv run pytest tests/ -v
- 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@v4
# - uses: actions/download-artifact@v4
# 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"
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.13' }}
# テスト用
# - 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-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_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: Download Ubuntu x86_64 Debug Artifact
uses: ./.github/actions/download
with:
platform: ubuntu-24.04_x86_64
python_version: '3.13'
debug: 'true'
- name: Download Ubuntu armv8 Debug Artifact
uses: ./.github/actions/download
with:
platform: ubuntu-24.04_armv8
python_version: '3.13'
debug: 'true'
- name: Download macOS arm64 Debug Artifact
uses: ./.github/actions/download
with:
platform: macos-15_arm64
python_version: '3.13'
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 }}