From a8e5d0946c31385ff97bb27b67b2cdd905b9a58b Mon Sep 17 00:00:00 2001 From: CQ Xiao <53201544+xiaocq2001@users.noreply.github.com> Date: Mon, 27 Nov 2023 11:50:52 +0800 Subject: [PATCH] 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 <50469179+TiejunMS@users.noreply.github.com> --------- Co-authored-by: TiejunZhou <50469179+TiejunMS@users.noreply.github.com> --- .github/workflows/regression_template.yml | 33 +++++++++++++++-------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/.github/workflows/regression_template.yml b/.github/workflows/regression_template.yml index ce124fd85..ae84682c3 100644 --- a/.github/workflows/regression_template.yml +++ b/.github/workflows/regression_template.yml @@ -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/configure-pages@v3.0.6 - name: Generate Code Coverage Results Summary + if: (!inputs.skip_coverage) uses: irongut/CodeCoverageSummary@v1.3.0 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/checks-action@v1.6.2 with: token: ${{ secrets.GITHUB_TOKEN }} @@ -115,22 +125,23 @@ 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/upload-artifact@v3.1.3 - if: ${{ inputs.skip_deploy }} + if: (inputs.skip_deploy && !inputs.skip_coverage) with: name: coverage_report path: ${{ inputs.cmake_path }}/coverage_report @@ -138,13 +149,13 @@ jobs: - name: Upload Code Coverage Pages uses: actions/upload-pages-artifact@v2.0.0 - 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 \ No newline at end of file + echo 'Coverage report: ${{ steps.deployment.outputs.page_url }}' >> $GITHUB_STEP_SUMMARY + fi