Skip to content

Commit d8c9f60

Browse files
committed
Create unit test artifact
1 parent 9074555 commit d8c9f60

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
skip-cache: true
5353
- name: Set Linting Outputs
5454
if: success() || failure()
55-
run: bash ./scripts/workflow/format_workflow_outputs.sh ${{ job.status }} ${{ env.START_TIME }}
55+
run: bash ./scripts/workflow/format_workflow_outputs.sh ${{ job.status }} ${{ env.START_TIME }} lint-result.json
5656
- name: Upload Artifact
5757
if: success() || failure()
5858
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
@@ -65,16 +65,28 @@ jobs:
6565
name: Unit Tests
6666
runs-on: ubuntu-24.04
6767
steps:
68+
- name: Set start time
69+
run: echo "START_TIME=$(date +"%Y-%m-%dT%H:%M:%S.%NZ")" >> ${GITHUB_ENV}
6870
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
6971
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
7072
with:
7173
go-version-file: 'go.mod'
7274
- name: Run Unit Tests
73-
run: make unit-test
75+
run: make unit-test > unit-test-output.json
7476
- name: Upload Test Coverage
7577
uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed # v4.3.0
7678
with:
7779
files: ./build/test/coverage.out
80+
- name: Set Unit Test Outputs
81+
if: success() || failure()
82+
run: bash ./scripts/workflow/format_workflow_outputs.sh ${{ job.status }} ${{ env.START_TIME }} unit-test-result.json
83+
- name: Upload Artifact
84+
if: success() || failure()
85+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
86+
with:
87+
name: unit-test-status
88+
path: unit-test-result.json
89+
retention-days: 1
7890

7991
component-test:
8092
name: Component Tests
@@ -421,3 +433,14 @@ jobs:
421433
permissions:
422434
contents: write
423435
pull-requests: write
436+
437+
438+
# merge-artifacts:
439+
# runs-on: ubuntu-22.04
440+
# needs: [lint, unit-test, component-test, performance-test, integration-tests, official-plus-image-integration-tests, official-oss-image-integration-tests]
441+
# steps:
442+
# - name: Merge Artifacts
443+
# if: success() || failure()
444+
# uses: actions/upload-artifact/merge@v4
445+
# with:
446+
# name: ci-workflow-logs

scripts/workflow/format_workflow_outputs.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
LINT_FILE="lint-output.json"
3+
LINT_FILE="$3"
44
START_TIME="$2"
55
END_TIME="`date "+%Y-%m-%dT%H:%M:%S.%NZ"`"
66
START_SECONDS=$(date -d "$START_TIME" +%s.%N)
@@ -26,4 +26,4 @@ if [[ -f "$LINT_FILE" ]]; then
2626
fi
2727
fi
2828

29-
echo "{\"start_at\": \"$START_TIME\", \"end_at\": \"$END_TIME\", \"duration_seconds\": \"$DURATION\", \"result\": \"$RESULT\", \"msg\": \"$MSG\"}" > lint-result.json
29+
echo "{\"start_at\": \"$START_TIME\", \"end_at\": \"$END_TIME\", \"duration_seconds\": \"$DURATION\", \"result\": \"$RESULT\", \"msg\": \"$MSG\"}" > $LINT_FILE

0 commit comments

Comments
 (0)