Skip to content

Commit 45ceeba

Browse files
committed
reuse existing build
1 parent d7b4936 commit 45ceeba

File tree

2 files changed

+114
-48
lines changed

2 files changed

+114
-48
lines changed

.github/workflows/build-rtc.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,53 @@ jobs:
136136

137137
- uses: pypa/gh-action-pypi-publish@release/v1
138138

139+
test:
140+
name: Test (${{ matrix.os }}, Python ${{ matrix.python-version }})
141+
needs: [build_wheels]
142+
strategy:
143+
fail-fast: false
144+
matrix:
145+
include:
146+
# Linux x86_64 tests
147+
- os: ubuntu-latest
148+
python-version: "3.9"
149+
artifact: rtc-release-ubuntu-latest
150+
- os: ubuntu-latest
151+
python-version: "3.10"
152+
artifact: rtc-release-ubuntu-latest
153+
- os: ubuntu-latest
154+
python-version: "3.11"
155+
artifact: rtc-release-ubuntu-latest
156+
- os: ubuntu-latest
157+
python-version: "3.12"
158+
artifact: rtc-release-ubuntu-latest
159+
- os: ubuntu-latest
160+
python-version: "3.13"
161+
artifact: rtc-release-ubuntu-latest
162+
# macOS tests (arm64 runner)
163+
- os: macos-latest
164+
python-version: "3.9"
165+
artifact: rtc-release-macos-latest
166+
- os: macos-latest
167+
python-version: "3.12"
168+
artifact: rtc-release-macos-latest
169+
# Windows tests
170+
- os: windows-latest
171+
python-version: "3.9"
172+
artifact: rtc-release-windows-latest
173+
- os: windows-latest
174+
python-version: "3.12"
175+
artifact: rtc-release-windows-latest
176+
uses: ./.github/workflows/tests.yml
177+
with:
178+
os: ${{ matrix.os }}
179+
python-version: ${{ matrix.python-version }}
180+
artifact-name: ${{ matrix.artifact }}
181+
secrets:
182+
LIVEKIT_URL: ${{ secrets.LIVEKIT_URL }}
183+
LIVEKIT_API_KEY: ${{ secrets.LIVEKIT_API_KEY }}
184+
LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }}
185+
139186
docs:
140187
needs: [publish]
141188
uses: ./.github/workflows/build-docs.yml

.github/workflows/tests.yml

Lines changed: 67 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,103 @@
11
name: Tests
22

33
on:
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

1230
jobs:
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

Comments
 (0)