Skip to content

Commit c3cb0a5

Browse files
committed
chore: Update ci.yml to set timestamp and artifact name for test results
1 parent 5f08525 commit c3cb0a5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ jobs:
123123
# unit-parallel-tests job will run on ubuntu-latest github-hosted runner
124124
name: UNIT-PARALLEL-TESTS
125125
runs-on: ubuntu-latest
126+
outputs:
127+
artifact-name: ${{ steps.set_timestamp.outputs.artifact_name }} # Output the artifact name
126128
needs: # needs build job and runner-indexes job to be completed before running the unit-parallel-tests job
127129
- build
128130
- runner-indexes
@@ -153,6 +155,11 @@ jobs:
153155
matrix: # defining the matrix strategy to run the job in parallel using x number of github-hosted runners defined in the env total_runners above
154156
runner-index: ${{ fromjson(needs.runner-indexes.outputs.json) }} # using the runner-indexes job output to define the matrix strategy
155157
steps:
158+
- name: Set timestamp
159+
id: set_timestamp
160+
run: |
161+
echo "TIMESTAMP=$(date +'%Y-%m-%d-%H-%M-%S')" >> $GITHUB_ENV
162+
echo "::set-output name=artifact_name::test-results-${{ env.TIMESTAMP }}"
156163
- name: Checkout repository # checkout the repository
157164
uses: actions/checkout@v3.0.2
158165
# caching the maven packages to speed up the build process.
@@ -211,9 +218,6 @@ jobs:
211218
mvn -Dtest=$(basename $file | sed -e "s/.java/,/" | tr -d '\r\n') -e test -Dspring.datasource.url=${{ secrets.LIQUIBASE_COMMAND_URL }} -Dspring.datasource.username=${{ secrets.LIQUIBASE_COMMAND_USERNAME }} -Dspring.datasource.password=${{ secrets.LIQUIBASE_COMMAND_PASSWORD }} -Dspring.liquibase.change-log=classpath:db/changelog/changelog_version-3.3.xml -Dserver.port=8086 -Dspring.redis.host=redis -Dspring.redis.port=6379 -Dspring.redis.mode=standalone
212219
done
213220
214-
- name: Set timestamp
215-
run: echo "TIMESTAMP=$(date +'%Y-%m-%d-%H-%M-%S')" >> $GITHUB_ENV # setting the timestamp for the test results
216-
217221
- uses: actions/upload-artifact@v4 # upload the test results as an artifact
218222
with:
219223
name: test-results-${{ env.TIMESTAMP }} # naming the artifact with the timestamp
@@ -230,7 +234,7 @@ jobs:
230234
- name: Download test results
231235
uses: actions/download-artifact@v2
232236
with:
233-
name: Test Results
237+
name: test-results-${{ needs.unit-parallel-tests.outputs.artifact-name }}
234238
path: test_results
235239

236240
- name: Publish Test Results
@@ -239,7 +243,7 @@ jobs:
239243
with:
240244
reporter: java-junit
241245
name: JUnit Test Results
242-
path: test_results/*.xml
246+
path: test_results-${{ needs.unit-parallel-tests.outputs.artifact-name }}/*.xml
243247

244248
build-and-publish-docker-image: # job to build the docker image and publish it to the GitHub Container Registry
245249
runs-on: ubuntu-latest # using the latest ubuntu runner

0 commit comments

Comments
 (0)