1
+ # This is a basic workflow that is manually triggered
2
+
3
+ name : regression_template
4
+
5
+ on :
6
+ workflow_call :
7
+ inputs :
8
+ install_script :
9
+ default : ' ./scripts/install.sh'
10
+ required : false
11
+ type : string
12
+ build_script :
13
+ default : ' ./scripts/build.sh'
14
+ required : false
15
+ type : string
16
+ test_script :
17
+ default : ' ./scripts/test.sh'
18
+ required : false
19
+ type : string
20
+ cmake_path :
21
+ default : ' ./test/cmake'
22
+ required : false
23
+ type : string
24
+ deploy_url_affix :
25
+ default : ' '
26
+ required : false
27
+ type : string
28
+ result_affix :
29
+ default : ' '
30
+ required : false
31
+ type : string
32
+
33
+ # A workflow run is made up of one or more jobs that can run sequentially or in parallel
34
+ jobs :
35
+ # This workflow contains a single job called "linux_job"
36
+ run_tests :
37
+ permissions :
38
+ contents : read
39
+ issues : read
40
+ checks : write
41
+ pull-requests : write
42
+
43
+ # The type of runner that the job will run on
44
+ runs-on : ubuntu-latest
45
+
46
+ # Steps represent a sequence of tasks that will be executed as part of the job
47
+ steps :
48
+ - name : Check out the repository
49
+ uses : actions/checkout@v4
50
+ with :
51
+ submodules : true
52
+
53
+ - name : Install softwares
54
+ run : ${{ inputs.install_script }}
55
+
56
+ - name : Build
57
+ run : ${{ inputs.build_script }}
58
+
59
+ - name : Test
60
+ run : ${{ inputs.test_script }}
61
+
62
+ - name : Publish Test Results
63
+
64
+ if : always()
65
+ with :
66
+ check_name : Test Results ${{ inputs.result_affix }}
67
+ files : |
68
+ ${{ inputs.cmake_path }}/build/*/*.xml
69
+
70
+ - name : Upload Test Results
71
+ if : success() || failure()
72
+
73
+ with :
74
+ name : test_reports
75
+ path : |
76
+ ${{ inputs.cmake_path }}/build/*.txt
77
+ ${{ inputs.cmake_path }}/build/*/Testing/**/*.xml
78
+
79
+ - name : Configure GitHub Pages
80
+
81
+
82
+ - name : Upload GitHub Pages artifact
83
+
84
+ with :
85
+ path : ${{ inputs.cmake_path }}/coverage_report/default_build_coverage
86
+
87
+ - name : Generate Code Coverage Results Summary
88
+
89
+ with :
90
+ filename : ${{ inputs.cmake_path }}/coverage_report/default_build_coverage.xml
91
+ format : markdown
92
+ badge : true
93
+ hide_complexity : true
94
+ output : file
95
+
96
+ - name : Write Code Coverage Summary
97
+ run : |
98
+ echo "## Coverage Report ${{ inputs.result_affix }}" >> $GITHUB_STEP_SUMMARY
99
+ cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
100
+
101
+ - name : Create CheckRun for Code Coverage
102
+ if : (github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == github.repository)
103
+ uses :
LouisBrunner/[email protected]
104
+ with :
105
+ token : ${{ secrets.GITHUB_TOKEN }}
106
+ name : Code Coverage ${{ inputs.result_affix }}
107
+ conclusion : ${{ job.status }}
108
+ output : |
109
+ {"summary":"Coverage Report"}
110
+ output_text_description_file : code-coverage-results.md
111
+
112
+ - name : Add Code Coverage PR Comment
113
+ if : (github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == github.repository)
114
+ uses : marocchino/sticky-pull-request-comment@v2
115
+ with :
116
+ header : Code Coverage ${{ inputs.result_affix }}
117
+ path : code-coverage-results.md
118
+
119
+ deploy_code_coverage :
120
+ runs-on : ubuntu-latest
121
+ if : github.event_name == 'push'
122
+ needs : run_tests
123
+ environment :
124
+ name : github-pages
125
+ url : ${{ steps.deployment.outputs.page_url }}${{ inputs.deploy_url_affix }}
126
+ permissions :
127
+ pages : write
128
+ id-token : write
129
+
130
+ steps :
131
+ - name : Deploy GitHub Pages site
132
+ id : deployment
133
+
134
+
135
+ - name : Write Code Coverage Report URL
136
+ run : |
137
+ echo '[Open Coverage Report](${{ steps.deployment.outputs.page_url }}${{ inputs.deploy_url_affix }})' >> $GITHUB_STEP_SUMMARY
0 commit comments