-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (91 loc) · 2.85 KB
/
Copy pathcoverage.yml
File metadata and controls
102 lines (91 loc) · 2.85 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Coverage
on:
workflow_run:
workflows: [Test]
types: [completed]
permissions:
contents: read
actions: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }}
cancel-in-progress: true
jobs:
discover-coverage:
name: Discover coverage files
if: |
github.event.workflow_run.conclusion != 'cancelled' &&
github.event.workflow_run.event != 'merge_group'
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.discover.outputs.matrix }}
steps:
- name: Download coverage artifact
uses: actions/download-artifact@v8
with:
path: packages
name: coverage-lcov
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Glob lcov files
id: glob
uses: tj-actions/glob@v22
with:
files: packages/**/coverage/lcov.info
separator: "\n"
- name: Build matrix
id: discover
run: |
MATRIX=$(jq -Rsc 'split("\n") | map(select(length > 0)) | map({
file: .,
flag: (split("/")[-3])
})' "${{ steps.glob.outputs.paths-output-file }}")
echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT"
upload-test-results:
name: Upload test results
if: |
github.event.workflow_run.conclusion != 'cancelled' &&
github.event.workflow_run.event != 'merge_group'
runs-on: ubuntu-latest
steps:
- name: Download test results artifact
uses: actions/download-artifact@v8
with:
name: test-results
path: .
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload to Codecov
uses: codecov/codecov-action@v7
with:
report_type: test_results
files: test-report.junit.xml
disable_search: true
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
upload-coverage:
name: Upload coverage (${{ matrix.flag }})
needs: discover-coverage
if: |
needs.discover-coverage.outputs.matrix != '[]' &&
needs.discover-coverage.outputs.matrix != ''
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.discover-coverage.outputs.matrix) }}
steps:
- name: Download coverage artifact
uses: actions/download-artifact@v8
with:
path: packages
name: coverage-lcov
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Upload to Codecov
uses: codecov/codecov-action@v7
with:
files: ${{ matrix.file }}
flags: ${{ matrix.flag }}
disable_search: true
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}