Skip to content

Commit

Permalink
Increase verbosity in task runner action
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelThamm committed Dec 19, 2024
1 parent 57e2616 commit 5231817
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 39 deletions.
19 changes: 11 additions & 8 deletions .github/actions/charm-run-task/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ inputs:
description: 'Path to the charm'
required: true
test-type:
description: 'Test type (e.g., lint, fmt, etc.)'
required: true
tox-command:
description: 'The tox command options and environment (e.g. -vve lint)'
description: 'Test type (e.g., lint, fmt, static, etc.)'
required: true

runs:
Expand All @@ -18,10 +15,16 @@ runs:
shell: bash
run: |
cd ${{ inputs.charm-path }}
if [ -f tox.ini ]; then
tox ${{ inputs.tox-command }} # If the tox.ini file exists, run Tox
else
if [ -f tox.ini ]; then # Run Tox
tox -vve ${{ inputs.test-type }}
elif [ -f Makefile ]; then # Run Make
if grep -q -E "^\s*${{ inputs.test-type }}:" Makefile; then
make ${{ inputs.test-type }} # If the test type exists, run it with Make
make ${{ inputs.test-type }}
else
echo "Error: Invalid Make target (${{ inputs.test-type }})."
exit 1
fi
else
echo "Error: Taskrunner file not found."
exit 1
fi
3 changes: 1 addition & 2 deletions .github/workflows/_charm-linting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
lint:
name: Lint
name: Lint tests
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -29,4 +29,3 @@ jobs:
with:
charm-path: ${{ inputs.charm-path }}
test-type: lint
tox-command: -vve lint
29 changes: 3 additions & 26 deletions .github/workflows/_charm-static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,23 @@ on:

jobs:
static-lib:
name: Static Analysis of Libs
name: Static static analysis for /lib and charm
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Python 3.8
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
python3 -m pip install tox
sudo snap install --classic astral-uv
- name: Run static analysis for /lib for 3.8
- name: Run tests
uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci
with:
charm-path: ${{ inputs.charm-path }}
test-type: static
tox-command: -vve static-lib
static-charm:
name: Static Analysis of Charm
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
python3 -m pip install tox
sudo snap install --classic astral-uv
- name: Run static analysis (charm)
uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci
with:
charm-path: ${{ inputs.charm-path }}
test-type: static
tox-command: -vve static-charm
1 change: 0 additions & 1 deletion .github/workflows/_charm-tests-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ jobs:
with:
charm-path: ${{ inputs.charm-path }}
test-type: integration
tox-command: -vve integration
- name: Dump logs
if: failure()
uses: canonical/charming-actions/dump-logs@main
1 change: 0 additions & 1 deletion .github/workflows/_charm-tests-scenario.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ jobs:
with:
charm-path: ${{ inputs.charm-path }}
test-type: scenario
tox-command: -e scenario
1 change: 0 additions & 1 deletion .github/workflows/_charm-tests-unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ jobs:
with:
charm-path: ${{ inputs.charm-path }}
test-type: unit
tox-command: -e unit

0 comments on commit 5231817

Please sign in to comment.