Skip to content

Commit

Permalink
Add choice input for test-type
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelThamm committed Dec 19, 2024
1 parent 5231817 commit 110835d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
22 changes: 17 additions & 5 deletions .github/actions/charm-run-task/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_charm-static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 110835d

Please sign in to comment.