Skip to content

Commit

Permalink
feat: publish front-end tests' reports
Browse files Browse the repository at this point in the history
  • Loading branch information
wazelin committed Jul 13, 2023
1 parent 1129d55 commit 1e134d2
Showing 1 changed file with 61 additions and 17 deletions.
78 changes: 61 additions & 17 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,58 +65,94 @@ jobs:
working-directory: tao/views/build
run: |
npm ci
npx grunt testall
npx grunt testall --reports=../../../junit-reports
continue-on-error: true

- name: Back-end tests
run: ./test.sh ${{ matrix.coverage && '-c' }}
continue-on-error: true

- name: Publish a test report
- name: Publish a back-end test report
uses: mikepenz/action-junit-report@v3
id: junit
id: be-junit
with:
report_paths: 'log/*/junit.xml'
job_summary: false

- name: Parse the the reports
- name: Publish a front-end test report
if: ${{ matrix.node-version }}
uses: mikepenz/action-junit-report@v3
id: fe-junit

- name: Parse the the back-end reports
id: report
run: grep testFailed log/*/teamcity.txt -R > /tmp/failures.txt

- name: Build coverage report link
- name: Build back-end coverage report link
id: report-link
if: ${{ matrix.coverage }}
run: echo formatted='[🔗 Coverage report](https://oat-sa.github.io/tao-community/${{ github.head_ref || github.ref_name }})' >> $GITHUB_OUTPUT

- name: Job summary
- name: Back-end job summary
uses: mathiasvr/command-output@v2.0.0
id: summary
id: be-summary
with:
run: |
cat << EOF
# Summary ${{ matrix.php-version }}
# Back-end summary ${{ matrix.php-version }}
${{ steps.report-link.outputs.formatted }}
|💯 Total|✅ Passed|⏭️ Skipped|❌ Failed|
|-|-|-|-|
|${{ steps.junit.outputs.total }}|${{ steps.junit.outputs.passed }}|${{ steps.junit.outputs.skipped }}|${{ steps.junit.outputs.failed }}|
|${{ steps.be-junit.outputs.total }}|${{ steps.be-junit.outputs.passed }}|${{ steps.be-junit.outputs.skipped }}|${{ steps.be-junit.outputs.failed }}|
EOF
php ./.github/parse-reports.php
- name: Front-end job summary
if: ${{ matrix.node-version }}
uses: mathiasvr/command-output@v2.0.0
id: fe-summary
with:
run: |
cat << EOF
# Front-end summary ${{ matrix.node-version }}
|💯 Total|✅ Passed|⏭️ Skipped|❌ Failed|
|-|-|-|-|
|${{ steps.fe-junit.outputs.total }}|${{ steps.fe-junit.outputs.passed }}|${{ steps.fe-junit.outputs.skipped }}|${{ steps.fe-junit.outputs.failed }}|
EOF
php ./.github/parse-reports.php
- uses: peter-evans/find-comment@v2
id: summary-comment
id: be-summary-comment
if: github.event_name == 'pull_request'
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Summary ${{ matrix.php-version }}

- name: Create or update summary comment
- uses: peter-evans/find-comment@v2
id: fe-summary-comment
if: ${{ github.event_name == 'pull_request' && matrix.node-version }}
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Summary ${{ matrix.node-version }}

- name: Create or update back-end summary comment
uses: peter-evans/create-or-update-comment@v2
if: github.event_name == 'pull_request'
with:
comment-id: ${{ steps.summary-comment.outputs.comment-id }}
comment-id: ${{ steps.be-summary-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.summary.outputs.stdout }}
body: ${{ steps.be-summary.outputs.stdout }}
edit-mode: replace

- name: Create or update front-end summary comment
uses: peter-evans/create-or-update-comment@v2
if: ${{ github.event_name == 'pull_request' && matrix.node-version }}
with:
comment-id: ${{ steps.fe-summary-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.fe-summary.outputs.stdout }}
edit-mode: replace

- name: Merge coverage reports
Expand Down Expand Up @@ -146,8 +182,16 @@ jobs:
single-commit: true
token: ${{ secrets.CI_GITHUB_TOKEN }}

- name: Job summary
run: echo "${{ steps.summary.outputs.stdout }}" >> $GITHUB_STEP_SUMMARY
- name: Back-end job summary
run: echo "${{ steps.be-summary.outputs.stdout }}" >> $GITHUB_STEP_SUMMARY

- name: Front-end job summary
if: ${{ matrix.node-version }}
run: echo "${{ steps.fe-summary.outputs.stdout }}" >> $GITHUB_STEP_SUMMARY

- name: Fail the job if back-end tests weren't OK
run: exit ${{ steps.be-junit.outputs.failed }}

- name: Fail the job if tests weren't OK
run: exit ${{ steps.junit.outputs.failed }}
- name: Fail the job if front-end tests weren't OK
if: ${{ matrix.node-version }}
run: exit ${{ steps.fe-junit.outputs.failed }}

0 comments on commit 1e134d2

Please sign in to comment.