Skip to content

Commit

Permalink
[MINOR] feat(CI): Report test results in github comments (#1506)
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?
Reports test results in Github UI.

### Why are the changes needed?
Individual results of test failures are easier to access than scrolling through long job logs: [example](https://github.com/EnricoMi/incubator-uniffle/runs/21197842666)
Test stats are nicely presented in corresponding pull request: EnricoMi#2 (comment)

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Manual.
  • Loading branch information
EnricoMi authored Feb 5, 2024
1 parent aca0203 commit 4dacb1e
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 4 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,17 @@ jobs:
uses: ./.github/workflows/parallel.yml
with:
maven-args: package -Dtest=!org.apache.uniffle.test.**
reports-path: "**/target/surefire-reports/*.txt"
reports-path: |
**/target/surefire-reports/*.txt
**/target/surefire-reports/*.xml
integration:
uses: ./.github/workflows/parallel.yml
with:
maven-args: package -Dtest=org.apache.uniffle.test.**
reports-path: "**/target/surefire-reports/*.txt"
reports-path: |
**/target/surefire-reports/*.txt
**/target/surefire-reports/*.xml
kubernetes:
needs: [checkstyle, license, changes] # delay execution
Expand All @@ -91,3 +95,13 @@ jobs:
maven-args: package -Pkubernetes -DskipUTs -DskipITs -DskipBuildImage=${{ needs.changes.outputs.rss_server_docker == 'false' }}
cache-key: package
go-version: '1.17'

event_file:
name: "Event File"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Event File
path: ${{ github.event_path }}
4 changes: 2 additions & 2 deletions .github/workflows/parallel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ jobs:
./mvnw -B -fae ${{ inputs.maven-args }} -P${PROFILES} -Pdashboard | tee /tmp/maven.log
shell: bash
- name: Summary of failures
if: ${{ failure() && inputs.summary != '' }}
if: failure() && inputs.summary != ''
run: ${{ inputs.summary }}
continue-on-error: true
- name: Upload test reports
if: ${{ failure() && inputs.reports-path != '' }}
if: always() && inputs.reports-path != ''
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.reports-name }}-${{ matrix.profile }}
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/test-results.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: Test Results

on:
workflow_run:
workflows: ["build"]
types:
- completed
permissions: {}

jobs:
test-results:
name: Test Results
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion != 'skipped'

permissions:
checks: write
pull-requests: write
actions: read

steps:
- name: Download and Extract Artifacts
uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615
with:
run_id: ${{ github.event.workflow_run.id }}
path: artifacts

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/Event File/event.json
event_name: ${{ github.event.workflow_run.event }}
check_name: Test Results (${{ github.event.workflow_run.event }})
files: "artifacts/**/*.xml"

0 comments on commit 4dacb1e

Please sign in to comment.