Skip to content

Commit bfcf01f

Browse files
committed
chore: update artifact naming and add download step for test results in ci.yml
1 parent 755bd30 commit bfcf01f

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ jobs:
215215
216216
- uses: actions/upload-artifact@v4.4.3 # uploading the artifact to the GitHub Artifacts. Link to the documentation - https://docs.github.com/en/actions/guides/storing-workflow-data-as-artifacts
217217
with:
218-
name: Test Results
218+
name: testresults-${{ github.run_id }}-split-${{ matrix.runner-index }} # naming the artifact with the test results
219219
path: ./target/surefire-reports # path to the test results
220220
retention-days: 90 # retention period for the artifact in days. Link to the documentation - https://docs.github.com/en/actions/guides/storing-workflow-data-as-artifacts#about-workflow-artifact-retention
221221

@@ -226,11 +226,23 @@ jobs:
226226
- name: Checkout repository
227227
uses: actions/checkout@v3
228228

229-
- name: Download test results
230-
uses: actions/download-artifact@v4.1.8
231-
with:
232-
name: Test Results
233-
path: test_results
229+
- name: List Artifacts
230+
id: list-artifacts
231+
run: |
232+
curl -s -u ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} \
233+
-H 'Accept: application/vnd.github.v3+json' \
234+
https://api.github.com/repos/octodemo/java-springboot-demo/actions/runs/${{ github.run_id }}/artifacts > artifacts.json
235+
cat artifacts.json
236+
237+
- name: Download Artifacts
238+
run: |
239+
mkdir -p test_results
240+
for url in $(jq -r '.artifacts[] | select(.name | startswith("testresults-")) | .archive_download_url' artifacts.json); do
241+
artifact_name=$(echo $url | awk -F/ '{print $NF}' | awk -F? '{print $1}')
242+
curl -s -u ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} -L -o test_results/testresults.zip $url
243+
unzip -o test_results/testresults.zip -d test_results
244+
rm test_results/testresults.zip
245+
done
234246
235247
- name: Publish Test Results
236248
uses: dorny/test-reporter@v1.8.0

0 commit comments

Comments
 (0)