Skip to content

Commit 5064844

Browse files
committed
chore: fixed upload-artifact job
1 parent c3cb0a5 commit 5064844

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ 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
128126
needs: # needs build job and runner-indexes job to be completed before running the unit-parallel-tests job
129127
- build
130128
- runner-indexes
@@ -155,11 +153,6 @@ jobs:
155153
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
156154
runner-index: ${{ fromjson(needs.runner-indexes.outputs.json) }} # using the runner-indexes job output to define the matrix strategy
157155
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 }}"
163156
- name: Checkout repository # checkout the repository
164157
uses: actions/checkout@v3.0.2
165158
# caching the maven packages to speed up the build process.
@@ -177,7 +170,7 @@ jobs:
177170
-H "Accept: application/vnd.github+json" \
178171
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"\
179172
-H "X-GitHub-Api-Version: 2022-11-28" \
180-
https://api.github.com/repos/${{ github.repository }}/actions/artifacts | jq -r '.artifacts | sort_by(.created_at) | .[] | select(.name == "^test-results") | .id' > artifacts_list.txt
173+
https://api.github.com/repos/${{ github.repository }}/actions/artifacts | jq -r '.artifacts | sort_by(.created_at) | .[] | select(.name == "Test Results") | .id' > artifacts_list.txt
181174
182175
LATEST_ARTIFACT_NUMBER=$(cut -d: -f 2 artifacts_list.txt | sort -n | tail -n 1)
183176
@@ -218,9 +211,9 @@ jobs:
218211
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
219212
done
220213
221-
- uses: actions/upload-artifact@v4 # upload the test results as an artifact
214+
- uses: actions/upload-artifact@v3 # upload the test results as an artifact
222215
with:
223-
name: test-results-${{ env.TIMESTAMP }} # naming the artifact with the timestamp
216+
name: Test Results
224217
path: ./target/surefire-reports # path to the test results
225218
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
226219

@@ -234,7 +227,7 @@ jobs:
234227
- name: Download test results
235228
uses: actions/download-artifact@v2
236229
with:
237-
name: test-results-${{ needs.unit-parallel-tests.outputs.artifact-name }}
230+
name: Test Results
238231
path: test_results
239232

240233
- name: Publish Test Results
@@ -243,7 +236,7 @@ jobs:
243236
with:
244237
reporter: java-junit
245238
name: JUnit Test Results
246-
path: test_results-${{ needs.unit-parallel-tests.outputs.artifact-name }}/*.xml
239+
path: test_results/*.xml
247240

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

0 commit comments

Comments
 (0)