Skip to content

Commit c18759f

Browse files
committed
WIP replace use of TestMo with ReportPortal for test results data
1 parent cd836aa commit c18759f

File tree

2 files changed

+156
-0
lines changed

2 files changed

+156
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
name: create reportportal launch
3+
description: create neuralmagic reportportal launch and return its ID
4+
5+
inputs:
6+
reportportal_url:
7+
description: reportportal URL
8+
required: true
9+
reportportal_token:
10+
description: reportportal token
11+
required: true
12+
source:
13+
description: source for reportportal, e.g. 'build-test'
14+
required: true
15+
project_id:
16+
description: reportportal project id
17+
required: true
18+
run_name:
19+
description: run name
20+
required: false
21+
22+
outputs:
23+
id:
24+
description: reportportal launch id
25+
value: ${{ steps.reportportal_create_launch_id.outputs.launch_id }}
26+
27+
runs:
28+
using: composite
29+
steps:
30+
- name: create launch
31+
id: reportportal_create_launch_id
32+
run: |
33+
echo "creating reportportal launch ..."
34+
## CHECK reportportal_url and token
35+
if [[ -z "${REPORTPORTAL_URL}" ]]; then
36+
echo "The REPORTPORTAL_URL secret is not defined for this repository"
37+
exit 1
38+
fi
39+
if [[ -z "${REPORTPORTAL_TOKEN}" ]]; then
40+
echo "The REPORTPORTAL_TOKEN secret is not defined for this repository"
41+
exit 1
42+
fi
43+
## construct name
44+
REPORTPORTAL_RUN_NAME="${{ inputs.run_name }}"
45+
if [[ -z "${{ inputs.run_name }}" ]]; then
46+
BRANCH_NAME=${GITHUB_REF_NAME}
47+
TMP=${ACTOR}-${BRANCH_NAME}
48+
REPORTPORTAL_RUN_NAME=$(echo ${TMP} | awk '{print tolower($0)}')
49+
fi
50+
echo "test run name: ${REPORTPORTAL_RUN_NAME}"
51+
starttime=$(date -Iseconds)
52+
53+
## construct launch request
54+
LAUNCH_ID = $(curl -L -X POST "${REPORTPORTAL_URL}/api/v1/plugin/${PROJECT_ID}/junit/import" \
55+
-H "Content-Type: multipart/form-data" \
56+
-H "Authorization: Bearer ${REPORTPORTAL_TOKEN}" \
57+
-F 'file=@"file_path.zip";type=application/x-zip-compressed' \
58+
-F 'launchImportRq="{
59+
\"attributes\": [
60+
{
61+
\"key\": \"skippedIsNotIssue\",
62+
\"system\": true,
63+
\"value\": \"true\"
64+
}
65+
],
66+
\"description\": \"vllm tests\",
67+
\"mode\": \"DEFAULT\",
68+
\"name\": \"${REPORTPORTAL_RUN_NAME}\",
69+
\"startTime\": \"${starttime}\"
70+
}";type=application/json' | jq -r .id)
71+
72+
echo "launch_id=${LAUNCH_ID}" >> "${GITHUB_OUTPUT}"
73+
env:
74+
REPORTPORTAL_URL: ${{ inputs.reportportal_url }}
75+
REPORTPORTAL_TOKEN: ${{ inputs.reportportal_token }}
76+
PROJECT_ID: ${{ inputs.project_id }}
77+
shell: bash
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
name: submit reportportal execution results
3+
description: submit JUnitXML formatted test execution results to ReportPortal
4+
5+
inputs:
6+
reportportal_url:
7+
description: reportportal URL
8+
required: true
9+
reportportal_token:
10+
description: reportportal token
11+
required: true
12+
source:
13+
description: source for reportportal, e.g. 'build-test'
14+
required: true
15+
project_id:
16+
description: reportportal project id
17+
required: true
18+
run_name:
19+
description: run name
20+
required: false
21+
launch_id:
22+
description: ID of the launch to append results to
23+
required: true
24+
results:
25+
description: directory of JUnit '*.xml' formatted result files
26+
required: true
27+
28+
outputs:
29+
id:
30+
description: test results execution id
31+
value: ${{ steps.reportportal_submit_results_xml.outputs.id }}
32+
33+
runs:
34+
using: composite
35+
steps:
36+
- name: upload results
37+
id: reportportal_submit_results_xml
38+
run: |
39+
echo "submitting test run to ReportPortal..."
40+
## CHECK reportportal_url and token
41+
if [[ -z "${REPORTPORTAL_URL}" ]]; then
42+
echo "The REPORTPORTAL_URL secret is not defined for this repository"
43+
exit 1
44+
fi
45+
46+
if [[ -z "${REPORTPORTAL_TOKEN}" ]]; then
47+
echo "The REPORTPORTAL_TOKEN secret is not defined for this repository"
48+
exit 1
49+
fi
50+
51+
# verify results folder exists
52+
if [[ ! -d "$RESULTS_FOLDER" ]]; then
53+
echo "Results folder '$RESULTS_FOLDER' does not exist in working directory:"
54+
ls -A
55+
echo "::warning title=$GITHUB_JOB - MISSING RESULTS FOLDER::Results folder does not exist in working directory"
56+
exit 1
57+
fi
58+
59+
# verify results folder contains XML result files
60+
readarray -d '' RESULTS < <(find "$RESULTS_FOLDER" -type f -name "*.xml" -print0)
61+
if [[ ${#RESULTS[@]} == 0 ]]; then
62+
echo "Results folder '$RESULTS_FOLDER' does not contain any XML result files:"
63+
ls -A "$RESULTS_FOLDER"
64+
echo "::warning title=$GITHUB_JOB - MISSING RESULT FILES::Results folder did not contain any XML result files"
65+
exit 1
66+
fi
67+
68+
## TODO: what does the request look like? does it need to loop through the files list?
69+
# submit results
70+
SUCCESS=0
71+
72+
-- step-status.sh "$STEP_STATUS" || SUCCESS=$?
73+
echo "status=$SUCCESS" >> "$GITHUB_OUTPUT"
74+
exit "$SUCCESS"
75+
env:
76+
REPORTPORTAL_URL: ${{ inputs.reportportal_url }}
77+
REPORTPORTAL_TOKEN: ${{ inputs.reportportal_token }}
78+
PROJECT_ID: ${{ inputs.project_id }}
79+
shell: bash

0 commit comments

Comments
 (0)