mirror of
https://github.com/azure-rtos/guix.git
synced 2025-01-28 07:03:11 +08:00
Put code coverage deploy action into a separate job. (#74)
* Split into two jobs "run_tests" and "deploy_code_coverage". * Update regression_test.yml * Update regression_test.yml * Remove code coverage checkrun. * Update regression_test.yml * Add code coverage checkrun. * Skip create code coverage and PR comment when the PR is from a fork repo.
This commit is contained in:
parent
94dcd14428
commit
3d9fa9e069
48
.github/workflows/regression_test.yml
vendored
48
.github/workflows/regression_test.yml
vendored
@ -15,13 +15,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
# This workflow contains a single job called "linux_job"
|
# This workflow contains a single job called "linux_job"
|
||||||
run_tests:
|
run_tests:
|
||||||
environment:
|
|
||||||
name: github-pages
|
|
||||||
url: ${{ steps.deployment.outputs.page_url }}
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
pages: write
|
|
||||||
id-token: write
|
|
||||||
contents: read
|
contents: read
|
||||||
issues: read
|
issues: read
|
||||||
checks: write
|
checks: write
|
||||||
@ -71,12 +65,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: ./test/guix_test/cmake/coverage_report/default_build_coverage
|
path: ./test/guix_test/cmake/coverage_report/default_build_coverage
|
||||||
|
|
||||||
- name: Deploy GitHub Pages site
|
- name: Generate Code Coverage Summary
|
||||||
if: github.event_name == 'push'
|
|
||||||
id: deployment
|
|
||||||
uses: actions/deploy-pages@v1.2.9
|
|
||||||
|
|
||||||
- name: Generate Code Coverage Results Summary
|
|
||||||
uses: irongut/CodeCoverageSummary@v1.3.0
|
uses: irongut/CodeCoverageSummary@v1.3.0
|
||||||
with:
|
with:
|
||||||
filename: ./test/guix_test/cmake/coverage_report/default_build_coverage.xml
|
filename: ./test/guix_test/cmake/coverage_report/default_build_coverage.xml
|
||||||
@ -85,16 +74,13 @@ jobs:
|
|||||||
hide_complexity: true
|
hide_complexity: true
|
||||||
output: file
|
output: file
|
||||||
|
|
||||||
- name: Write Code Coverage Report URL
|
- name: Write Code Coverage Summary
|
||||||
run: |
|
run: |
|
||||||
cat code-coverage-results.md > code-coverage-summary.md
|
|
||||||
echo -e "\n" >> code-coverage-summary.md
|
|
||||||
echo '[Open Coverage Report](${{ steps.deployment.outputs.page_url }})' >> code-coverage-summary.md
|
|
||||||
echo "## Coverage Report" >> $GITHUB_STEP_SUMMARY
|
echo "## Coverage Report" >> $GITHUB_STEP_SUMMARY
|
||||||
cat code-coverage-summary.md >> $GITHUB_STEP_SUMMARY
|
cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
- name: Create CheckRun for Code Coverage
|
- name: Create CheckRun for Code Coverage
|
||||||
if: github.event_name == 'push'
|
if: (github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == github.repository)
|
||||||
uses: LouisBrunner/checks-action@v1.6.2
|
uses: LouisBrunner/checks-action@v1.6.2
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@ -102,12 +88,32 @@ jobs:
|
|||||||
conclusion: ${{ job.status }}
|
conclusion: ${{ job.status }}
|
||||||
output: |
|
output: |
|
||||||
{"summary":"Coverage Report"}
|
{"summary":"Coverage Report"}
|
||||||
output_text_description_file: code-coverage-summary.md
|
output_text_description_file: code-coverage-results.md
|
||||||
|
|
||||||
- name: Add Code Coverage PR Comment
|
- name: Add Code Coverage PR Comment
|
||||||
if: github.event_name == 'push'
|
if: (github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == github.repository)
|
||||||
uses: marocchino/sticky-pull-request-comment@v2
|
uses: marocchino/sticky-pull-request-comment@v2
|
||||||
with:
|
with:
|
||||||
append: true
|
append: true
|
||||||
path: code-coverage-summary.md
|
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:
|
||||||
|
- name: Deploy GitHub Pages site
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v1.2.9
|
||||||
|
|
||||||
|
- name: Write Code Coverage Report URL
|
||||||
|
run: |
|
||||||
|
echo '[Open Coverage Report](${{ steps.deployment.outputs.page_url }})' >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user