-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (39 loc) · 1.02 KB
/
ci-python-reusable.yml
File metadata and controls
47 lines (39 loc) · 1.02 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
---
name: CI Python (Reusable)
on:
workflow_call:
inputs:
python_version:
description: 'Python version to use'
required: false
default: '3.12'
type: string
run_tests:
description: 'Whether to run pytest'
required: false
default: true
type: boolean
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: Set up Python
run: uv python install ${{ inputs.python_version }}
- name: Install dependencies
run: uv sync --frozen
- name: Run pre-commit hooks
run: uv run pre-commit run --all-files
- name: Run tests
if: inputs.run_tests
run: |
if [ -d "tests" ]; then
uv run pytest --cov --cov-report=term-missing
else
echo "No tests directory found, skipping tests"
fi