Skip to content

Commit

Permalink
Allow to control which sanity tests run / do not run / are enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Jan 21, 2024
1 parent 44d8f55 commit 1f17234
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,21 @@ The [`python-path` output value][`python-path`] of the [setup-python] action
The actual value of `origin-python-version` passed to the [setup-python] action


### `sanity-tests`

Comma-separated list of sanity tests to run. If not present, all applicable tests are run.


### `sanity-skip-tests`

Comma-separated list of sanity tests to skip.


### `sanity-allow-disabled`

Allow sanity tests to run which are disabled by default.


## Related community projects

Check out the [Data-Bene/ansible-test-versions-gh-action] to explore
Expand Down
29 changes: 29 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ inputs:
deprecationMessage: >-
Replace `python-version` with `origin-python-version`.
It is scheduled to be removed in version 3 of this action.
sanity-tests:
description: Comma-separated list of sanity tests to run. If not present, all applicable tests are run.
sanity-skip-tests:
description: Comma-separated list of sanity tests to skip.
sanity-allow-disabled:
description: Allow sanity tests to run which are disabled by default.
default: false
target:
description: ansible-test TARGET
target-python-version:
Expand All @@ -94,6 +101,7 @@ inputs:
required: true
test-deps:
description: Test dependencies to install along with this collection

outputs:
ansible-playbook-executable:
description: Path to the auto-installed `ansible-playbook` executable
Expand Down Expand Up @@ -248,6 +256,9 @@ runs:
GHA_INTEGRATION_RETRY_ON_ERROR: ${{ inputs.integration-retry-on-error }}
GHA_PULL_REQUEST_BASE_REF: ${{ github.event.pull_request.base.ref || '' }}
GHA_PULL_REQUEST_CHANGE_DETECTION: ${{ inputs.pull-request-change-detection }}
GHA_SANITY_TESTS: ${{ inputs.sanity-tests }}
GHA_SANITY_SKIP_TESTS: ${{ inputs.sanity-skip-tests }}
GHA_SANITY_ALLOW_DISABLED: ${{ inputs.sanity-allow-disabled }}
GHA_TARGET: ${{ inputs.target }}
GHA_TARGET_PYTHON_VERSION: ${{ inputs.target-python-version }}
GHA_TESTING_TYPE: ${{ inputs.testing-type }}
Expand Down Expand Up @@ -276,6 +287,9 @@ runs:
gha_integration_retry_on_error = json.loads(os.environ['GHA_INTEGRATION_RETRY_ON_ERROR'])
gha_pull_request_branch = os.environ['GHA_PULL_REQUEST_BASE_REF']
gha_pull_request_change_detection = json.loads(os.environ['GHA_PULL_REQUEST_CHANGE_DETECTION'])
gha_sanity_tests = os.environ['GHA_SANITY_TESTS']
gha_sanity_skip_tests = os.environ['GHA_SANITY_SKIP_TESTS']
gha_sanity_allow_disabled = json.loads(os.environ['GHA_SANITY_ALLOW_DISABLED'])
gha_target = os.environ['GHA_TARGET']
gha_target_python_version = os.environ['GHA_TARGET_PYTHON_VERSION']
gha_testing_type = os.environ['GHA_TESTING_TYPE']
Expand Down Expand Up @@ -312,6 +326,21 @@ runs:
if gha_testing_type == 'sanity':
command.append('--junit')
if gha_sanity_tests:
for test in gha_sanity_tests.split(','):
command.extend([
'--test',
test.strip(),
])
if gha_sanity_skip_tests:
for test in gha_sanity_skip_tests.split(','):
command.extend([
'--skip-test',
test.strip(),
])
if gha_sanity_allow_disabled:
command.append('--allow-disabled')
if gha_testing_type == 'integration':
if gha_integration_retry_on_error:
command.append('--retry-on-error')
Expand Down

0 comments on commit 1f17234

Please sign in to comment.