Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:shiguredo/sora-python-sdk into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
voluntas committed Aug 14, 2024
2 parents 3278609 + e66c515 commit 95016f4
Show file tree
Hide file tree
Showing 18 changed files with 1,180 additions and 442 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
push:
paths-ignore:
- "doc/**"
- "examples/**"
- "**.md"
# 毎日日本時間(JST)の14:00(UTCの5:00)に実行します。
# ただし、週末は除きます。
Expand Down
131 changes: 131 additions & 0 deletions .github/workflows/examples-e2e-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: examples-e2e-test

on:
workflow_dispatch:
push:
# paths:
# - .github/workflows/examples-e2e-test.yml
# - examples

jobs:
e2e_ubuntu_test:
strategy:
matrix:
python_version: ["3.10", "3.11", "3.12"]
os: ["ubuntu-22.04", "ubuntu-24.04"]
runs-on: ${{ matrix.os}}
defaults:
run:
working-directory: ./examples
timeout-minutes: 20
env:
TEST_SIGNALING_URLS: ${{ secrets.TEST_SIGNALING_URLS }}
TEST_CHANNEL_ID_PREFIX: ${{ secrets.TEST_CHANNEL_ID_PREFIX }}
TEST_SECRET_KEY: ${{ secrets.TEST_SECRET_KEY }}
steps:
- uses: actions/checkout@v4
# libx11-dev は Ubuntu 24.04 の時に必要になる模様
- run: |
sudo apt-get update
sudo apt-get -y install libva2 libdrm2 libva-dev libdrm-dev libx11-dev portaudio19-dev
- name: Download openh264
run: |
curl -LO http://ciscobinary.openh264.org/libopenh264-2.4.1-linux64.7.so.bz2
bzip2 -d libopenh264-2.4.1-linux64.7.so.bz2
mv libopenh264-2.4.1-linux64.7.so libopenh264.so
echo "OPENH264_PATH=$(pwd)/libopenh264.so" >> $GITHUB_ENV
- uses: eifinger/setup-rye@v4
- run: rye pin ${{ matrix.python_version }}
- run: rye sync
- run: rye run pytest tests/test_openh264.py -s
- run: rye run pytest tests/test_messaging_sendonly.py -s
- run: rye run pytest tests/test_sendonly_recvonly.py -s

e2e_macos_test:
strategy:
matrix:
python_version: ["3.10", "3.11", "3.12"]
# macos-13 は test_macos.py が上手くテストが動かないのでスキップ
os: ["macos-14"]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./examples
timeout-minutes: 20
env:
TEST_SIGNALING_URLS: ${{ secrets.TEST_SIGNALING_URLS }}
TEST_CHANNEL_ID_PREFIX: ${{ secrets.TEST_CHANNEL_ID_PREFIX }}
TEST_SECRET_KEY: ${{ secrets.TEST_SECRET_KEY }}
steps:
- uses: actions/checkout@v4
- name: Download openh264
run: |
curl -LO http://ciscobinary.openh264.org/libopenh264-2.4.1-mac-arm64.dylib.bz2
bzip2 -d libopenh264-2.4.1-mac-arm64.dylib.bz2
mv libopenh264-2.4.1-mac-arm64.dylib libopenh264.dylib
echo "OPENH264_PATH=$(pwd)/libopenh264.dylib" >> $GITHUB_ENV
- uses: eifinger/setup-rye@v4
- run: rye pin ${{ matrix.python_version }}
- run: rye sync
- run: rye run pytest tests/test_macos.py -s
- run: rye run pytest tests/test_openh264.py -s
- run: rye run pytest tests/test_messaging_sendonly.py -s
- run: rye run pytest tests/test_sendonly_recvonly.py -s

e2e_windows_test:
strategy:
matrix:
python_version: ["3.10", "3.11", "3.12"]
runs-on: windows-2022
defaults:
run:
working-directory: ./examples
timeout-minutes: 20
env:
TEST_SIGNALING_URLS: ${{ secrets.TEST_SIGNALING_URLS }}
TEST_CHANNEL_ID_PREFIX: ${{ secrets.TEST_CHANNEL_ID_PREFIX }}
TEST_SECRET_KEY: ${{ secrets.TEST_SECRET_KEY }}
steps:
- uses: actions/checkout@v4
- name: Download openh264
shell: pwsh
run: |
$url = "http://ciscobinary.openh264.org/openh264-2.4.1-win64.dll.bz2"
Invoke-WebRequest -Uri $url -OutFile "openh264-2.4.1-win64.dll.bz2"
7z e openh264-2.4.1-win64.dll.bz2
Rename-Item -Path "openh264-2.4.1-win64.dll" -NewName "libopenh264.dll"
echo "OPENH264_PATH=$PWD\libopenh264.dll" >> $env:GITHUB_ENV
working-directory: ./tests
- uses: eifinger/setup-rye@v4
- run: rye pin ${{ matrix.python_version }}
- run: rye sync
- run: rye run pytest tests/test_messaging_sendonly.py -s
- run: rye run pytest tests/test_sendonly_recvonly.py -s

slack_notify_succeeded:
needs: [e2e_ubuntu_test, e2e_macos_test, e2e_windows_test]
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: [e2e_ubuntu_test, e2e_macos_test, e2e_windows_test]
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 }}
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

## develop

- [FIX] examples の設定に virtual = true を指定するようにする
- これを指定しないとエラーになる
- @voluntas

## 2024.3.0

**日時**: 2024-08-05
Expand Down
55 changes: 19 additions & 36 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,36 @@
# Python Sora SDK サンプル集

## About Shiguredo's open source software
## セットアップ

We will not respond to PRs or issues that have not been discussed on Discord. Also, Discord is only available in Japanese.
[Rye](https://rye.astral.sh/) というパッケージマネージャーを利用しています。

Please read <https://github.com/shiguredo/oss/blob/master/README.en.md> before use.

## 時雨堂のオープンソースソフトウェアについて

利用前に <https://github.com/shiguredo/oss> をお読みください。

## サンプルコードの実行方法

[Rye](https://github.com/mitsuhiko/rye) というパッケージマネージャーを利用しています。

Linux と macOS の場合は `curl -sSf https://rye-up.com/get | bash` でインストール可能です。
Windows は <https://rye-up.com/> の Installation Instructions を確認してください。
インストール方法は <https://rye.astral.sh/guide/installation/> をご確認ください。

### 依存パッケージのビルド

```console
```bash
rye sync
```

### サンプルコードの実行

```console
$ cp .env.template .env
# .env に必要な変数を設定してください。
$ rye run media_recvonly
```
## サンプルの種類

## ライセンス
- media_sendonly
- media_recvonly
- messaging_sendrecv
- messaging_sendonly
- messaging_recvonly
- hideface_sender

Apache License 2.0
## サンプルコードの実行

```text
Copyright 2023-2024, tnoho (Original Author)
Copyright 2023-2024, Shiguredo Inc.
`.env.template` をコピーして `.env` に必要な変数を設定してください。

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
```bash
cp .env.template .env
```

http://www.apache.org/licenses/LICENSE-2.0
例えば `media_recvonly` サンプルを実行する場合は以下のコマンドを実行してください。

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```bash
rye run media_recvonly
```
6 changes: 5 additions & 1 deletion examples/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies = [
"sora-sdk>=2024.3.0",
"mediapipe~=0.10.14",
"python-dotenv>=1.0.1",
"numpy>=2.0.1",
]
readme = "README.md"
requires-python = ">= 3.10"
Expand All @@ -28,7 +29,7 @@ build-backend = "hatchling.build"

[tool.rye]
managed = true
dev-dependencies = ["ruff>=0.5", "mypy>=1.10.0"]
dev-dependencies = ["ruff>=0.5", "mypy>=1.10.0", "pytest>=8.3"]

[tool.hatch.metadata]
allow-direct-references = true
Expand All @@ -39,3 +40,6 @@ packages = ["src/media", "src/messaging", "src/ml"]
[tool.ruff]
target-version = "py310"
line-length = 100

[tool.pytest.ini_options]
pythonpath = ["src"]
10 changes: 10 additions & 0 deletions examples/requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ contourpy==1.2.1
# via matplotlib
cycler==0.12.1
# via matplotlib
exceptiongroup==1.2.2
# via pytest
flatbuffers==24.3.25
# via mediapipe
fonttools==4.53.1
# via matplotlib
iniconfig==2.0.0
# via pytest
jax==0.4.31
# via mediapipe
jaxlib==0.4.31
Expand Down Expand Up @@ -53,6 +57,7 @@ numpy==2.0.1
# via opencv-python-headless
# via opt-einsum
# via scipy
# via sora-sdk-samples
opencv-contrib-python==4.10.0.84
# via mediapipe
opencv-python==4.10.0.84
Expand All @@ -63,14 +68,18 @@ opt-einsum==3.3.0
# via jax
packaging==24.1
# via matplotlib
# via pytest
pillow==10.4.0
# via matplotlib
pluggy==1.5.0
# via pytest
protobuf==4.25.4
# via mediapipe
pycparser==2.22
# via cffi
pyparsing==3.1.2
# via matplotlib
pytest==8.3.2
python-dateutil==2.9.0.post0
# via matplotlib
python-dotenv==1.0.1
Expand All @@ -88,5 +97,6 @@ sounddevice==0.4.7
# via sora-sdk-samples
tomli==2.0.1
# via mypy
# via pytest
typing-extensions==4.12.2
# via mypy
1 change: 1 addition & 0 deletions examples/requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ numpy==2.0.1
# via opencv-python-headless
# via opt-einsum
# via scipy
# via sora-sdk-samples
opencv-contrib-python==4.10.0.84
# via mediapipe
opencv-python==4.10.0.84
Expand Down
Empty file added examples/src/__init__.py
Empty file.
Loading

0 comments on commit 95016f4

Please sign in to comment.