From 110835d723da5edeb55b34f924ac83823a759f00 Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 15:30:04 -0500 Subject: [PATCH] Add choice input for test-type --- .github/actions/charm-run-task/action.yaml | 22 ++++++++++++++----- .github/workflows/_charm-static-analysis.yaml | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/actions/charm-run-task/action.yaml b/.github/actions/charm-run-task/action.yaml index 15e9ff6..3774edc 100644 --- a/.github/actions/charm-run-task/action.yaml +++ b/.github/actions/charm-run-task/action.yaml @@ -2,11 +2,19 @@ name: 'Task Runner' description: 'Run tests for a charm' inputs: charm-path: + type: string description: 'Path to the charm' required: true test-type: - description: 'Test type (e.g., lint, fmt, static, etc.)' + type: choice + description: 'Test type for the task runner to execute' required: true + options: + - lint + - static + - unit + - scenario + - integration runs: using: 'composite' @@ -16,13 +24,17 @@ runs: run: | cd ${{ inputs.charm-path }} if [ -f tox.ini ]; then # Run Tox - tox -vve ${{ inputs.test-type }} + if [ "${{ inputs.test-type }}" == "static" ]; then + tox -vve "static-lib" + tox -vve "static-charm" + else + tox -vve "${{ inputs.test-type }}" + fi elif [ -f Makefile ]; then # Run Make if grep -q -E "^\s*${{ inputs.test-type }}:" Makefile; then - make ${{ inputs.test-type }} + make "${{ inputs.test-type }}" else - echo "Error: Invalid Make target (${{ inputs.test-type }})." - exit 1 + echo "Error: Invalid Make target -> ${{ inputs.test-type }}." fi else echo "Error: Taskrunner file not found." diff --git a/.github/workflows/_charm-static-analysis.yaml b/.github/workflows/_charm-static-analysis.yaml index cfa789b..7683fca 100644 --- a/.github/workflows/_charm-static-analysis.yaml +++ b/.github/workflows/_charm-static-analysis.yaml @@ -8,7 +8,7 @@ on: required: false jobs: - static-lib: + static: name: Static static analysis for /lib and charm runs-on: ubuntu-20.04 steps: