Add frame callbacks for the SENDONLY mode (#1347) #1817
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: | |
- main | |
- develop/** | |
paths-ignore: | |
- 'streamlit_webrtc/frontend/**' | |
pull_request: | |
branches: | |
- main | |
- develop/** | |
paths-ignore: | |
- 'streamlit_webrtc/frontend/**' | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
streamlit-version: [null] | |
include: | |
# Test with streamlit <1.4.0 and >=1.4.0. See https://github.com/whitphx/streamlit-webrtc/issues/598 | |
- python-version: 3.9 | |
streamlit-version: 1.0.0 | |
- python-version: 3.9 | |
streamlit-version: 1.4.0 | |
# Test with streamlit >=1.6.0. See https://github.com/whitphx/streamlit-webrtc/issues/709 | |
- python-version: 3.9 | |
streamlit-version: 1.6.0 | |
# Test with streamlit >=1.8.0. See https://github.com/whitphx/streamlit-webrtc/issues/759 | |
- python-version: 3.9 | |
streamlit-version: 1.8.0 | |
# Test with streamlit >=1.12.0. See https://github.com/whitphx/streamlit-webrtc/issues/1004 | |
- python-version: 3.9 | |
streamlit-version: 1.12.0 | |
# Test with streamlit >=1.12.1. See https://github.com/whitphx/streamlit-webrtc/issues/1024 | |
- python-version: 3.9 | |
streamlit-version: 1.12.1 | |
# Test with streamlit >=1.14.0. See https://github.com/whitphx/streamlit-webrtc/pull/1189 | |
- python-version: 3.9 | |
streamlit-version: 1.14.0 | |
# Test with streamlit >=1.18.0. See https://github.com/whitphx/streamlit-webrtc/issues/1187 | |
- python-version: 3.9 | |
streamlit-version: 1.18.0 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# The following steps are based on https://github.com/python-poetry/poetry/blob/def1ee8f3ae00c307ca028da53d2347615c5c32b/.github/workflows/main.yml#L51-L84 | |
- name: Get full Python version | |
id: full-python-version | |
run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT | |
- name: Bootstrap poetry | |
run: | | |
curl -sL https://install.python-poetry.org | python - -y | |
- name: Update PATH | |
run: echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Configure poetry | |
run: poetry config virtualenvs.in-project true | |
- name: Set up cache | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Ensure cache is healthy | |
if: steps.cache.outputs.cache-hit == 'true' | |
run: timeout 10s pip --version || rm -rf .venv | |
- name: Install a specific version of Streamlit | |
if: ${{ matrix.streamlit-version }} | |
run: poetry add -D streamlit=="${STREAMLIT_VERSION}" setuptools | |
env: | |
STREAMLIT_VERSION: ${{ matrix.streamlit-version }} | |
- name: Install dependencies | |
run: poetry install | |
- name: Lint with black, isort, and flake8 | |
run: | | |
poetry run black . --check | |
poetry run isort . --check --resolve-all-configs | |
poetry run flake8 | |
- name: Type checking with mypy | |
run: | | |
poetry run mypy . | |
- name: Release check | |
run: python scripts/release_check.py streamlit_webrtc/component.py | |
# Frontend build is necessary for the package to be importable, in the tests | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
cache: 'npm' | |
cache-dependency-path: streamlit_webrtc/frontend/package-lock.json | |
- name: Install the frontend dependencies | |
run: npm ci | |
working-directory: streamlit_webrtc/frontend | |
- name: Build the frontend | |
run: npm run build --if-present | |
working-directory: streamlit_webrtc/frontend | |
- name: Test with pytest | |
run: | | |
poetry run pytest |