Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
68 lines (65 loc) · 2.06 KB
/
Copy pathaction.yml
File metadata and controls
68 lines (65 loc) · 2.06 KB
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
name: Testing Python Package
description: "Runs linter, static type checking and tests for a Python package."
inputs:
package-path:
description: "Specifies the Python package directory for coverage reporting."
required: true
py-version:
description: "Version of Python used to execute the tests."
required: true
ffmpeg-required:
description: "Determines if FFMPEG installation is needed."
required: false
default: false
test-path:
description: "Directory containing the test files."
required: false
default: tests/
uv-sync-args:
description: "Optional CLI flags passed to 'uv sync' (e.g., '--extra opt1 --extra opt2')."
required: false
default: ""
playwright-required:
description: "Determines if playwright installation is needed."
required: false
default: false
runs:
using: composite
steps:
- name: Install ffmpeg
if: inputs.ffmpeg-required
uses: FedericoCarboni/setup-ffmpeg@v2
- name: Set up Python ${{ inputs.py-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.py-version }}
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install the project
shell: bash
run: uv sync --locked --dev ${{ inputs.uv-sync-args }}
- name: Linting
shell: bash
run: uv run flake8 .
- name: Static type checking
shell: bash
run: uv run mypy .
- name: Install Playwright browsers (Ubuntu)
if: runner.os == 'Linux' && inputs.playwright-required
shell: bash
run: |
uv pip install --upgrade pip
uv pip install playwright
uv run playwright install --with-deps
- name: Install Playwright browsers (Windows)
if: runner.os == 'Windows' && inputs.playwright-required
shell: powershell
run: |
uv pip install --upgrade pip
uv pip install playwright
uv run playwright install
- name: Testing
shell: bash
run: uv run pytest --cov=${{ inputs.package-path }} ${{ inputs.test-path }}