8282 shell : bash
8383 run : npm install -g @testmo/testmo-cli
8484
85+ - name : Upload tests result to testmo
86+ id : th
87+ if : inputs.testman_token
88+ shell : bash
89+ env :
90+ PR_NUMBER : ${{ github.event.number }}
91+ run : |
92+ RUN_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
93+ BRANCH_TAG="$GITHUB_REF_NAME"
94+ ARCH="${{ runner.arch == 'X64' && 'x86-64' || runner.arch == 'ARM64' && 'arm64' || 'unknown' }}"
95+
96+ BUILD_PRESET="${{ inputs.build_preset }}"
97+ case "$BUILD_PRESET" in
98+ relwithdebinfo)
99+ TESTMO_SOURCE="ya-${ARCH}"
100+ ;;
101+ debug)
102+ TESTMO_SOURCE="ya-${ARCH}-debug"
103+ ;;
104+ release-*)
105+ TESTMO_SOURCE="ya-${ARCH}-${BUILD_PRESET/release-/}"
106+ ;;
107+ *)
108+ echo "Invalid preset: ${{ inputs.build_preset }}"
109+ exit 1
110+ ;;
111+ esac
112+
113+ case $GITHUB_EVENT_NAME in
114+ workflow_dispatch)
115+ TESTMO_RUN_NAME="${{ github.run_id }} manual"
116+ EXTRA_TAG="manual"
117+ ;;
118+ pull_request | pull_request_target)
119+ TESTMO_RUN_NAME="${{ github.run_id }} PR #${PR_NUMBER}"
120+ EXTRA_TAG="pr"
121+ BRANCH_TAG=""
122+ ;;
123+ schedule)
124+ TESTMO_RUN_NAME="${{ github.run_id }} schedule"
125+ EXTRA_TAG="schedule"
126+ ;;
127+ push)
128+ TESTMO_RUN_NAME="${{ github.run_id }} POST"
129+ EXTRA_TAG="post-commit"
130+ ;;
131+ *)
132+ TESTMO_RUN_NAME="${{ github.run_id }}"
133+ EXTRA_TAG=""
134+ ;;
135+ esac
136+
137+ testmo automation:resources:add-link --name build --url "$RUN_URL" --resources testmo.json
138+ testmo automation:resources:add-field --name git-sha --type string --value "${GITHUB_SHA:0:7}" --resources testmo.json
139+ RUN_ID=$(
140+ testmo automation:run:create --instance "$TESTMO_URL" --project-id ${{ inputs.testman_project_id }} \
141+ --name "$TESTMO_RUN_NAME" --source "$TESTMO_SOURCE" --resources testmo.json \
142+ --tags "$BRANCH_TAG" --tags "$EXTRA_TAG"
143+ )
144+ echo "runid=${RUN_ID}" >> $GITHUB_OUTPUT
145+ echo "TEST_HISTORY_URL=${TESTMO_URL}/automation/runs/view/${RUN_ID}" >> $GITHUB_ENV
146+
147+ - name : Print test history link
148+ shell : bash
149+ if : inputs.testman_token
150+ run : |
151+ echo "10 [Test history](${TEST_HISTORY_URL})" >> $SUMMARY_LINKS
152+
85153 - name : set environment variables required by some tests
86154 shell : bash
87155 run : |
@@ -199,68 +267,10 @@ runs:
199267 run : |
200268 tar -C $JUNIT_REPORT_PARTS/.. -czf $REPORTS_ARTIFACTS_DIR/junit_parts.xml.tar.gz $(basename $JUNIT_REPORT_PARTS)
201269
202- - name : Upload tests result to testmo
203- id : th
270+ - name : Unit test history upload results
204271 if : inputs.testman_token
205272 shell : bash
206- env :
207- PR_NUMBER : ${{ github.event.number }}
208273 run : |
209- RUN_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
210- BRANCH_TAG="$GITHUB_REF_NAME"
211- ARCH="${{ runner.arch == 'X64' && 'x86-64' || runner.arch == 'ARM64' && 'arm64' || 'unknown' }}"
212-
213- BUILD_PRESET="${{ inputs.build_preset }}"
214- case "$BUILD_PRESET" in
215- relwithdebinfo)
216- TESTMO_SOURCE="ya-${ARCH}"
217- ;;
218- debug)
219- TESTMO_SOURCE="ya-${ARCH}-debug"
220- ;;
221- release-*)
222- TESTMO_SOURCE="ya-${ARCH}-${BUILD_PRESET/release-/}"
223- ;;
224- *)
225- echo "Invalid preset: ${{ inputs.build_preset }}"
226- exit 1
227- ;;
228- esac
229-
230- case $GITHUB_EVENT_NAME in
231- workflow_dispatch)
232- TESTMO_RUN_NAME="${{ github.run_id }} manual"
233- EXTRA_TAG="manual"
234- ;;
235- pull_request | pull_request_target)
236- TESTMO_RUN_NAME="${{ github.run_id }} PR #${PR_NUMBER}"
237- EXTRA_TAG="pr"
238- BRANCH_TAG=""
239- ;;
240- schedule)
241- TESTMO_RUN_NAME="${{ github.run_id }} schedule"
242- EXTRA_TAG="schedule"
243- ;;
244- push)
245- TESTMO_RUN_NAME="${{ github.run_id }} POST"
246- EXTRA_TAG="post-commit"
247- ;;
248- *)
249- TESTMO_RUN_NAME="${{ github.run_id }}"
250- EXTRA_TAG=""
251- ;;
252- esac
253-
254- testmo automation:resources:add-link --name build --url "$RUN_URL" --resources testmo.json
255- testmo automation:resources:add-field --name git-sha --type string --value "${GITHUB_SHA:0:7}" --resources testmo.json
256- RUN_ID=$(
257- testmo automation:run:create --instance "$TESTMO_URL" --project-id ${{ inputs.testman_project_id }} \
258- --name "$TESTMO_RUN_NAME" --source "$TESTMO_SOURCE" --resources testmo.json \
259- --tags "$BRANCH_TAG" --tags "$EXTRA_TAG"
260- )
261- echo "runid=${RUN_ID}" >> $GITHUB_OUTPUT
262- echo "TEST_HISTORY_URL=${TESTMO_URL}/automation/runs/view/${RUN_ID}" >> $GITHUB_ENV
263-
264274 PROXY_ADDR=127.0.0.1:8888
265275
266276 openssl req -x509 -newkey rsa:2048 \
@@ -277,16 +287,11 @@ runs:
277287 proxy_pid=$!
278288
279289 NODE_TLS_REJECT_UNAUTHORIZED=0 testmo automation:run:submit-thread \
280- --instance "https://$PROXY_ADDR" --run-id "$RUN_ID " \
290+ --instance "https://$PROXY_ADDR" --run-id "${{ steps.th.outputs.runid }} " \
281291 --results "$JUNIT_REPORT_PARTS/*.xml"
282292
283293 kill $proxy_pid
284294
285- - name : Print test history link
286- shell : bash
287- run : |
288- echo "10 [Test history](${TEST_HISTORY_URL})" >> $SUMMARY_LINKS
289-
290295 - name : Test history run complete
291296 if : always() && inputs.testman_token
292297 shell : bash
0 commit comments