-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add conditional logic to allow Tox and Make (#252)
* Conditional logic to allow Tox and Make * New run-task custom action for charm PR workflows --------- Signed-off-by: Michael Thamm <[email protected]>
- Loading branch information
1 parent
c902fd4
commit fa49daf
Showing
6 changed files
with
83 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: 'Task Runner' | ||
description: 'Run tests for a charm' | ||
inputs: | ||
charm-path: | ||
type: string | ||
description: 'Path to the charm' | ||
required: true | ||
test-type: | ||
type: choice | ||
description: 'Test type for the task runner to execute' | ||
required: true | ||
options: | ||
- lint | ||
- static | ||
- unit | ||
- scenario | ||
- integration | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Run test | ||
shell: bash | ||
run: | | ||
cd ${{ inputs.charm-path }} | ||
if [ -f tox.ini ]; then # Run Tox | ||
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 }}" | ||
else | ||
echo "Warning: Make target does not exist -> ${{ inputs.test-type }}." | ||
fi | ||
else | ||
echo "Error: Taskrunner file not found." | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters