forked from netboxlabs/orb-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (49 loc) · 1.72 KB
/
Copy path_backend-test-python.yaml
File metadata and controls
52 lines (49 loc) · 1.72 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
name: Backend test (Python)
# Reusable pytest + coverage for a Python discovery backend (lint lives in the
# whole-repo lint workflow).
on:
workflow_call:
inputs:
app-name:
description: 'Backend app name (directory under orb-discovery/).'
required: true
type: string
python-module:
description: 'Python package directory (e.g. device_discovery) for the coverage path.'
required: true
type: string
permissions:
contents: read
pull-requests: write
jobs:
tests:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
python: [ "3.11", "3.12", "3.13", "3.14" ]
defaults:
run:
working-directory: orb-discovery/${{ inputs.app-name }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install .[dev]
pip install .[test]
- name: Run tests with coverage
run: |
set -o pipefail
pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=${{ inputs.python-module }}/ | tee pytest-coverage.txt
- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@dd5b80bde6d16941f336518e92929e89069d8451 # v1.7.2
if: github.event.pull_request.head.repo.full_name == github.repository
with:
pytest-coverage-path: orb-discovery/${{ inputs.app-name }}/pytest-coverage.txt
junitxml-path: orb-discovery/${{ inputs.app-name }}/pytest.xml