-
Notifications
You must be signed in to change notification settings - Fork 794
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added input skip_coverage and coverage_name for customiziing. (#327)
* Update regression_template.yml * Update regression_template.yml * Update regression_template.yml * Update regression_template.yml * Update regression_template.yml * Update regression_template.yml Coverage name of all -> default_build_coverage * Update regression_template.yml * Update regression_template.yml Check inputs.skip_coverage to do steps. * Update regression_template.yml * Update regression_template.yml * Update regression_template.yml * Update regression_template.yml Enable coverage upload when manually triggered. * Update regression_template.yml * Update regression_template.yml * Update regression_template.yml * Update .github/workflows/regression_template.yml Fix comments. Co-authored-by: TiejunZhou <[email protected]> --------- Co-authored-by: TiejunZhou <[email protected]>
- Loading branch information
1 parent
cad6c42
commit a8e5d09
Showing
1 changed file
with
22 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,14 @@ on: | |
default: false | ||
required: false | ||
type: boolean | ||
skip_coverage: | ||
default: false | ||
required: false | ||
type: boolean | ||
coverage_name: | ||
default: 'default_build_coverage' | ||
required: false | ||
type: string | ||
skip_deploy: | ||
default: false | ||
required: false | ||
|
@@ -90,21 +98,23 @@ jobs: | |
uses: actions/[email protected] | ||
|
||
- name: Generate Code Coverage Results Summary | ||
if: (!inputs.skip_coverage) | ||
uses: irongut/[email protected] | ||
with: | ||
filename: ${{ inputs.cmake_path }}/coverage_report/default_build_coverage.xml | ||
filename: ${{ inputs.cmake_path }}/coverage_report/${{ inputs.coverage_name }}.xml | ||
format: markdown | ||
badge: true | ||
hide_complexity: true | ||
output: file | ||
|
||
- name: Write Code Coverage Summary | ||
if: (!inputs.skip_coverage) | ||
run: | | ||
echo "## Coverage Report ${{ inputs.result_affix }}" >> $GITHUB_STEP_SUMMARY | ||
cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY | ||
- name: Create CheckRun for Code Coverage | ||
if: (github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == github.repository) | ||
if: ((github.event_name == 'push') || (github.event_name == 'workflow_dispatch') || (github.event.pull_request.head.repo.full_name == github.repository)) && (!inputs.skip_coverage) | ||
uses: LouisBrunner/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
@@ -115,36 +125,37 @@ jobs: | |
output_text_description_file: code-coverage-results.md | ||
|
||
- name: Add Code Coverage PR Comment | ||
if: (github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == github.repository) | ||
if: ((github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == github.repository)) && (!inputs.skip_coverage) | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
header: Code Coverage ${{ inputs.result_affix }} | ||
path: code-coverage-results.md | ||
|
||
- name: Prepare GitHub Pages | ||
- name: Prepare Coverage GitHub Pages | ||
if: (!inputs.skip_coverage) | ||
run: >- | ||
if [ "${{ inputs.result_affix }}" != "" ]; then | ||
mv ${{ inputs.cmake_path }}/coverage_report/default_build_coverage \ | ||
mv ${{ inputs.cmake_path }}/coverage_report/${{ inputs.coverage_name }} \ | ||
${{ inputs.cmake_path }}/coverage_report/${{ inputs.result_affix }} | ||
fi | ||
- name: Upload Code Coverage Artifacts | ||
uses: actions/[email protected] | ||
if: ${{ inputs.skip_deploy }} | ||
if: (inputs.skip_deploy && !inputs.skip_coverage) | ||
with: | ||
name: coverage_report | ||
path: ${{ inputs.cmake_path }}/coverage_report | ||
retention-days: 1 | ||
|
||
- name: Upload Code Coverage Pages | ||
uses: actions/[email protected] | ||
if: ${{ !inputs.skip_deploy }} | ||
if: (!inputs.skip_deploy && !inputs.skip_coverage) | ||
with: | ||
path: ${{ inputs.cmake_path }}/coverage_report/default_build_coverage | ||
path: ${{ inputs.cmake_path }}/coverage_report/${{ inputs.coverage_name }} | ||
|
||
deploy_code_coverage: | ||
runs-on: ubuntu-latest | ||
if: ${{ (github.event_name == 'push') && !inputs.skip_deploy && !failure() && !cancelled() }} | ||
if: ((github.event_name == 'push') || (github.event_name == 'workflow_dispatch')) && !inputs.skip_coverage && !inputs.skip_deploy && !failure() && !cancelled() | ||
needs: run_tests | ||
environment: | ||
name: github-pages | ||
|
@@ -181,5 +192,5 @@ jobs: | |
echo 'Coverage report for ' $i ':${{ steps.deployment.outputs.page_url }}'$i >> $GITHUB_STEP_SUMMARY | ||
done | ||
else | ||
echo 'Coverage report: (${{ steps.deployment.outputs.page_url }}' >> $GITHUB_STEP_SUMMARY | ||
fi | ||
echo 'Coverage report: ${{ steps.deployment.outputs.page_url }}' >> $GITHUB_STEP_SUMMARY | ||
fi |