Skip to content

Commit 705dbd5

Browse files
committed
Add logic to upload test results for manual runs on demand only
1 parent 365c7d5 commit 705dbd5

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

.github/workflows/e2e-test-pr.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ on:
2727
pull_request_number:
2828
description: 'The number of the PR.'
2929
required: false
30+
test_report_upload:
31+
description: 'Indicates whether to upload the test report to object storage. Defaults to "false"'
32+
required: false
33+
default: 'false'
34+
type: choice
35+
options:
36+
- 'true'
37+
- 'false'
3038

3139
name: PR E2E Tests
3240

@@ -101,7 +109,7 @@ jobs:
101109
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}
102110

103111
- name: Upload test results
104-
if: always()
112+
if: always() && github.repository == 'linode/linode_api4-python' && (github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.test_report_upload == 'true'))
105113
run: |
106114
filename=$(ls | grep -E '^[0-9]{12}_sdk_test_report\.xml$')
107115
python3 e2e_scripts/tod_scripts/xml_to_obj_storage/scripts/add_gha_info_to_xml.py \

.github/workflows/e2e-test.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ on:
4141
options:
4242
- 'true'
4343
- 'false'
44+
test_report_upload:
45+
description: 'Indicates whether to upload the test report to object storage. Defaults to "false"'
46+
required: false
47+
default: 'false'
48+
type: choice
49+
options:
50+
- 'true'
51+
- 'false'
4452
push:
4553
branches:
4654
- main
@@ -172,7 +180,8 @@ jobs:
172180
process-upload-report:
173181
runs-on: ubuntu-latest
174182
needs: [integration-tests]
175-
if: always() && github.repository == 'linode/linode_api4-python' # Run even if integration tests fail and only on main repository
183+
# Run even if integration tests fail on main repository AND push event OR test_report_upload is true in case of manual run
184+
if: always() && github.repository == 'linode/linode_api4-python' && (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.test_report_upload == 'true'))
176185
outputs:
177186
summary: ${{ steps.set-test-summary.outputs.summary }}
178187

@@ -271,4 +280,4 @@ jobs:
271280
payload: |
272281
channel: ${{ secrets.SLACK_CHANNEL_ID }}
273282
thread_ts: "${{ steps.main_message.outputs.ts }}"
274-
text: "${{ needs.process-upload-report.outputs.summary }}"
283+
text: "${{ needs.process-upload-report.outputs.summary }}"

0 commit comments

Comments
 (0)