WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit b3473bb

Browse files
author
Jan Waś
committed
Upload test results and reports as a composite action
1 parent 496557a commit b3473bb

File tree

2 files changed

+41
-76
lines changed

2 files changed

+41
-76
lines changed

.github/actions/upload/action.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: upload
2+
description: "Upload test results"
3+
inputs:
4+
name-suffix:
5+
default: ${{ github.job }}
6+
test-report-retention-days:
7+
default: 5
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Upload test results
13+
uses: actions/upload-artifact@v3
14+
# Upload all test reports only on failure, because the artifacts are large
15+
if: failure()
16+
with:
17+
name: result ${{ inputs.name-suffix }}
18+
path: |
19+
**/target/surefire-reports
20+
**/target/checkstyle-*
21+
- name: Upload test report
22+
uses: actions/upload-artifact@v3
23+
# Always upload the test report for the annotate.yml workflow,
24+
# but only the single XML file to keep the artifact small
25+
if: always()
26+
with:
27+
# Name prefix is checked in the `Annotate checks` workflow
28+
name: test report ${{ inputs.name-suffix }}
29+
path: |
30+
**/surefire-reports/TEST-*.xml
31+
retention-days: ${{ inputs.test-report-retention-days }}

.github/workflows/ci.yml

Lines changed: 10 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -173,26 +173,9 @@ jobs:
173173
if [ ! -f gib-impacted.log ] || grep -q testing/trino-test-jdbc-compatibility-old-server gib-impacted.log; then
174174
$MAVEN test ${MAVEN_TEST} -pl :trino-test-jdbc-compatibility-old-server
175175
fi
176-
- name: Upload test results
177-
uses: actions/upload-artifact@v3
178-
# Upload all test reports only on failure, because the artifacts are large
179-
if: failure()
176+
- uses: ./.github/actions/upload
180177
with:
181-
name: result ${{ github.job }}
182-
path: |
183-
**/target/surefire-reports
184-
**/target/checkstyle-*
185-
- name: Upload test report
186-
uses: actions/upload-artifact@v3
187-
# Always upload the test report for the annotate.yml workflow,
188-
# but only the single XML file to keep the artifact small
189-
if: always()
190-
with:
191-
# Name prefix is checked in the `Annotate checks` workflow
192-
name: test report ${{ github.job }}
193-
path: |
194-
**/surefire-reports/TEST-*.xml
195-
retention-days: ${{ env.TEST_REPORT_RETENTION_DAYS }}
178+
test-report-retention-days: ${{ env.TEST_REPORT_RETENTION_DAYS }}
196179
- name: Clean local Maven repo
197180
# Avoid creating a cache entry because this job doesn't download all dependencies
198181
if: steps.cache.outputs.cache-hit != 'true'
@@ -295,26 +278,10 @@ jobs:
295278
run: |
296279
source plugin/trino-hive-hadoop2/conf/hive-tests-${{ matrix.config }}.sh &&
297280
plugin/trino-hive-hadoop2/bin/run_hive_alluxio_tests.sh
298-
- name: Upload test results
299-
uses: actions/upload-artifact@v3
300-
# Upload all test reports only on failure, because the artifacts are large
301-
if: failure()
281+
- uses: ./.github/actions/upload
302282
with:
303-
name: result ${{ github.job }}
304-
path: |
305-
**/target/surefire-reports
306-
**/target/checkstyle-*
307-
- name: Upload test report
308-
uses: actions/upload-artifact@v3
309-
# Always upload the test report for the annotate.yml workflow,
310-
# but only the single XML file to keep the artifact small
311-
if: always()
312-
with:
313-
# Name prefix is checked in the `Annotate checks` workflow
314-
name: test report ${{ github.job }} (${{ matrix.config }})
315-
path: |
316-
**/surefire-reports/TEST-*.xml
317-
retention-days: ${{ env.TEST_REPORT_RETENTION_DAYS }}
283+
name-suffix: ${{ github.job }} (${{ matrix.config }})
284+
test-report-retention-days: ${{ env.TEST_REPORT_RETENTION_DAYS }}
318285
- name: Clean local Maven repo
319286
# Avoid creating a cache entry because this job doesn't download all dependencies
320287
if: steps.cache.outputs.cache-hit != 'true'
@@ -364,26 +331,9 @@ jobs:
364331
!:trino-sqlserver,
365332
!:trino-test-jdbc-compatibility-old-server,
366333
!:trino-tests'
367-
- name: Upload test results
368-
uses: actions/upload-artifact@v3
369-
# Upload all test reports only on failure, because the artifacts are large
370-
if: failure()
334+
- uses: ./.github/actions/upload
371335
with:
372-
name: result ${{ github.job }}
373-
path: |
374-
**/target/surefire-reports
375-
**/target/checkstyle-*
376-
- name: Upload test report
377-
uses: actions/upload-artifact@v3
378-
# Always upload the test report for the annotate.yml workflow,
379-
# but only the single XML file to keep the artifact small
380-
if: always()
381-
with:
382-
# Name prefix is checked in the `Annotate checks` workflow
383-
name: test report ${{ github.job }}
384-
path: |
385-
**/surefire-reports/TEST-*.xml
386-
retention-days: ${{ env.TEST_REPORT_RETENTION_DAYS }}
336+
test-report-retention-days: ${{ env.TEST_REPORT_RETENTION_DAYS }}
387337
- name: Clean local Maven repo
388338
# Avoid creating a cache entry because this job doesn't download all dependencies
389339
if: steps.cache.outputs.cache-hit != 'true'
@@ -551,26 +501,10 @@ jobs:
551501
# ", :, <, >, |, *, ?, \, / are not allowed in artifact names, replace it with an underscore
552502
name=$(echo -n "${{ matrix.modules }}" | sed -e 's/[":<>|\*\?\\\/]/_/g')
553503
echo "ARTIFACT_NAME=$name" >> $GITHUB_ENV
554-
- name: Upload test results
555-
uses: actions/upload-artifact@v3
556-
# Upload all test reports only on failure, because the artifacts are large
557-
if: failure()
504+
- uses: ./.github/actions/upload
558505
with:
559-
name: result ${{ env.ARTIFACT_NAME }}
560-
path: |
561-
**/target/surefire-reports
562-
**/target/checkstyle-*
563-
- name: Upload test report
564-
uses: actions/upload-artifact@v3
565-
# Always upload the test report for the annotate.yml workflow,
566-
# but only the single XML file to keep the artifact small
567-
if: always()
568-
with:
569-
# Name prefix is checked in the `Annotate checks` workflow
570-
name: test report ${{ github.job }} (${{ env.ARTIFACT_NAME }})
571-
path: |
572-
**/surefire-reports/TEST-*.xml
573-
retention-days: ${{ env.TEST_REPORT_RETENTION_DAYS }}
506+
name-suffix: ${{ env.ARTIFACT_NAME }}
507+
test-report-retention-days: ${{ env.TEST_REPORT_RETENTION_DAYS }}
574508
- name: Clean local Maven repo
575509
# Avoid creating a cache entry because this job doesn't download all dependencies
576510
if: steps.cache.outputs.cache-hit != 'true'

0 commit comments

Comments
 (0)