Skip to content

Commit f4caa11

Browse files
dhuangnmderekk-nm
andauthored
Report test results to Report Portal (#271)
* upload test results to prepare for report portal uploading * update permissions * update path * post-process test suite name * missing " * use junit_suite_name to set test suite name * report to reportportal * fix error * only test with 2 ubuntu runners for now * check out code * fix some bugs * fix a bug * call install-report-tools action * clean up * correct description * simplify metadata construction * try with less num of jobs * fix a bug * move metadata generation command to the workflow * fix an error * fix url * restore configs * report runner is ready * properly format launch attributes for launch metadata * use tagged reportportal action, recover all python versions in trigger-all --------- Co-authored-by: Derek Kozikowski <106621615+derekk-nm@users.noreply.github.com>
1 parent 7823af0 commit f4caa11

File tree

4 files changed

+176
-2
lines changed

4 files changed

+176
-2
lines changed

.github/actions/test/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ inputs:
44
venv:
55
description: "path of virtualenv"
66
required: true
7+
suitename:
8+
description: "test suite name"
9+
required: true
710
outputs:
811
status:
912
description: "final status from test"
@@ -25,7 +28,7 @@ runs:
2528
source ${{ inputs.venv }}/bin/activate
2629
rm -rf src
2730
SUCCESS=0
28-
pytest tests --junitxml=test-results/report.xml || SUCCESS=$?
31+
pytest tests --junitxml=test-results/report.xml -o junit_suite_name="${{ inputs.suitename }}" || SUCCESS=$?
2932
echo "status=${SUCCESS}" >> "$GITHUB_OUTPUT"
3033
deactivate
3134
exit ${SUCCESS}

.github/workflows/build-test.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,24 @@ jobs:
5656
secrets: inherit
5757

5858
UPLOAD:
59-
needs: [BUILD, TEST]
59+
needs: [TEST]
6060
uses: ./.github/workflows/upload.yml
6161
with:
6262
label: k8s-util
6363
timeout: 40
6464
run_id: ${{ github.run_id }}
6565
push_to_pypi: ${{ inputs.push_to_pypi }}
6666
secrets: inherit
67+
68+
REPORT:
69+
needs: [BUILD, TEST]
70+
uses: ./.github/workflows/report.yml
71+
with:
72+
label: rh-reporter
73+
timeout: 40
74+
run_id: ${{ github.run_id }}
75+
run_name: compressed-tensors
76+
wheel: ${{ needs.BUILD.outputs.whl }}
77+
wf_category: ${{ inputs.wf_category }}
78+
gitref: ${{ inputs.gitref }}
79+
secrets: inherit

.github/workflows/report.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: report test results to reportportal
2+
run-name: ${{ github.actor }} report results for run ${{ inputs.run_id }}
3+
on:
4+
5+
workflow_call:
6+
inputs:
7+
label:
8+
description: "requested runner label (specifies instance)"
9+
type: string
10+
required: true
11+
timeout:
12+
description: "time limit for run in minutes "
13+
type: string
14+
required: true
15+
run_id:
16+
description: "run_id of 'build.yml' run that generated the assets"
17+
type: string
18+
required: true
19+
wheel:
20+
description: wheel used for testing
21+
type: string
22+
required: true
23+
run_name:
24+
description: name of the test run
25+
type: string
26+
required: true
27+
wf_category:
28+
description: "categories: NIGHTLY, RELEASE"
29+
type: string
30+
default: NIGHTLY
31+
gitref:
32+
description: "git commit hash or branch name"
33+
type: string
34+
default: main
35+
36+
workflow_dispatch:
37+
inputs:
38+
label:
39+
description: "requested runner label (specifies instance)"
40+
type: string
41+
required: true
42+
timeout:
43+
description: "time limit for run in minutes "
44+
type: string
45+
required: true
46+
run_id:
47+
description: "run_id of 'build.yml' run that generated the assets"
48+
type: string
49+
required: true
50+
wheel:
51+
description: wheel used for testing
52+
type: string
53+
required: true
54+
run_name:
55+
description: name of the test run
56+
type: string
57+
required: true
58+
wf_category:
59+
description: "categories: NIGHTLY, RELEASE"
60+
type: string
61+
default: NIGHTLY
62+
gitref:
63+
description: "git commit hash or branch name"
64+
type: string
65+
default: main
66+
67+
jobs:
68+
69+
REPORT:
70+
runs-on: ${{ inputs.label }}
71+
timeout-minutes: ${{ fromJson(inputs.timeout) }}
72+
73+
permissions:
74+
contents: 'read'
75+
id-token: 'write'
76+
77+
steps:
78+
79+
- name: checkout code
80+
id: checkout
81+
uses: actions/checkout@v4
82+
with:
83+
ref: ${{ inputs.gitref }}
84+
85+
- name: 'Authenticate to Google Cloud'
86+
id: auth-gcp
87+
uses: google-github-actions/auth@v2.1.3
88+
with:
89+
project_id: ${{ secrets.GCP_PROJECT }}
90+
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
91+
service_account: ${{ secrets.GCP_GHA_SA }}
92+
93+
- name: 'Set up Cloud SDK'
94+
uses: 'google-github-actions/setup-gcloud@v2'
95+
with:
96+
version: '>= 473.0.0'
97+
98+
- name: download assets
99+
uses: neuralmagic/nm-actions/actions/gcp-download-assets@v1.1.0
100+
with:
101+
bucket_source: ${{ secrets.GCP_BUILD_ML_ASSETS2 }}
102+
run_id: ${{ inputs.run_id }}
103+
104+
- name: generate metadata info
105+
id: generate-metadata
106+
run: |
107+
jq --raw-output -n '{
108+
"hostname": "${{ secrets.REPORTPORTAL_HOST }}",
109+
"project": "compressed-tensors",
110+
"name": "${{ inputs.run_name }}",
111+
"description": "GitHub run: https://github.com/neuralmagic/compressed-tensors/actions/runs/${{ inputs.run_id }}",
112+
"attributes": [
113+
{"key": "wheel", "value": "${{ inputs.wheel }}"},
114+
{"key": "gitref", "value": "${{ inputs.gitref }}"},
115+
{"key": "workflow category", "value": "${{ inputs.wf_category }}"}
116+
]
117+
}' > metadata.json
118+
METADATA_FILEPATH=`realpath metadata.json`
119+
echo "metadata_filepath=${METADATA_FILEPATH}" | tee -a $GITHUB_OUTPUT
120+
shell: bash
121+
122+
- name: report to reportportal
123+
uses: neuralmagic/nm-actions/actions/reportportal_submit_execution_results@v1.15.0
124+
with:
125+
droute_username: ${{ secrets.DROUTE_USERNAME }}
126+
droute_password: ${{ secrets.DROUTE_PASSWORD }}
127+
droute_url: ${{ secrets.DROUTE_URL}}
128+
metadata_filepath: ${{ steps.generate-metadata.outputs.metadata_filepath }}

.github/workflows/test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ jobs:
5555
name: TEST (${{ inputs.python}}, ${{ inputs.test_label }})
5656
runs-on: ${{ inputs.test_label }}
5757
timeout-minutes: ${{ fromJson(inputs.timeout) }}
58+
permissions:
59+
contents: 'read'
60+
id-token: 'write'
5861

5962
steps:
6063

@@ -94,6 +97,7 @@ jobs:
9497
uses: ./.github/actions/test/
9598
with:
9699
venv: ${{ steps.create_venv.outputs.penv }}
100+
suitename: test-${{ inputs.python }}-${{ inputs.test_label }}
97101

98102
- name: summary
99103
uses: neuralmagic/nm-actions/actions/summary-test@v1.13.0
@@ -104,3 +108,29 @@ jobs:
104108
python: ${{ inputs.python }}
105109
whl: ${{ inputs.whl }}
106110
test_status: ${{ steps.test.outputs.status }}
111+
112+
# GCP
113+
- name: 'Authenticate to Google Cloud'
114+
id: auth
115+
uses: google-github-actions/auth@v2.1.3
116+
with:
117+
project_id: ${{ secrets.GCP_PROJECT }}
118+
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
119+
service_account: ${{ secrets.GCP_GHA_SA }}
120+
121+
- name: 'Set up Cloud SDK'
122+
uses: 'google-github-actions/setup-gcloud@v2'
123+
with:
124+
version: '>= 473.0.0'
125+
126+
- name: copy results to GCP
127+
run: |
128+
gcloud storage cp test-results/report.xml ${{ secrets.GCP_BUILD_ML_ASSETS2 }}/${{ github.run_id }}/test-results/report-${{ inputs.test_label }}.xml
129+
130+
- name: upload results
131+
uses: actions/upload-artifact@v4
132+
if: success() || failure()
133+
with:
134+
name: report-${{ inputs.test_label }}.xml
135+
path: test-results/report.xml
136+
retention-days: 5

0 commit comments

Comments
 (0)