forked from microsoft/semantic-kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (66 loc) · 2.45 KB
/
python-test-coverage.yml
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: Python Test Coverage
on:
pull_request_target:
branches: ["main", "feature*"]
paths:
- "python/**"
workflow_run:
workflows: ["Python Unit Tests"]
types:
- in_progress
jobs:
python-tests-coverage:
name: Create Test Coverage Messages
runs-on: ${{ matrix.os }}
permissions:
pull-requests: write
contents: read
actions: read
strategy:
matrix:
python-version: ["3.10"]
os: [ubuntu-latest]
steps:
- name: Wait for unit tests to succeed
continue-on-error: true
uses: lewagon/[email protected]
with:
ref: ${{ github.event.pull_request.head.sha }}
check-name: 'Python Unit Tests (${{ matrix.python-version}}, ${{ matrix.os }})'
repo-token: ${{ secrets.GH_ACTIONS_PR_WRITE }}
wait-interval: 10
allowed-conclusions: success
- uses: actions/checkout@v4
- name: Download coverage
continue-on-error: true
uses: dawidd6/action-download-artifact@v3
with:
name: python-coverage-${{ matrix.os }}-${{ matrix.python-version }}.txt
github_token: ${{ secrets.GH_ACTIONS_PR_WRITE }}
workflow: python-unit-tests.yml
search_artifacts: true
if_no_artifact_found: warn
- name: Download pytest
continue-on-error: true
uses: dawidd6/action-download-artifact@v3
with:
name: pytest-${{ matrix.os }}-${{ matrix.python-version }}.xml
github_token: ${{ secrets.GH_ACTIONS_PR_WRITE }}
workflow: python-unit-tests.yml
search_artifacts: true
if_no_artifact_found: warn
- name: Pytest coverage comment
continue-on-error: true
id: coverageComment
uses: MishaKav/pytest-coverage-comment@main
with:
github-token: ${{ secrets.GH_ACTIONS_PR_WRITE }}
pytest-coverage-path: python-coverage-${{ matrix.os }}-${{ matrix.python-version }}.txt
coverage-path-prefix: "python/"
title: "Python ${{ matrix.python-version }} Test Coverage Report"
badge-title: "Py${{ matrix.python-version }} Test Coverage"
report-only-changed-files: true
junitxml-title: "Python ${{ matrix.python-version }} Unit Test Overview"
junitxml-path: pytest-${{ matrix.os }}-${{ matrix.python-version }}.xml
default-branch: "main"
unique-id-for-comment: python-${{ matrix.python-version }}