diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8809eecc..ac18d7e8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,8 @@ name: build on: workflow_dispatch: push: + branches-ignore: + - "feature/e2e-test" paths-ignore: - "doc/**" - "**.md" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..e200408a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,26 @@ +name: test + +on: + workflow_dispatch: + push: + paths-ignore: + - "doc/**" + - "**.md" + +jobs: + sora_python_sdk_e2e_test: + runs-on: ubuntu-latest + timeout-minutes: 10 + env: + TEST_SIGNALING_URL: ${{ secrets.TEST_SIGNALING_URL }} + TEST_SECRET_KEY: ${{ secrets.TEST_SECRET_KEY }} + TEST_CHANNEL_ID_PREFIX: ${{ secrets.TEST_CHANNEL_ID_PREFIX }} + steps: + - uses: sksat/setup-rye@v0.1.0 + - uses: actions/checkout@v3 + - run: | + sudo apt-get update + sudo apt-get -y install libva-dev libdrm-dev + - run: rye sync + - run: rye run python run.py + - run: rye run python -m pytest tests/test_recvonly.py diff --git a/pyproject.toml b/pyproject.toml index d09bb92f..6358fb2b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,4 +27,5 @@ dev-dependencies = [ "build~=0.10.0", "wheel~=0.40.0", "auditwheel~=5.4.0", + "pytest~=7.3.2", ] diff --git a/requirements-dev.lock b/requirements-dev.lock index 54db38cd..c711ac77 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -9,10 +9,14 @@ -e file:. auditwheel==5.4.0 build==0.10.0 +exceptiongroup==1.1.1 +iniconfig==2.0.0 nanobind==1.4.0 packaging==23.1 +pluggy==1.0.0 pyelftools==0.29 pyproject-hooks==1.0.0 +pytest==7.3.2 tomli==2.0.1 wheel==0.40.0 # The following packages are considered to be unsafe in a requirements file: diff --git a/tests/test_recvonly.py b/tests/test_recvonly.py new file mode 100644 index 00000000..e001ffb6 --- /dev/null +++ b/tests/test_recvonly.py @@ -0,0 +1,25 @@ +import os +import time + +from sora_sdk import Sora + + +def on_disconnect(error_code, message_abc: str): + print(f'on_disconnect: error_code: {error_code}, message: {message_abc}') + + +# @pytest.mark.timeout(10) +def test_sendonly(): + sora = Sora() + + conn = sora.create_connection( + signaling_url=os.environ.get("TEST_SIGNALING_URL"), + role="recvonly", + channel_id=os.environ.get("TEST_CHANNEL_ID_PREFIX") + "sora-python-sdk-test", + metadata={"access_token": os.environ.get("TEST_SECRET_KEY")} + ) + + conn.on_disconnect = on_disconnect + conn.connect() + time.sleep(3) + conn.disconnect()