-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (71 loc) · 2.33 KB
/
data-py-uv-tests.yml
File metadata and controls
71 lines (71 loc) · 2.33 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
69
70
71
name: Run tests
on:
workflow_call:
inputs:
SRC_PATH:
type: string
required: true
TESTS_PATH:
type: string
required: true
python-version:
type: string
required: true
pytest-markers:
type: string
required: false
default: 'not integration'
coverage-omit:
type: string
required: false
default: ''
runs-on:
type: string
required: false
default: '["self-hosted", "ubuntu-22.04"]'
permissions:
pull-requests: write
contents: read
jobs:
test-and-check-coverage:
runs-on: ${{ fromJSON(inputs.runs-on) }}
name: Test and Check Coverage
timeout-minutes: 15
steps:
- name: Check out Source Repository
uses: actions/checkout@v6
- name: Get Modified Python Files
id: changed-python-files
uses: tj-actions/changed-files@v47
with:
files: |
**/*.py
uv.lock
pyproject.toml
- name: Set up Python Environment
if: steps.changed-python-files.outputs.any_changed == 'true'
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
- name: Set up uv
if: steps.changed-python-files.outputs.any_changed == 'true'
uses: astral-sh/setup-uv@v7
with:
version: "latest"
- name: Install Dependencies
if: steps.changed-python-files.outputs.any_changed == 'true'
run: uv sync --extra dev
- name: Run Tests with Coverage
if: steps.changed-python-files.outputs.any_changed == 'true'
run: |
if [ -n "${{ inputs.coverage-omit }}" ]; then
uv run pytest --cov=${{ inputs.SRC_PATH }} --cov-omit=${{ inputs.coverage-omit }} --cov-report=xml --cov-report=term -m "${{ inputs.pytest-markers }}" -v ${{ inputs.TESTS_PATH }}
else
uv run pytest --cov=${{ inputs.SRC_PATH }} --cov-report=xml --cov-report=term -m "${{ inputs.pytest-markers }}" -v ${{ inputs.TESTS_PATH }}
fi
- name: Upload Coverage Report
if: ${{ steps.changed-python-files.outputs.any_changed == 'true' && github.event_name == 'pull_request' }}
uses: orgoro/coverage@v3.2
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}