-
Notifications
You must be signed in to change notification settings - Fork 4
172 lines (148 loc) · 5.63 KB
/
publish-reports-github-pages.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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
##
## --------------------------------------------------------------------------------
## SPDX-FileCopyrightText: 2024 Martin Jan Köhler and Harald Pretl
## Johannes Kepler University, Institute for Integrated Circuits.
##
## This file is part of KPEX
## (see https://github.com/martinjankoehler/klayout-pex).
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
## SPDX-License-Identifier: GPL-3.0-or-later
## --------------------------------------------------------------------------------
##
name: "Publish test/coverage/lint reports to GitHub Pages"
on:
workflow_call:
# NOTE: concurrency settings must be defined in calling workflow!
# otherwise unexpected cancellations will happen
# example error: "Canceling since a higher priority waiting request for 'martinjankoehler/klayout-pex-release-v0.1.4-Multi-platform Python/C++ build/test' exists"
jobs:
allure-report:
name: "Generate Allure Report (Aggregated Suites)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# NOTE: actions/download-artifact@v4 now has merging functionality built in => no need for actions/upload-artifact/merge@v4
# - name: "Merge test results (Allure)"
# uses: actions/upload-artifact/merge@v4
# with:
# name: merged-allure-reports
# pattern: python-*-tests-allure-report-ubuntu*
# # delete-merged: true
# retention-days: 1
- name: "Download and merge Allure coverage artifacts"
uses: actions/download-artifact@v4
with:
pattern: python-*-tests-allure-report-*
merge-multiple: true
path: build/allure-results # destination
- name: "Set up JDK (for Allure)"
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
- name: "Load test report history (Allure)"
uses: actions/checkout@v4
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
- name: "Build test report"
uses: simple-elf/allure-report-action@master
if: always()
with:
gh_pages: allure-results
# allure_history: allure-history
allure_results: build/allure-results
subfolder: allure
# subfolder: allure-results
- name: "Publish test report"
uses: peaceiris/actions-gh-pages@v4
if: always()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: allure-history
destination_dir: ./
# destination_dir: ./allure
keep_files: true
merge-coverage-reports:
name: "Generate Coverage Report (Aggregated Suites)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "[🐍] Download and merge 📦 artifacts"
uses: actions/download-artifact@v4
with:
pattern: python-dist-ubuntu-latest*
merge-multiple: true
path: dist # destination
- name: "[🐍] Unpack Source 📦"
run: |
tar xvfz dist/klayout_pex*.tar.gz --strip-components=1
- name: "[🐍] Download and merge coverage artifacts"
uses: actions/download-artifact@v4
with:
pattern: python-*-tests-coverage-report-ubuntu-*
merge-multiple: false
path: pycov-databases # destination
- name: "Display structure of downloaded files"
run: ls -R pycov-databases
- name: "Print current working directory"
run: pwd
- name: "[🐍] Setup python"
id: setup-python
uses: actions/setup-python@v5
- name: "[🐍] Install dependencies"
run: |
python -m pip install --upgrade pip
pip install coverage
- name: "[🐍] Combine coverage reports"
run: |
coverage combine pycov-databases/*/python-coverage.sqlite
- name: "[🐍] Create HTML coverage report"
run: >
coverage html
--directory pycov
--data-file=.coverage
--omit="build/python/klayout_pex_protobuf/*_pb2.py"
- name: "Display structure of coverage report"
run: ls -R pycov
- name: "[🐍] Store merged coverage reports"
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: merged-coverage-report
path: pycov
retention-days: 1
if-no-files-found: error
publish-coverage-reports:
name: "Publish Coverage Report (Aggregated Suites)"
runs-on: ubuntu-latest
needs: merge-coverage-reports
steps:
- name: "Download merged coverage artifact"
uses: actions/download-artifact@v4
with:
name: merged-coverage-report
path: pycov # destination
- name: "Publish coverage reports"
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: pycov
destination_dir: pycov
keep_files: true