Skip to content

バージョンを上げる #842

バージョンを上げる

バージョンを上げる #842

Workflow file for this run

name: build
on:
push:
paths-ignore:
- "examples/**"
- "**.md"
schedule:
# UTC の 01:00 は JST だと 10:00 。
# 1-5 で 月曜日から金曜日
- cron: "0 1 * * 1-5"
jobs:
# まず pyi を生成する
# クロスコンパイル環境だと pyi が生成できないので、
# 1箇所で pyi を生成してアーティファクトにアップロードして、
# それを各ビルドで利用する形にする。
build_pyi:
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- run: |
sudo apt-get -y install libva-dev libdrm-dev libx11-dev
- uses: astral-sh/setup-uv@v2
- run: uv python pin 3.12
- 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
path: sora_sdk/
build_linux_macos:
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
- name: ubuntu-22.04_x86_64
target: ubuntu-22.04_x86_64
runs_on: ubuntu-22.04
os: ubuntu
- name: macos-13_arm64
target: macos_arm64
runs_on: macos-13
os: macos
python_host_platform: "macosx-13.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.10"
- "3.11"
- "3.12"
needs: [build_pyi]
runs-on: ${{ matrix.platform.runs_on }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: sora_sdk
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 libva-dev libdrm-dev libx11-dev
if: ${{ matrix.platform.os == 'ubuntu' }}
- uses: astral-sh/setup-uv@v2
- run: uv python pin ${{ matrix.python_version }}
- run: uv sync
# Ubuntu 向け
- run: |
uv run python run.py ${{ matrix.platform.target }}
uv run python -m build
if: ${{ matrix.platform.os == 'ubuntu' }}
# macOS 向け
- run: |
uv run python run.py ${{ matrix.platform.target }}
uv run python -m build
if: ${{ matrix.platform.os == 'macos' }}
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-2022
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
python_version:
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: sora_sdk
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@v2
- run: uv python pin ${{ matrix.python_version }}
- run: uv sync
- run: uv run python run.py windows_x86_64
- run: uv run python -m build
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: windows-2022_python-${{ matrix.python_version }}
path: dist/
slack_notify_succeeded:
needs: [build_linux_macos, build_windows]
runs-on: ubuntu-latest
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_linux_macos, build_windows]
runs-on: ubuntu-latest
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_linux_macos
- build_windows
strategy:
fail-fast: false
matrix:
platform:
# - name: ubuntu-24.04_x86_64
- name: ubuntu-22.04_x86_64
- name: macos-14_arm64
- name: macos-13_arm64
- name: windows-2022
python_version:
- "3.10"
- "3.11"
- "3.12"
runs-on: ubuntu-latest
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-14_arm64' && matrix.python_version == '3.10' }}
# テスト用
# - 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_linux_macos
- build_windows
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/download
with: { "platform": "ubuntu-22.04_x86_64", "python_version": "3.10" }
- 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": "macos-14_arm64", "python_version": "3.10" }
- 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-13_arm64", "python_version": "3.10" }
- uses: ./.github/actions/download
with: { "platform": "macos-13_arm64", "python_version": "3.11" }
- uses: ./.github/actions/download
with: { "platform": "macos-13_arm64", "python_version": "3.12" }
- uses: ./.github/actions/download
with: { "platform": "windows-2022", "python_version": "3.10" }
- uses: ./.github/actions/download
with: { "platform": "windows-2022", "python_version": "3.11" }
- uses: ./.github/actions/download
with: { "platform": "windows-2022", "python_version": "3.12" }
- 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
uses: softprops/action-gh-release@v2
with:
files: ${{ steps.env.outputs.package_paths }}
prerelease: ${{ contains(github.ref, 'dev') }}
- 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 }}