Changelog Preview for Next Release #548
Workflow file for this run
This file contains hidden or 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: Test and Build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop/** | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: | |
| - main | |
| - develop/** | |
| permissions: {} | |
| env: | |
| BUILD_PYTHON_VERSION: "3.13" | |
| jobs: | |
| set-build-info: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| branch: ${{ steps.build-info.outputs.branch }} | |
| tag: ${{ steps.build-info.outputs.tag }} | |
| trigger-sha: ${{ steps.build-info.outputs.trigger-sha }} | |
| head-sha: ${{ steps.build-info.outputs.head-sha }} | |
| pr-number: ${{ steps.build-info.outputs.pr-number }} | |
| steps: | |
| - name: Save build info (pull_request) | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| echo "${{ github.event.pull_request.head.ref }}" > branch | |
| echo "" > tag | |
| echo "${{ github.event.pull_request.head.sha }}" > head-sha | |
| echo "${{ github.sha }}" > trigger-sha | |
| echo "${{ github.event.pull_request.number }}" > pr-number | |
| - name: Save build info (push, branch) | |
| if: github.event_name == 'push' && github.ref_type == 'branch' | |
| run: | | |
| echo "${{ github.ref_name }}" > branch | |
| echo "" > tag | |
| echo "${{ github.sha }}" > head-sha | |
| echo "${{ github.sha }}" > trigger-sha | |
| echo "" > pr-number | |
| - name: Save build info (push, tag) | |
| if: github.event_name == 'push' && github.ref_type == 'tag' | |
| run: | | |
| echo "" > branch | |
| echo "${{ github.ref_name }}" > tag | |
| echo "${{ github.sha }}" > head-sha | |
| echo "${{ github.sha }}" > trigger-sha | |
| echo "" > pr-number | |
| - name: Output build info | |
| id: build-info | |
| run: | | |
| echo "branch=$(cat branch)" >> $GITHUB_OUTPUT | |
| echo "tag=$(cat tag)" >> $GITHUB_OUTPUT | |
| echo "trigger-sha=$(cat trigger-sha)" >> $GITHUB_OUTPUT | |
| echo "head-sha=$(cat head-sha)" >> $GITHUB_OUTPUT | |
| echo "pr-number=$(cat pr-number)" >> $GITHUB_OUTPUT | |
| - name: Upload build info | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: build-info | |
| path: | | |
| branch | |
| tag | |
| head-sha | |
| trigger-sha | |
| pr-number | |
| test-python: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Run Ruff | |
| run: | | |
| uv run ruff check --output-format=github . | |
| uv run ruff format . --check | |
| - name: Type checking with mypy | |
| run: uv run mypy . | |
| - name: Release check | |
| run: uv run scripts/release_check.py streamlit_webrtc/component.py | |
| # The frontend build directory is necessary to import the package | |
| # avoiding an error from `components.declare_component`. | |
| - name: Create a mock frontend build directory | |
| run: mkdir streamlit_webrtc/frontend/dist | |
| - name: Test with pytest | |
| run: uv run pytest | |
| test-frontend: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: streamlit_webrtc/frontend | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5 | |
| name: Install pnpm | |
| with: | |
| version: 10 | |
| run_install: false | |
| - name: Install Node.js | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| cache: 'pnpm' | |
| node-version-file: .nvmrc | |
| cache-dependency-path: streamlit_webrtc/frontend/pnpm-lock.yaml | |
| - uses: ./.github/actions/install-safe-chain | |
| - uses: ./.github/actions/setup-takumi-guard | |
| - name: Install dependencies | |
| run: pnpm install | |
| - run: pnpm run lint | |
| - run: pnpm run build | |
| - run: pnpm test | |
| build: | |
| needs: [test-python, test-frontend] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 # Fetch all history for hatch-vcs to get the correct version | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| - name: Set up Python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: "${{ env.BUILD_PYTHON_VERSION }}" | |
| - name: Install Python dependencies | |
| run: uv sync --all-extras --dev | |
| # Set up frontend dependencies | |
| - uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5 | |
| name: Install pnpm | |
| with: | |
| version: 10 | |
| run_install: false | |
| - name: Install Node.js | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| cache: 'pnpm' | |
| node-version-file: .nvmrc | |
| cache-dependency-path: streamlit_webrtc/frontend/pnpm-lock.yaml | |
| - uses: ./.github/actions/install-safe-chain | |
| - uses: ./.github/actions/setup-takumi-guard | |
| - name: Install dependencies | |
| run: pnpm install | |
| working-directory: streamlit_webrtc/frontend | |
| - name: Build | |
| run: make build | |
| - name: Upload the built artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: streamlit-webrtc-${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || github.sha }} | |
| path: dist | |
| docs-build: | |
| needs: [test-python, test-frontend] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Configure Git Credentials | |
| run: | | |
| git config user.name github-actions[bot] | |
| git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| - name: Set up Python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: "${{ env.BUILD_PYTHON_VERSION }}" | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - run: uv run mkdocs build | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 | |
| with: | |
| # Upload entire repository | |
| path: './site' | |
| docs-deploy: | |
| needs: docs-build | |
| if: github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Setup Pages | |
| uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 |