Skip to content

Commit 4a5743f

Browse files
authored
ci: re-enable TestRail upload on manual runs (#799)
Allow uploading test results to TestRail if `testrail-upload` is set to `true`.
1 parent e11529f commit 4a5743f

2 files changed

Lines changed: 29 additions & 19 deletions

File tree

.github/workflows/acceptance-sim.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
omicron-sha:
77
type: "string"
88
required: true
9+
testrail-upload:
10+
type: "boolean"
11+
required: false
12+
default: false
913
secrets:
1014
testrail-host:
1115
required: false
@@ -129,24 +133,24 @@ jobs:
129133
if [ -f ./acc-test-rerun.txt ]; then
130134
echo "::warning title=${{ github.job }} (${{ matrix.tf-binary }}) - test rerun::$(cat ./acc-test-rerun.txt)"
131135
fi
132-
#- name: upload test results to TestRail
133-
# if: always()
134-
# continue-on-error: true
135-
# env:
136-
# TR_CLI_HOST: ${{ secrets.testrail-host }}
137-
# TR_CLI_USERNAME: ${{ secrets.testrail-username }}
138-
# TR_CLI_KEY: ${{ secrets.testrail-api-key }}
139-
# TR_CLI_PROJECT: ${{ secrets.testrail-project }}
140-
# run: |
141-
# uvx trcli \
142-
# --yes `# Auto-create new test cases.` \
143-
# parse_junit \
144-
# --file './acctest/acc-tests.xml' \
145-
# --title 'Acceptance Tests (${{ matrix.tf-binary }}) - ${{ github.run_id }} - ${{ job.check_run_id }}' \
146-
# --run-description 'GitHub workflow: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.check_run_id }}' \
147-
# --update-existing-cases 'yes' \
148-
# --case-matcher 'auto' \
149-
# --close-run
136+
- name: upload test results to TestRail
137+
if: ${{ always() && inputs.testrail-upload }}
138+
continue-on-error: true
139+
env:
140+
TR_CLI_HOST: ${{ secrets.testrail-host }}
141+
TR_CLI_USERNAME: ${{ secrets.testrail-username }}
142+
TR_CLI_KEY: ${{ secrets.testrail-api-key }}
143+
TR_CLI_PROJECT: ${{ secrets.testrail-project }}
144+
run: |
145+
uvx trcli \
146+
--yes `# Auto-create new test cases.` \
147+
parse_junit \
148+
--file './acctest/acc-tests.xml' \
149+
--title 'Acceptance Tests (${{ matrix.tf-binary }}) - ${{ github.run_id }} - ${{ job.check_run_id }}' \
150+
--run-description 'GitHub workflow: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.check_run_id }}' \
151+
--update-existing-cases 'yes' \
152+
--case-matcher 'auto' \
153+
--close-run
150154
- name: upload logs
151155
if: always()
152156
continue-on-error: true

.github/workflows/build-test.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ on:
1313
inputs:
1414
omicron_version:
1515
description: 'Git object to use for Omicron (commit SHA, tag, branch etc.). If not specified, the VERSION_OMICRON from oxide.go is used.'
16+
testrail-upload:
17+
description: 'Upload test results to TestRail'
18+
type: boolean
19+
required: false
20+
default: false
1621

1722
env:
1823
REGISTRY: ghcr.io
@@ -65,7 +70,7 @@ jobs:
6570
if: matrix.tf-binary == 'terraform' # Linting tools require Terraform to be installed.
6671
run: make lint
6772
- name: upload test results to TestRail
68-
if: always()
73+
if: ${{ always() && inputs.testrail-upload }}
6974
continue-on-error: true
7075
env:
7176
TR_CLI_HOST: ${{ secrets.TESTRAIL_HOST }}
@@ -170,6 +175,7 @@ jobs:
170175
uses: "./.github/workflows/acceptance-sim.yml"
171176
with:
172177
omicron-sha: ${{ needs.omicron-version.outputs.sha }}
178+
testrail-upload: ${{ inputs.testrail-upload || false }}
173179
secrets:
174180
testrail-host: ${{ secrets.TESTRAIL_HOST }}
175181
testrail-username: ${{ secrets.TESTRAIL_USERNAME }}

0 commit comments

Comments
 (0)