[MINOR] feat(CI): Report test results in github comments (#1506)
### 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: https://github.com/EnricoMi/incubator-uniffle/pull/2#issuecomment-1925719425
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Manual.
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 567f1a4..766d18c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -75,13 +75,17 @@
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
@@ -91,3 +95,13 @@
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 }}
diff --git a/.github/workflows/parallel.yml b/.github/workflows/parallel.yml
index b4f03ef..569c27a 100644
--- a/.github/workflows/parallel.yml
+++ b/.github/workflows/parallel.yml
@@ -91,11 +91,11 @@
./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 }}
diff --git a/.github/workflows/test-results.yml b/.github/workflows/test-results.yml
new file mode 100644
index 0000000..2ac7aa8
--- /dev/null
+++ b/.github/workflows/test-results.yml
@@ -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"