11name : Tests
22
33on :
4- push :
5- branches :
6- - main
7- pull_request :
8- branches :
9- - main
10- workflow_dispatch :
4+ workflow_call :
5+ inputs :
6+ os :
7+ description : " Runner OS (e.g., ubuntu-latest, macos-latest, windows-latest)"
8+ required : true
9+ type : string
10+ python-version :
11+ description : " Python version to test"
12+ required : true
13+ type : string
14+ artifact-name :
15+ description : " Name of the wheel artifact to download"
16+ required : true
17+ type : string
18+ run-id :
19+ description : " Workflow run ID to download artifacts from (optional, uses current run if not specified)"
20+ required : false
21+ type : string
22+ secrets :
23+ LIVEKIT_URL :
24+ required : true
25+ LIVEKIT_API_KEY :
26+ required : true
27+ LIVEKIT_API_SECRET :
28+ required : true
1129
1230jobs :
13- build-rtc :
14- name : Build livekit-rtc wheel
15- runs-on : ubuntu-latest
31+ test :
32+ name : Test (${{ inputs.os }}, Python ${{ inputs.python-version }})
33+ runs-on : ${{ inputs.os }}
1634 steps :
17- - uses : actions/checkout@v6
18- with :
19- submodules : true
20-
21- - uses : actions/setup-python@v6
22- with :
23- python-version : " 3.9"
24-
25- - name : Install cibuildwheel
26- run : python3 -m pip install cibuildwheel==2.17.0
27-
28- - name : Build wheel
29- working-directory : ./livekit-rtc
30- run : python3 -m cibuildwheel --output-dir dist
31- env :
32- CIBW_ARCHS : x86_64
33-
34- - uses : actions/upload-artifact@v4
35- with :
36- name : rtc-wheel
37- path : livekit-rtc/dist/*.whl
38-
39- tests :
40- name : Run tests (Python ${{ matrix.python-version }})
41- needs : build-rtc
42- runs-on : ubuntu-latest
43- strategy :
44- fail-fast : false
45- matrix :
46- python-version : ["3.9", "3.10", "3.11", "3.12", "3.13"]
47- steps :
48- - uses : actions/checkout@v6
35+ - uses : actions/checkout@v4
4936 with :
5037 submodules : true
5138 lfs : true
5239
53- - uses : actions/setup-python@v6
40+ - uses : actions/setup-python@v4
5441 with :
55- python-version : ${{ matrix .python-version }}
42+ python-version : ${{ inputs .python-version }}
5643
5744 - name : Install uv
5845 uses : astral-sh/setup-uv@v5
5946 with :
6047 enable-cache : true
6148 cache-dependency-glob : " uv.lock"
6249
63- - name : Download livekit-rtc wheel
50+ - name : Download livekit-rtc wheel (current run)
51+ if : ${{ inputs.run-id == '' }}
52+ uses : actions/download-artifact@v4
53+ with :
54+ name : ${{ inputs.artifact-name }}
55+ path : rtc-wheel
56+
57+ - name : Download livekit-rtc wheel (from specific run)
58+ if : ${{ inputs.run-id != '' }}
6459 uses : actions/download-artifact@v4
6560 with :
66- name : rtc-wheel
61+ name : ${{ inputs.artifact-name }}
6762 path : rtc-wheel
63+ run-id : ${{ inputs.run-id }}
64+ github-token : ${{ github.token }}
6865
69- - name : Create venv and install dependencies
66+ - name : Create venv and install dependencies (Unix)
67+ if : runner.os != 'Windows'
7068 run : |
7169 uv venv .test-venv
7270 source .test-venv/bin/activate
7371 uv pip install rtc-wheel/*.whl ./livekit-api ./livekit-protocol
7472 uv pip install pytest pytest-asyncio numpy matplotlib
7573
76- - name : Run tests
74+ - name : Create venv and install dependencies (Windows)
75+ if : runner.os == 'Windows'
76+ run : |
77+ uv venv .test-venv
78+ .test-venv\Scripts\activate
79+ uv pip install (Get-ChildItem rtc-wheel\*.whl).FullName .\livekit-api .\livekit-protocol
80+ uv pip install pytest pytest-asyncio numpy matplotlib
81+ shell : pwsh
82+
83+ - name : Run tests (Unix)
84+ if : runner.os != 'Windows'
7785 env :
7886 LIVEKIT_URL : ${{ secrets.LIVEKIT_URL }}
7987 LIVEKIT_API_KEY : ${{ secrets.LIVEKIT_API_KEY }}
8088 LIVEKIT_API_SECRET : ${{ secrets.LIVEKIT_API_SECRET }}
8189 run : |
8290 source .test-venv/bin/activate
8391 pytest tests/
92+
93+ - name : Run tests (Windows)
94+ if : runner.os == 'Windows'
95+ env :
96+ LIVEKIT_URL : ${{ secrets.LIVEKIT_URL }}
97+ LIVEKIT_API_KEY : ${{ secrets.LIVEKIT_API_KEY }}
98+ LIVEKIT_API_SECRET : ${{ secrets.LIVEKIT_API_SECRET }}
99+ run : |
100+ .test-venv\Scripts\activate
101+ pytest tests/
102+ shell : pwsh
84103
0 commit comments