Skip to content

Commit

Permalink
Added input skip_coverage and coverage_name for customiziing. (eclips…
Browse files Browse the repository at this point in the history
…e-threadx#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
xiaocq2001 and TiejunMS authored Nov 27, 2023
1 parent cad6c42 commit a8e5d09
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions .github/workflows/regression_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand All @@ -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
Expand Down Expand Up @@ -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

0 comments on commit a8e5d09

Please sign in to comment.