Skip to content

Commit e7bb685

Browse files
committed
chore: add CI automated testing
1 parent e2e73ce commit e7bb685

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

.github/workflows/test.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
17+
18+
steps:
19+
- uses: actions/checkout@v5
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install -e .
30+
pip install -r requirements-dev.txt
31+
32+
- name: Install browser for testing (Ubuntu)
33+
if: matrix.os == 'ubuntu-latest'
34+
run: |
35+
sudo apt-get update
36+
sudo apt-get install -y chromium-browser chromium-chromedriver xvfb
37+
38+
- name: Install browser for testing (macOS)
39+
if: matrix.os == 'macos-latest'
40+
run: |
41+
brew install --cask chromium chromedriver
42+
43+
- name: Install browser for testing (Windows)
44+
if: matrix.os == 'windows-latest'
45+
run: |
46+
choco install chromium chromedriver
47+
48+
- name: Start virtual display (Ubuntu)
49+
if: matrix.os == 'ubuntu-latest'
50+
run: |
51+
export DISPLAY=:99
52+
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
53+
54+
- name: Run tests
55+
run: |
56+
python -m pytest tests/ --cov=dash_vite_plugin --cov-report=xml
57+
env:
58+
DISPLAY: :99
59+
60+
- name: Upload coverage to Codecov
61+
uses: codecov/codecov-action@v5
62+
env:
63+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
64+
with:
65+
file: ./coverage.xml
66+
flags: unittests
67+
name: codecov-umbrella
68+
69+
lint-format:
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v5
73+
74+
- name: Set up Python
75+
uses: actions/setup-python@v5
76+
with:
77+
python-version: "3.10"
78+
79+
- name: Install dependencies
80+
run: |
81+
python -m pip install --upgrade pip
82+
pip install -e .
83+
pip install ruff
84+
85+
- name: Run linting
86+
run: |
87+
ruff check .
88+
89+
- name: Run format check
90+
run: |
91+
ruff format . --check

0 commit comments

Comments
 (0)