-
Notifications
You must be signed in to change notification settings - Fork 94
151 lines (127 loc) · 5.49 KB
/
regression_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
# The name of the workflow. GitHub displays the names of your
# workflows under your repository's "Action" tab.
name: regression_test
# Controls when the action will run.
on:
# Enable the workflow to be triggered manually.
workflow_dispatch:
# Get inputs
inputs:
# inputs.tests_to_run
tests_to_run:
description: 'all, single or multiple of default_build_coverage error_check_build_full_coverage tracex_enable_build device_buffer_owner_build device_zero_copy_build nofx_build_coverage optimized_build standalone_device_build_coverage standalone_device_buffer_owner_build standalone_device_zero_copy_build standalone_host_build_coverage standalone_build_coverage generic_build otg_support_build memory_management_build_coverage msrc_rtos_build msrc_standalone_build'
required: true
default: 'default_build_coverage'
# Triggers the workflow on push or pull request events but only for the master branch.
push:
branches: [ master ]
pull_request:
branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "run_tests".
run_tests:
# Use "permissions" to modify the default permissions granted to the "GITHUB_TOKEN".
permissions:
contents: read
issues: read
checks: write
pull-requests: write
# The type of runner that the job will run on.
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job.
steps:
# Check out the repository.
- name: Check out the repository
uses: actions/checkout@v4
with:
submodules: true
# Install software.
- name: Install softwares
run: ./scripts/install.sh
# Build tests.
- name: Build USBX
run: ./scripts/build.sh ${{ inputs.tests_to_run }}
# Run tests.
- name: Test USBX
run: ./scripts/test.sh ${{ inputs.tests_to_run }}
# Use "EnricoMi/publish-unit-test-result-action" action to publish test results.
- name: Publish Test Results
uses: EnricoMi/[email protected]
# By default, if the previous step fails, this step will not be executed.
# Add if condition to run this step even if the previous step fails
if: always()
with:
files: |
./test/cmake/usbx/build/*/*.xml
# Upload test results to artifacts
- name: Upload Test Results
if: success() || failure()
uses: actions/[email protected]
with:
name: test_reports_USBX
path: |
./test/cmake/usbx/build/*.txt
./test/cmake/usbx/build/*/Testing/**/*.xml
- name: Configure GitHub Pages # Enable GitHub Pages and extract various metadata about a site.
uses: actions/[email protected]
# Package and upload GitHub Pages artifact.
- name: Upload GitHub Pages artifact
uses: actions/[email protected]
with:
name: default_build_coverage_USBX
path: ./test/cmake/usbx/coverage_report/default_build_coverage
# Gegenerate code coverage results summary to code-coverage-results.md
- name: Generate Code Coverage Results Summary
uses: irongut/[email protected]
with:
filename: ./test/cmake/usbx/coverage_report/default_build_coverage.xml
format: markdown
badge: true
hide_complexity: true
output: file
# Create a new markdown file "code-coverage-summary.md".
# Put the coverage summary and report url to the new markdown file.
# Write the coverage summary to job summary.
- name: Write Code Coverage Report URL
run: |
echo "## Coverage Report" >> $GITHUB_STEP_SUMMARY
cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
- name: Create CheckRun for Code Coverage # Create check run to publish the code coverage summary to the check summary
uses: LouisBrunner/[email protected]
if: (github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == github.repository)
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Code Coverage
conclusion: ${{ job.status }}
output: |
{"summary":"Coverage Report"}
output_text_description_file: code-coverage-results.md
- name: Sticky Pull Request Comment
uses: marocchino/[email protected]
if: (github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == github.repository)
with:
# Indicate if new comment messages should be appended to previous comment message. Only `true` is allowed. Just skip this item when you don't need it.
append: true # optional, default is false
# glob path to file(s) containing comment message
path: code-coverage-results.md
deploy_code_coverage:
runs-on: ubuntu-latest
if: github.event_name == 'push'
needs: run_tests
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
steps:
# Deploing GitHub Pages artifacts for coverages.
- name: Deploy GitHub Pages site
id: deployment
uses: actions/[email protected]
with:
artifact_name: default_build_coverage_USBX
- name: Write Code Coverage Report URL
run: |
echo '[Open Coverage Report](${{ steps.deployment.outputs.page_url }})' >> $GITHUB_STEP_SUMMARY