From 52318170d345cba740946d1fefe6a8917c18ecba Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 14:58:19 -0500 Subject: [PATCH] Increase verbosity in task runner action --- .github/actions/charm-run-task/action.yaml | 19 +++++++----- .github/workflows/_charm-linting.yaml | 3 +- .github/workflows/_charm-static-analysis.yaml | 29 ++----------------- .../workflows/_charm-tests-integration.yaml | 1 - .github/workflows/_charm-tests-scenario.yaml | 1 - .github/workflows/_charm-tests-unit.yaml | 1 - 6 files changed, 15 insertions(+), 39 deletions(-) diff --git a/.github/actions/charm-run-task/action.yaml b/.github/actions/charm-run-task/action.yaml index 14e46f8..15e9ff6 100644 --- a/.github/actions/charm-run-task/action.yaml +++ b/.github/actions/charm-run-task/action.yaml @@ -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: @@ -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 \ No newline at end of file diff --git a/.github/workflows/_charm-linting.yaml b/.github/workflows/_charm-linting.yaml index 765dcbf..6e8c035 100644 --- a/.github/workflows/_charm-linting.yaml +++ b/.github/workflows/_charm-linting.yaml @@ -9,7 +9,7 @@ on: jobs: lint: - name: Lint + name: Lint tests runs-on: ubuntu-latest steps: - name: Checkout @@ -29,4 +29,3 @@ jobs: with: charm-path: ${{ inputs.charm-path }} test-type: lint - tox-command: -vve lint diff --git a/.github/workflows/_charm-static-analysis.yaml b/.github/workflows/_charm-static-analysis.yaml index 7f77b09..cfa789b 100644 --- a/.github/workflows/_charm-static-analysis.yaml +++ b/.github/workflows/_charm-static-analysis.yaml @@ -9,14 +9,14 @@ 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 @@ -24,31 +24,8 @@ jobs: 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 diff --git a/.github/workflows/_charm-tests-integration.yaml b/.github/workflows/_charm-tests-integration.yaml index 0536174..68985f6 100644 --- a/.github/workflows/_charm-tests-integration.yaml +++ b/.github/workflows/_charm-tests-integration.yaml @@ -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 diff --git a/.github/workflows/_charm-tests-scenario.yaml b/.github/workflows/_charm-tests-scenario.yaml index a000aed..b098303 100644 --- a/.github/workflows/_charm-tests-scenario.yaml +++ b/.github/workflows/_charm-tests-scenario.yaml @@ -29,4 +29,3 @@ jobs: with: charm-path: ${{ inputs.charm-path }} test-type: scenario - tox-command: -e scenario diff --git a/.github/workflows/_charm-tests-unit.yaml b/.github/workflows/_charm-tests-unit.yaml index 66b0ccc..d321748 100644 --- a/.github/workflows/_charm-tests-unit.yaml +++ b/.github/workflows/_charm-tests-unit.yaml @@ -29,4 +29,3 @@ jobs: with: charm-path: ${{ inputs.charm-path }} test-type: unit - tox-command: -e unit