Skip to content

Bump @testing-library/jest-dom from 5.16.5 to 6.4.4 in /streamlit_webrtc/frontend #2062

Bump @testing-library/jest-dom from 5.16.5 to 6.4.4 in /streamlit_webrtc/frontend

Bump @testing-library/jest-dom from 5.16.5 to 6.4.4 in /streamlit_webrtc/frontend #2062

Workflow file for this run

name: Test, Build, and Publish
on:
push:
branches:
- main
- develop/**
tags:
- 'v*'
pull_request:
branches:
- main
- develop/**
jobs:
test-python:
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
# Test with streamlit >=1.27.0. See https://github.com/whitphx/streamlit-webrtc/pull/1393
- python-version: 3.9
streamlit-version: 1.27.0
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
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@v4
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: Run Ruff
run: |
poetry run ruff check --output-format=github .
poetry run ruff format . --check
- 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@v4
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
test-frontend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: streamlit_webrtc/frontend
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'npm'
cache-dependency-path: streamlit_webrtc/frontend/package-lock.json
- run: npm ci
- name: Lint
run: |
npm run check:eslint
npm run check:prettier
- run: npm run build --if-present
- run: npm test
build:
if: ${{ ! failure() }} # This job should run even if the depending jobs are skipped, but not when those jobs failed: https://qiita.com/abetomo/items/d9ede7dbeeb24f723fc5#%E8%A8%AD%E5%AE%9A%E4%BE%8B4
needs: [test-python, test-frontend]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
# 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@v4
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 Python dependencies
run: poetry install
- name: Install fronend dependencies
run: npm ci
working-directory: streamlit_webrtc/frontend
- name: Build
run: make pkg/build
- name: Upload the built artifacts
uses: actions/upload-artifact@v4
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
with:
path: dist
name: streamlit-webrtc-${{ github.sha }}
- name: Upload the built artifacts (when pushed with a version tag)
uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/v')
with:
path: dist
name: streamlit-webrtc-${{ github.ref_name }}
publish:
if: ${{ !failure() && startsWith(github.ref, 'refs/tags/v') }} # `!failure()` is necessary to avoid skipping this job after successful build: https://github.com/actions/runner/issues/491
needs: [build]
permissions:
contents: write # Necessary for creating releases: https://github.com/softprops/action-gh-release#permissions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Bootstrap poetry
run: |
curl -sL https://install.python-poetry.org | python - -y
- name: Update PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- uses: actions/download-artifact@v4
with:
name: streamlit-webrtc-${{ github.ref_name }}
path: dist
- name: Publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: poetry publish -u __token__ -p ${PYPI_TOKEN}
- name: Create a new release
uses: softprops/action-gh-release@v2
with:
files: dist/*
generate_release_notes: true