-
Notifications
You must be signed in to change notification settings - Fork 51
160 lines (142 loc) · 5.53 KB
/
test.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
# Copyright 2021 Yubico AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Run tests
on:
workflow_dispatch:
inputs:
build-coverage-report:
type: boolean
default: true
required: false
description: 'Build a test coverage report'
workflow_call:
inputs:
build-coverage-report:
type: boolean
default: true
required: false
description: 'Build a test coverage report'
schedule:
- cron: '0 0 * * *' # Every day at midnight
# # Remove these comments to run tests on pull requests and pushes for the respective branches.
# pull_request:
# branches:
# - main
# - 'develop**'
# - 'release**'
# paths:
# - '**.h'
# - '**.c'
# - '**.cs'
# - '**.csproj'
# - '**.sln'
# - '.github/workflows/test.yml'
# push:
# branches:
# - main
# - develop
# paths:
# - '**.h'
# - '**.c'
# - '**.cs'
# - '**.csproj'
# - '**.sln'
# - '.github/workflows/test.yml'
permissions:
pull-requests: write
contents: read
checks: write
packages: read
jobs:
test-windows:
name: Tests
uses: ./.github/workflows/test-windows.yml
test-ubuntu:
name: Tests
uses: ./.github/workflows/test-ubuntu.yml
test-macos:
name: Tests
uses: ./.github/workflows/test-macos.yml
build-coverage-report:
name: Build coverage report
runs-on: ubuntu-latest
needs: [test-windows] # No need to gather coverage on all platforms
if: inputs.build-coverage-report == true
steps:
- uses: actions/download-artifact@v4
- name: Combine Coverage Reports # This is because one report is produced per project, and we want one result for all of them.
uses: danielpalme/ReportGenerator-GitHub-Action@5.2.4
with:
reports: "**/*.cobertura.xml" # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported.
targetdir: "${{ github.workspace }}" # REQUIRED # The directory where the generated report should be saved.
reporttypes: "Cobertura" # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, Html_Dark, Html_Light, Html_BlueRed, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlInline_AzurePipelines_Light, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MarkdownSummary, MarkdownSummaryGithub, MarkdownDeltaSummary, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, TextDeltaSummary, Xml, XmlSummary
verbosity: "Warning" # The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off
title: "Code Coverage" # Optional title.
tag: "${{ github.run_number }}_${{ github.run_id }}" # Optional tag or build version.
customSettings: "" # Optional custom settings (separated by semicolon). See: https://github.com/danielpalme/ReportGenerator/wiki/Settings.
toolpath: "reportgeneratortool" # Default directory for installing the dotnet tool.
- name: Code Coverage Summary Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: "Cobertura.xml"
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: false
indicators: true
output: both
thresholds: "40 60"
- name: Upload Code Coverage Report
uses: actions/upload-artifact@v4
with:
name: CoverageResults
path: code-coverage-results.md
pr-comment-coverage-results:
name: "Add PR Comment: Coverage Results"
runs-on: ubuntu-latest
needs: build-coverage-report
if: github.event_name == 'pull_request'
steps:
- name: Download coverage results
uses: actions/download-artifact@v4
with:
name: CoverageResults
- name: Add PR Comment
uses: marocchino/sticky-pull-request-comment@v2.9.0
with:
recreate: true
path: code-coverage-results.md
pr-comment-test-results:
name: "Add PR Comment: Test Results"
runs-on: ubuntu-latest
needs: [test-windows, test-ubuntu, test-macos]
if: github.event_name == 'pull_request'
steps:
- uses: actions/download-artifact@v4
- name: "Add PR Comment: Test Results (Windows)"
uses: EnricoMi/publish-unit-test-result-action@v2.16.1
with:
trx_files: "${{ github.workspace }}/TestResults-Windows/**/*.trx"
check_name: "Test Results: Windows"
- name: "Add PR Comment: Test Results (Ubuntu)"
uses: EnricoMi/publish-unit-test-result-action@v2.16.1
with:
trx_files: "${{ github.workspace }}/TestResults-Ubuntu/**/*.trx"
check_name: "Test Results: Ubuntu"
- name: "Add PR Comment: Test Results (MacOS)"
uses: EnricoMi/publish-unit-test-result-action@v2.16.1
with:
trx_files: "${{ github.workspace }}/TestResults-macOS/**/*.trx"
check_name: "Test Results: MacOS"