-
-
Notifications
You must be signed in to change notification settings - Fork 192
121 lines (108 loc) · 4.2 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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
# 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: 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@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