From 2f910cd833e1fc4f1996850b7d0c1198d71e4a56 Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Sun, 15 Dec 2024 18:05:16 -0500 Subject: [PATCH 01/19] Add conditional logic to allow CI and Make --- .github/workflows/_charm-linting.yaml | 6 +++++- .github/workflows/_charm-static-analysis.yaml | 12 ++++++++++-- .github/workflows/_charm-tests-integration.yaml | 6 +++++- .github/workflows/_charm-tests-scenario.yaml | 6 +++++- .github/workflows/_charm-tests-unit.yaml | 6 +++++- 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.github/workflows/_charm-linting.yaml b/.github/workflows/_charm-linting.yaml index baac935..5cbaafc 100644 --- a/.github/workflows/_charm-linting.yaml +++ b/.github/workflows/_charm-linting.yaml @@ -27,4 +27,8 @@ jobs: - name: Run linters run: | cd ${{ inputs.charm-path }} - [ -f tox.ini ] && tox -vve lint || make lint + if [ -f tox.ini ]; then + tox -vve lint + else + make lint + fi diff --git a/.github/workflows/_charm-static-analysis.yaml b/.github/workflows/_charm-static-analysis.yaml index 50292be..6667953 100644 --- a/.github/workflows/_charm-static-analysis.yaml +++ b/.github/workflows/_charm-static-analysis.yaml @@ -27,7 +27,11 @@ jobs: - name: Run static analysis for /lib for 3.8 run: | cd ${{ inputs.charm-path }} - [ -f tox.ini ] && tox -vve static-lib || make static + if [ -f tox.ini ]; then + tox -vve static-lib + else + make static + fi static-charm: name: Static Analysis of Charm runs-on: ubuntu-latest @@ -47,4 +51,8 @@ jobs: - name: Run static analysis (charm) run: | cd ${{ inputs.charm-path }} - [ -f tox.ini ] && tox -vve static-charm || make static + if [ -f tox.ini ]; then + tox -vve static-charm + else + make static + fi diff --git a/.github/workflows/_charm-tests-integration.yaml b/.github/workflows/_charm-tests-integration.yaml index 1a07b29..7e5c010 100644 --- a/.github/workflows/_charm-tests-integration.yaml +++ b/.github/workflows/_charm-tests-integration.yaml @@ -71,7 +71,11 @@ jobs: - name: Run integration tests run: | cd ${{ inputs.charm-path }} - [ -f tox.ini ] && tox -vve integration || make integration + if [ -f tox.ini ]; then + tox -vve integration + else + make integration + fi - 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 695df55..fccaa6b 100644 --- a/.github/workflows/_charm-tests-scenario.yaml +++ b/.github/workflows/_charm-tests-scenario.yaml @@ -27,4 +27,8 @@ jobs: - name: Run tests run: | cd ${{ inputs.charm-path }} - [ -f tox.ini ] && tox -e scenario || make scenario || echo "Skipping scenario..." + if [ -f tox.ini ]; then + tox -e scenario + else + make scenario + fi diff --git a/.github/workflows/_charm-tests-unit.yaml b/.github/workflows/_charm-tests-unit.yaml index 11395e5..5cac2db 100644 --- a/.github/workflows/_charm-tests-unit.yaml +++ b/.github/workflows/_charm-tests-unit.yaml @@ -27,4 +27,8 @@ jobs: - name: Run tests run: | cd ${{ inputs.charm-path }} - [ -f tox.ini ] && tox -e unit || make unit + if [ -f tox.ini ]; then + tox -e unit + else + make unit + fi From a5e2115e440b7c7de6e4ff344bb3615298f195a5 Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Mon, 16 Dec 2024 10:55:51 -0500 Subject: [PATCH 02/19] If the Make recipe does not exist, ignore it --- .github/workflows/_charm-linting.yaml | 7 +++++-- .github/workflows/_charm-static-analysis.yaml | 14 ++++++++++---- .github/workflows/_charm-tests-integration.yaml | 7 +++++-- .github/workflows/_charm-tests-scenario.yaml | 7 +++++-- .github/workflows/_charm-tests-unit.yaml | 7 +++++-- 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/.github/workflows/_charm-linting.yaml b/.github/workflows/_charm-linting.yaml index 5cbaafc..b42bccb 100644 --- a/.github/workflows/_charm-linting.yaml +++ b/.github/workflows/_charm-linting.yaml @@ -27,8 +27,11 @@ jobs: - name: Run linters run: | cd ${{ inputs.charm-path }} + test_type="lint" if [ -f tox.ini ]; then - tox -vve lint + tox -vve "$test_type" # If the tox.ini file exists, run Tox else - make lint + if grep -q -E "^\s*${test_type}:" Makefile; then + make $test_type # If the test type exists, run it with Make + fi fi diff --git a/.github/workflows/_charm-static-analysis.yaml b/.github/workflows/_charm-static-analysis.yaml index 6667953..95a44a7 100644 --- a/.github/workflows/_charm-static-analysis.yaml +++ b/.github/workflows/_charm-static-analysis.yaml @@ -27,10 +27,13 @@ jobs: - name: Run static analysis for /lib for 3.8 run: | cd ${{ inputs.charm-path }} + test_type="static-lib" if [ -f tox.ini ]; then - tox -vve static-lib + tox -vve "$test_type" # If the tox.ini file exists, run Tox else - make static + if grep -q -E "^\s*${test_type}:" Makefile; then + make $test_type # If the test type exists, run it with Make + fi fi static-charm: name: Static Analysis of Charm @@ -51,8 +54,11 @@ jobs: - name: Run static analysis (charm) run: | cd ${{ inputs.charm-path }} + test_type="static-charm" if [ -f tox.ini ]; then - tox -vve static-charm + tox -vve "$test_type" # If the tox.ini file exists, run Tox else - make static + if grep -q -E "^\s*${test_type}:" Makefile; then + make $test_type # If the test type exists, run it with Make + fi fi diff --git a/.github/workflows/_charm-tests-integration.yaml b/.github/workflows/_charm-tests-integration.yaml index 7e5c010..4ebd619 100644 --- a/.github/workflows/_charm-tests-integration.yaml +++ b/.github/workflows/_charm-tests-integration.yaml @@ -71,10 +71,13 @@ jobs: - name: Run integration tests run: | cd ${{ inputs.charm-path }} + test_type="integration" if [ -f tox.ini ]; then - tox -vve integration + tox -vve "$test_type" # If the tox.ini file exists, run Tox else - make integration + if grep -q -E "^\s*${test_type}:" Makefile; then + make $test_type # If the test type exists, run it with Make + fi fi - name: Dump logs if: failure() diff --git a/.github/workflows/_charm-tests-scenario.yaml b/.github/workflows/_charm-tests-scenario.yaml index fccaa6b..3628fb7 100644 --- a/.github/workflows/_charm-tests-scenario.yaml +++ b/.github/workflows/_charm-tests-scenario.yaml @@ -27,8 +27,11 @@ jobs: - name: Run tests run: | cd ${{ inputs.charm-path }} + test_type="scenario" if [ -f tox.ini ]; then - tox -e scenario + tox -e "$test_type" # If the tox.ini file exists, run Tox else - make scenario + if grep -q -E "^\s*${test_type}:" Makefile; then + make $test_type # If the test type exists, run it with Make + fi fi diff --git a/.github/workflows/_charm-tests-unit.yaml b/.github/workflows/_charm-tests-unit.yaml index 5cac2db..be64b91 100644 --- a/.github/workflows/_charm-tests-unit.yaml +++ b/.github/workflows/_charm-tests-unit.yaml @@ -27,8 +27,11 @@ jobs: - name: Run tests run: | cd ${{ inputs.charm-path }} + test_type="unit" if [ -f tox.ini ]; then - tox -e unit + tox -e "$test_type" # If the tox.ini file exists, run Tox else - make unit + if grep -q -E "^\s*${test_type}:" Makefile; then + make $test_type # If the test type exists, run it with Make + fi fi From c280918af48a0c05923266fc18689597867d6f59 Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Wed, 18 Dec 2024 22:17:32 -0500 Subject: [PATCH 03/19] add run-task custom action for charm PR workflows --- .github/actions/charm-run-task.yaml | 27 +++++++++++++++++ .github/workflows/_charm-linting.yaml | 17 ++++------- .github/workflows/_charm-static-analysis.yaml | 30 +++++++------------ .../workflows/_charm-tests-integration.yaml | 17 ++++------- .github/workflows/_charm-tests-scenario.yaml | 15 ++++------ .github/workflows/_charm-tests-unit.yaml | 15 ++++------ 6 files changed, 59 insertions(+), 62 deletions(-) create mode 100644 .github/actions/charm-run-task.yaml diff --git a/.github/actions/charm-run-task.yaml b/.github/actions/charm-run-task.yaml new file mode 100644 index 0000000..24f5f4d --- /dev/null +++ b/.github/actions/charm-run-task.yaml @@ -0,0 +1,27 @@ +name: 'Task Runner' +description: 'Run tests or linters for a charm' +inputs: + charm-path: + 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)' + required: true + +runs: + using: 'bash' + steps: + - name: Run linters + 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 grep -q -E "^\s*${{ inputs.test-type }}:" Makefile; then + make ${{ inputs.test-type }} # If the test type exists, run it with Make + fi + fi \ No newline at end of file diff --git a/.github/workflows/_charm-linting.yaml b/.github/workflows/_charm-linting.yaml index b42bccb..ea83adf 100644 --- a/.github/workflows/_charm-linting.yaml +++ b/.github/workflows/_charm-linting.yaml @@ -24,14 +24,9 @@ jobs: run: | python3 -m pip install tox sudo snap install --classic astral-uv - - name: Run linters - run: | - cd ${{ inputs.charm-path }} - test_type="lint" - if [ -f tox.ini ]; then - tox -vve "$test_type" # If the tox.ini file exists, run Tox - else - if grep -q -E "^\s*${test_type}:" Makefile; then - make $test_type # If the test type exists, run it with Make - fi - fi + - name: Run tests + uses: actions/charm-run-task + 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 95a44a7..a124c88 100644 --- a/.github/workflows/_charm-static-analysis.yaml +++ b/.github/workflows/_charm-static-analysis.yaml @@ -25,16 +25,11 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run static analysis for /lib for 3.8 - run: | - cd ${{ inputs.charm-path }} - test_type="static-lib" - if [ -f tox.ini ]; then - tox -vve "$test_type" # If the tox.ini file exists, run Tox - else - if grep -q -E "^\s*${test_type}:" Makefile; then - make $test_type # If the test type exists, run it with Make - fi - fi + uses: actions/charm-run-task + 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 @@ -52,13 +47,8 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run static analysis (charm) - run: | - cd ${{ inputs.charm-path }} - test_type="static-charm" - if [ -f tox.ini ]; then - tox -vve "$test_type" # If the tox.ini file exists, run Tox - else - if grep -q -E "^\s*${test_type}:" Makefile; then - make $test_type # If the test type exists, run it with Make - fi - fi + uses: actions/charm-run-task + 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 4ebd619..8cf7aef 100644 --- a/.github/workflows/_charm-tests-integration.yaml +++ b/.github/workflows/_charm-tests-integration.yaml @@ -68,17 +68,12 @@ jobs: - name: Install dependencies run: | sudo snap install --classic astral-uv - - name: Run integration tests - run: | - cd ${{ inputs.charm-path }} - test_type="integration" - if [ -f tox.ini ]; then - tox -vve "$test_type" # If the tox.ini file exists, run Tox - else - if grep -q -E "^\s*${test_type}:" Makefile; then - make $test_type # If the test type exists, run it with Make - fi - fi + - name: Run tests + uses: actions/charm-run-task + 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 3628fb7..d01ae3e 100644 --- a/.github/workflows/_charm-tests-scenario.yaml +++ b/.github/workflows/_charm-tests-scenario.yaml @@ -25,13 +25,8 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - run: | - cd ${{ inputs.charm-path }} - test_type="scenario" - if [ -f tox.ini ]; then - tox -e "$test_type" # If the tox.ini file exists, run Tox - else - if grep -q -E "^\s*${test_type}:" Makefile; then - make $test_type # If the test type exists, run it with Make - fi - fi + uses: actions/charm-run-task + 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 be64b91..fe0b27e 100644 --- a/.github/workflows/_charm-tests-unit.yaml +++ b/.github/workflows/_charm-tests-unit.yaml @@ -25,13 +25,8 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - run: | - cd ${{ inputs.charm-path }} - test_type="unit" - if [ -f tox.ini ]; then - tox -e "$test_type" # If the tox.ini file exists, run Tox - else - if grep -q -E "^\s*${test_type}:" Makefile; then - make $test_type # If the test type exists, run it with Make - fi - fi + uses: actions/charm-run-task + with: + charm-path: ${{ inputs.charm-path }} + test-type: unit + tox-command: -e unit From aa1c4c493364b6af2700fd48519d038cbd61f25e Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 08:37:41 -0500 Subject: [PATCH 04/19] point at branch for CI --- .github/workflows/_charm-linting.yaml | 2 +- .github/workflows/_charm-quality-checks.yaml | 10 +++++----- .github/workflows/_charm-static-analysis.yaml | 4 ++-- .github/workflows/_charm-tests-integration.yaml | 2 +- .github/workflows/_charm-tests-scenario.yaml | 2 +- .github/workflows/_charm-tests-unit.yaml | 2 +- .github/workflows/charm-pull-request.yaml | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/_charm-linting.yaml b/.github/workflows/_charm-linting.yaml index ea83adf..2735c4c 100644 --- a/.github/workflows/_charm-linting.yaml +++ b/.github/workflows/_charm-linting.yaml @@ -25,7 +25,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: actions/charm-run-task + uses: actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: lint diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 2835693..7228c49 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -64,22 +64,22 @@ jobs: charmcraft-channel: "${{ inputs.charmcraft-channel }}" static-analysis: name: Static Analysis - uses: canonical/observability/.github/workflows/_charm-static-analysis.yaml@main + uses: canonical/observability/.github/workflows/_charm-static-analysis.yaml@feature/conditional-ci with: charm-path: "${{ inputs.charm-path }}" linting: name: Linting - uses: canonical/observability/.github/workflows/_charm-linting.yaml@main + uses: canonical/observability/.github/workflows/_charm-linting.yaml@feature/conditional-ci with: charm-path: "${{ inputs.charm-path }}" unit-test: name: Unit Tests - uses: canonical/observability/.github/workflows/_charm-tests-unit.yaml@main + uses: canonical/observability/.github/workflows/_charm-tests-unit.yaml@feature/conditional-ci with: charm-path: "${{ inputs.charm-path }}" scenario-test: name: Scenario Tests - uses: canonical/observability/.github/workflows/_charm-tests-scenario.yaml@main + uses: canonical/observability/.github/workflows/_charm-tests-scenario.yaml@feature/conditional-ci with: charm-path: "${{ inputs.charm-path }}" integration-test: @@ -89,7 +89,7 @@ jobs: - linting - unit-test - scenario-test - uses: canonical/observability/.github/workflows/_charm-tests-integration.yaml@main + uses: canonical/observability/.github/workflows/_charm-tests-integration.yaml@feature/conditional-ci with: charm-path: "${{ inputs.charm-path }}" provider: "${{ inputs.provider }}" diff --git a/.github/workflows/_charm-static-analysis.yaml b/.github/workflows/_charm-static-analysis.yaml index a124c88..abb0954 100644 --- a/.github/workflows/_charm-static-analysis.yaml +++ b/.github/workflows/_charm-static-analysis.yaml @@ -25,7 +25,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run static analysis for /lib for 3.8 - uses: actions/charm-run-task + uses: actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: static @@ -47,7 +47,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run static analysis (charm) - uses: actions/charm-run-task + uses: actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: static diff --git a/.github/workflows/_charm-tests-integration.yaml b/.github/workflows/_charm-tests-integration.yaml index 8cf7aef..6759266 100644 --- a/.github/workflows/_charm-tests-integration.yaml +++ b/.github/workflows/_charm-tests-integration.yaml @@ -69,7 +69,7 @@ jobs: run: | sudo snap install --classic astral-uv - name: Run tests - uses: actions/charm-run-task + uses: actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: integration diff --git a/.github/workflows/_charm-tests-scenario.yaml b/.github/workflows/_charm-tests-scenario.yaml index d01ae3e..e6165f8 100644 --- a/.github/workflows/_charm-tests-scenario.yaml +++ b/.github/workflows/_charm-tests-scenario.yaml @@ -25,7 +25,7 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: actions/charm-run-task + uses: actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: scenario diff --git a/.github/workflows/_charm-tests-unit.yaml b/.github/workflows/_charm-tests-unit.yaml index fe0b27e..fcca7ba 100644 --- a/.github/workflows/_charm-tests-unit.yaml +++ b/.github/workflows/_charm-tests-unit.yaml @@ -25,7 +25,7 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: actions/charm-run-task + uses: actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: unit diff --git a/.github/workflows/charm-pull-request.yaml b/.github/workflows/charm-pull-request.yaml index 5986207..b791e93 100644 --- a/.github/workflows/charm-pull-request.yaml +++ b/.github/workflows/charm-pull-request.yaml @@ -68,7 +68,7 @@ jobs: needs: - ci-ignore if: needs.ci-ignore.outputs.any_modified == 'true' - uses: canonical/observability/.github/workflows/_charm-quality-checks.yaml@main + uses: canonical/observability/.github/workflows/_charm-quality-checks.yaml@feature/conditional-ci secrets: inherit with: charm-path: ${{ inputs.charm-path }} From 6ffb17e9d0092bcd4f063bca57368eb119f685fd Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 10:58:51 -0500 Subject: [PATCH 05/19] add rel path for action --- .github/actions/charm-run-task.yaml | 2 +- .github/workflows/_charm-linting.yaml | 2 +- .github/workflows/_charm-static-analysis.yaml | 4 ++-- .github/workflows/_charm-tests-integration.yaml | 2 +- .github/workflows/_charm-tests-scenario.yaml | 2 +- .github/workflows/_charm-tests-unit.yaml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/actions/charm-run-task.yaml b/.github/actions/charm-run-task.yaml index 24f5f4d..adb3191 100644 --- a/.github/actions/charm-run-task.yaml +++ b/.github/actions/charm-run-task.yaml @@ -14,7 +14,7 @@ inputs: runs: using: 'bash' steps: - - name: Run linters + - name: Run test shell: bash run: | cd ${{ inputs.charm-path }} diff --git a/.github/workflows/_charm-linting.yaml b/.github/workflows/_charm-linting.yaml index 2735c4c..4dc3ca4 100644 --- a/.github/workflows/_charm-linting.yaml +++ b/.github/workflows/_charm-linting.yaml @@ -25,7 +25,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: actions/charm-run-task@feature/conditional-ci + uses: ./.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: lint diff --git a/.github/workflows/_charm-static-analysis.yaml b/.github/workflows/_charm-static-analysis.yaml index abb0954..c9be566 100644 --- a/.github/workflows/_charm-static-analysis.yaml +++ b/.github/workflows/_charm-static-analysis.yaml @@ -25,7 +25,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run static analysis for /lib for 3.8 - uses: actions/charm-run-task@feature/conditional-ci + uses: ./.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: static @@ -47,7 +47,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run static analysis (charm) - uses: actions/charm-run-task@feature/conditional-ci + uses: ./.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: static diff --git a/.github/workflows/_charm-tests-integration.yaml b/.github/workflows/_charm-tests-integration.yaml index 6759266..1f29ef1 100644 --- a/.github/workflows/_charm-tests-integration.yaml +++ b/.github/workflows/_charm-tests-integration.yaml @@ -69,7 +69,7 @@ jobs: run: | sudo snap install --classic astral-uv - name: Run tests - uses: actions/charm-run-task@feature/conditional-ci + uses: ./.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: integration diff --git a/.github/workflows/_charm-tests-scenario.yaml b/.github/workflows/_charm-tests-scenario.yaml index e6165f8..c2a51c1 100644 --- a/.github/workflows/_charm-tests-scenario.yaml +++ b/.github/workflows/_charm-tests-scenario.yaml @@ -25,7 +25,7 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: actions/charm-run-task@feature/conditional-ci + uses: ./.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: scenario diff --git a/.github/workflows/_charm-tests-unit.yaml b/.github/workflows/_charm-tests-unit.yaml index fcca7ba..5f284cc 100644 --- a/.github/workflows/_charm-tests-unit.yaml +++ b/.github/workflows/_charm-tests-unit.yaml @@ -25,7 +25,7 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: actions/charm-run-task@feature/conditional-ci + uses: ./.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: unit From 649f6854c7c7e5099c7fbf5bcf4ffa46ebbe71d9 Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 11:44:58 -0500 Subject: [PATCH 06/19] test remove if in quality-checks --- .github/actions/charm-run-task.yaml | 2 +- .github/workflows/charm-pull-request.yaml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/charm-run-task.yaml b/.github/actions/charm-run-task.yaml index adb3191..4ace2f2 100644 --- a/.github/actions/charm-run-task.yaml +++ b/.github/actions/charm-run-task.yaml @@ -1,5 +1,5 @@ name: 'Task Runner' -description: 'Run tests or linters for a charm' +description: 'Run tests for a charm' inputs: charm-path: description: 'Path to the charm' diff --git a/.github/workflows/charm-pull-request.yaml b/.github/workflows/charm-pull-request.yaml index b791e93..9086b6a 100644 --- a/.github/workflows/charm-pull-request.yaml +++ b/.github/workflows/charm-pull-request.yaml @@ -67,7 +67,6 @@ jobs: name: Quality Checks needs: - ci-ignore - if: needs.ci-ignore.outputs.any_modified == 'true' uses: canonical/observability/.github/workflows/_charm-quality-checks.yaml@feature/conditional-ci secrets: inherit with: From c2fc39b114384f2da8aeccbc4823315b6817436f Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 11:56:17 -0500 Subject: [PATCH 07/19] fix dir structure --- .../actions/{charm-run-task.yaml => charm-run-task/action.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/actions/{charm-run-task.yaml => charm-run-task/action.yaml} (100%) diff --git a/.github/actions/charm-run-task.yaml b/.github/actions/charm-run-task/action.yaml similarity index 100% rename from .github/actions/charm-run-task.yaml rename to .github/actions/charm-run-task/action.yaml From 61813721199a0b4ab868f0607bcf802b696542d8 Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 12:01:37 -0500 Subject: [PATCH 08/19] chore: remove branch on action --- .github/workflows/_charm-linting.yaml | 2 +- .github/workflows/_charm-static-analysis.yaml | 4 ++-- .github/workflows/_charm-tests-integration.yaml | 2 +- .github/workflows/_charm-tests-scenario.yaml | 2 +- .github/workflows/_charm-tests-unit.yaml | 2 +- .github/workflows/charm-pull-request.yaml | 1 + 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/_charm-linting.yaml b/.github/workflows/_charm-linting.yaml index 4dc3ca4..70aee21 100644 --- a/.github/workflows/_charm-linting.yaml +++ b/.github/workflows/_charm-linting.yaml @@ -25,7 +25,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: ./.github/actions/charm-run-task@feature/conditional-ci + uses: ./.github/actions/charm-run-task with: charm-path: ${{ inputs.charm-path }} test-type: lint diff --git a/.github/workflows/_charm-static-analysis.yaml b/.github/workflows/_charm-static-analysis.yaml index c9be566..8d8b5d3 100644 --- a/.github/workflows/_charm-static-analysis.yaml +++ b/.github/workflows/_charm-static-analysis.yaml @@ -25,7 +25,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run static analysis for /lib for 3.8 - uses: ./.github/actions/charm-run-task@feature/conditional-ci + uses: ./.github/actions/charm-run-task with: charm-path: ${{ inputs.charm-path }} test-type: static @@ -47,7 +47,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run static analysis (charm) - uses: ./.github/actions/charm-run-task@feature/conditional-ci + uses: ./.github/actions/charm-run-task with: charm-path: ${{ inputs.charm-path }} test-type: static diff --git a/.github/workflows/_charm-tests-integration.yaml b/.github/workflows/_charm-tests-integration.yaml index 1f29ef1..3c6a2f2 100644 --- a/.github/workflows/_charm-tests-integration.yaml +++ b/.github/workflows/_charm-tests-integration.yaml @@ -69,7 +69,7 @@ jobs: run: | sudo snap install --classic astral-uv - name: Run tests - uses: ./.github/actions/charm-run-task@feature/conditional-ci + uses: ./.github/actions/charm-run-task with: charm-path: ${{ inputs.charm-path }} test-type: integration diff --git a/.github/workflows/_charm-tests-scenario.yaml b/.github/workflows/_charm-tests-scenario.yaml index c2a51c1..64128f5 100644 --- a/.github/workflows/_charm-tests-scenario.yaml +++ b/.github/workflows/_charm-tests-scenario.yaml @@ -25,7 +25,7 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: ./.github/actions/charm-run-task@feature/conditional-ci + uses: ./.github/actions/charm-run-task with: charm-path: ${{ inputs.charm-path }} test-type: scenario diff --git a/.github/workflows/_charm-tests-unit.yaml b/.github/workflows/_charm-tests-unit.yaml index 5f284cc..975f1f5 100644 --- a/.github/workflows/_charm-tests-unit.yaml +++ b/.github/workflows/_charm-tests-unit.yaml @@ -25,7 +25,7 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: ./.github/actions/charm-run-task@feature/conditional-ci + uses: ./.github/actions/charm-run-task with: charm-path: ${{ inputs.charm-path }} test-type: unit diff --git a/.github/workflows/charm-pull-request.yaml b/.github/workflows/charm-pull-request.yaml index 9086b6a..b791e93 100644 --- a/.github/workflows/charm-pull-request.yaml +++ b/.github/workflows/charm-pull-request.yaml @@ -67,6 +67,7 @@ jobs: name: Quality Checks needs: - ci-ignore + if: needs.ci-ignore.outputs.any_modified == 'true' uses: canonical/observability/.github/workflows/_charm-quality-checks.yaml@feature/conditional-ci secrets: inherit with: From 2f57bc601ec127baaadb33fdc40f45d31aa89c1e Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 12:04:24 -0500 Subject: [PATCH 09/19] test --- .github/workflows/charm-pull-request.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/charm-pull-request.yaml b/.github/workflows/charm-pull-request.yaml index b791e93..9086b6a 100644 --- a/.github/workflows/charm-pull-request.yaml +++ b/.github/workflows/charm-pull-request.yaml @@ -67,7 +67,6 @@ jobs: name: Quality Checks needs: - ci-ignore - if: needs.ci-ignore.outputs.any_modified == 'true' uses: canonical/observability/.github/workflows/_charm-quality-checks.yaml@feature/conditional-ci secrets: inherit with: From 59aa2de9675647fdb2664958b8a41029a45b9cdd Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 12:20:02 -0500 Subject: [PATCH 10/19] test --- .github/actions/charm-run-task/action.yaml | 2 +- .github/workflows/_charm-linting.yaml | 2 +- .github/workflows/_charm-static-analysis.yaml | 4 ++-- .github/workflows/_charm-tests-integration.yaml | 2 +- .github/workflows/_charm-tests-scenario.yaml | 2 +- .github/workflows/_charm-tests-unit.yaml | 2 +- .github/workflows/charm-pull-request.yaml | 1 + 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/actions/charm-run-task/action.yaml b/.github/actions/charm-run-task/action.yaml index 4ace2f2..14e46f8 100644 --- a/.github/actions/charm-run-task/action.yaml +++ b/.github/actions/charm-run-task/action.yaml @@ -12,7 +12,7 @@ inputs: required: true runs: - using: 'bash' + using: 'composite' steps: - name: Run test shell: bash diff --git a/.github/workflows/_charm-linting.yaml b/.github/workflows/_charm-linting.yaml index 70aee21..4dc3ca4 100644 --- a/.github/workflows/_charm-linting.yaml +++ b/.github/workflows/_charm-linting.yaml @@ -25,7 +25,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: ./.github/actions/charm-run-task + uses: ./.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: lint diff --git a/.github/workflows/_charm-static-analysis.yaml b/.github/workflows/_charm-static-analysis.yaml index 8d8b5d3..c9be566 100644 --- a/.github/workflows/_charm-static-analysis.yaml +++ b/.github/workflows/_charm-static-analysis.yaml @@ -25,7 +25,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run static analysis for /lib for 3.8 - uses: ./.github/actions/charm-run-task + uses: ./.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: static @@ -47,7 +47,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run static analysis (charm) - uses: ./.github/actions/charm-run-task + uses: ./.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: static diff --git a/.github/workflows/_charm-tests-integration.yaml b/.github/workflows/_charm-tests-integration.yaml index 3c6a2f2..1f29ef1 100644 --- a/.github/workflows/_charm-tests-integration.yaml +++ b/.github/workflows/_charm-tests-integration.yaml @@ -69,7 +69,7 @@ jobs: run: | sudo snap install --classic astral-uv - name: Run tests - uses: ./.github/actions/charm-run-task + uses: ./.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: integration diff --git a/.github/workflows/_charm-tests-scenario.yaml b/.github/workflows/_charm-tests-scenario.yaml index 64128f5..c2a51c1 100644 --- a/.github/workflows/_charm-tests-scenario.yaml +++ b/.github/workflows/_charm-tests-scenario.yaml @@ -25,7 +25,7 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: ./.github/actions/charm-run-task + uses: ./.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: scenario diff --git a/.github/workflows/_charm-tests-unit.yaml b/.github/workflows/_charm-tests-unit.yaml index 975f1f5..5f284cc 100644 --- a/.github/workflows/_charm-tests-unit.yaml +++ b/.github/workflows/_charm-tests-unit.yaml @@ -25,7 +25,7 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: ./.github/actions/charm-run-task + uses: ./.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: unit diff --git a/.github/workflows/charm-pull-request.yaml b/.github/workflows/charm-pull-request.yaml index 9086b6a..8d64b70 100644 --- a/.github/workflows/charm-pull-request.yaml +++ b/.github/workflows/charm-pull-request.yaml @@ -67,6 +67,7 @@ jobs: name: Quality Checks needs: - ci-ignore + # if: needs.ci-ignore.outputs.any_modified == 'true' uses: canonical/observability/.github/workflows/_charm-quality-checks.yaml@feature/conditional-ci secrets: inherit with: From f7a4d38a202f748e12590cd1094c08dbac654ba6 Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 12:27:53 -0500 Subject: [PATCH 11/19] test --- .github/workflows/_charm-linting.yaml | 2 +- .github/workflows/_charm-static-analysis.yaml | 4 ++-- .github/workflows/_charm-tests-integration.yaml | 2 +- .github/workflows/_charm-tests-scenario.yaml | 2 +- .github/workflows/_charm-tests-unit.yaml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/_charm-linting.yaml b/.github/workflows/_charm-linting.yaml index 4dc3ca4..765dcbf 100644 --- a/.github/workflows/_charm-linting.yaml +++ b/.github/workflows/_charm-linting.yaml @@ -25,7 +25,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: ./.github/actions/charm-run-task@feature/conditional-ci + uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: lint diff --git a/.github/workflows/_charm-static-analysis.yaml b/.github/workflows/_charm-static-analysis.yaml index c9be566..7f77b09 100644 --- a/.github/workflows/_charm-static-analysis.yaml +++ b/.github/workflows/_charm-static-analysis.yaml @@ -25,7 +25,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run static analysis for /lib for 3.8 - uses: ./.github/actions/charm-run-task@feature/conditional-ci + uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: static @@ -47,7 +47,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run static analysis (charm) - uses: ./.github/actions/charm-run-task@feature/conditional-ci + uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: static diff --git a/.github/workflows/_charm-tests-integration.yaml b/.github/workflows/_charm-tests-integration.yaml index 1f29ef1..0536174 100644 --- a/.github/workflows/_charm-tests-integration.yaml +++ b/.github/workflows/_charm-tests-integration.yaml @@ -69,7 +69,7 @@ jobs: run: | sudo snap install --classic astral-uv - name: Run tests - uses: ./.github/actions/charm-run-task@feature/conditional-ci + uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: integration diff --git a/.github/workflows/_charm-tests-scenario.yaml b/.github/workflows/_charm-tests-scenario.yaml index c2a51c1..a000aed 100644 --- a/.github/workflows/_charm-tests-scenario.yaml +++ b/.github/workflows/_charm-tests-scenario.yaml @@ -25,7 +25,7 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: ./.github/actions/charm-run-task@feature/conditional-ci + uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: scenario diff --git a/.github/workflows/_charm-tests-unit.yaml b/.github/workflows/_charm-tests-unit.yaml index 5f284cc..66b0ccc 100644 --- a/.github/workflows/_charm-tests-unit.yaml +++ b/.github/workflows/_charm-tests-unit.yaml @@ -25,7 +25,7 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: ./.github/actions/charm-run-task@feature/conditional-ci + uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: unit From 3ac41783b3de13a832b65f578e374424e79584c6 Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 12:31:55 -0500 Subject: [PATCH 12/19] test --- .github/workflows/charm-pull-request.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/charm-pull-request.yaml b/.github/workflows/charm-pull-request.yaml index 8d64b70..b791e93 100644 --- a/.github/workflows/charm-pull-request.yaml +++ b/.github/workflows/charm-pull-request.yaml @@ -67,7 +67,7 @@ jobs: name: Quality Checks needs: - ci-ignore - # if: needs.ci-ignore.outputs.any_modified == 'true' + if: needs.ci-ignore.outputs.any_modified == 'true' uses: canonical/observability/.github/workflows/_charm-quality-checks.yaml@feature/conditional-ci secrets: inherit with: From 0594c1dbe50489b0ba97a8d9064d4e544bd621ef Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 12:48:51 -0500 Subject: [PATCH 13/19] chore: revert temp branch on templates back to main --- .github/workflows/_charm-linting.yaml | 2 +- .github/workflows/_charm-quality-checks.yaml | 10 +++++----- .github/workflows/_charm-static-analysis.yaml | 4 ++-- .github/workflows/_charm-tests-integration.yaml | 2 +- .github/workflows/_charm-tests-scenario.yaml | 2 +- .github/workflows/_charm-tests-unit.yaml | 2 +- .github/workflows/charm-pull-request.yaml | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/_charm-linting.yaml b/.github/workflows/_charm-linting.yaml index 765dcbf..56d1e62 100644 --- a/.github/workflows/_charm-linting.yaml +++ b/.github/workflows/_charm-linting.yaml @@ -25,7 +25,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci + uses: canonical/observability/.github/actions/charm-run-task@main with: charm-path: ${{ inputs.charm-path }} test-type: lint diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 7228c49..2835693 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -64,22 +64,22 @@ jobs: charmcraft-channel: "${{ inputs.charmcraft-channel }}" static-analysis: name: Static Analysis - uses: canonical/observability/.github/workflows/_charm-static-analysis.yaml@feature/conditional-ci + uses: canonical/observability/.github/workflows/_charm-static-analysis.yaml@main with: charm-path: "${{ inputs.charm-path }}" linting: name: Linting - uses: canonical/observability/.github/workflows/_charm-linting.yaml@feature/conditional-ci + uses: canonical/observability/.github/workflows/_charm-linting.yaml@main with: charm-path: "${{ inputs.charm-path }}" unit-test: name: Unit Tests - uses: canonical/observability/.github/workflows/_charm-tests-unit.yaml@feature/conditional-ci + uses: canonical/observability/.github/workflows/_charm-tests-unit.yaml@main with: charm-path: "${{ inputs.charm-path }}" scenario-test: name: Scenario Tests - uses: canonical/observability/.github/workflows/_charm-tests-scenario.yaml@feature/conditional-ci + uses: canonical/observability/.github/workflows/_charm-tests-scenario.yaml@main with: charm-path: "${{ inputs.charm-path }}" integration-test: @@ -89,7 +89,7 @@ jobs: - linting - unit-test - scenario-test - uses: canonical/observability/.github/workflows/_charm-tests-integration.yaml@feature/conditional-ci + uses: canonical/observability/.github/workflows/_charm-tests-integration.yaml@main with: charm-path: "${{ inputs.charm-path }}" provider: "${{ inputs.provider }}" diff --git a/.github/workflows/_charm-static-analysis.yaml b/.github/workflows/_charm-static-analysis.yaml index 7f77b09..c1b5828 100644 --- a/.github/workflows/_charm-static-analysis.yaml +++ b/.github/workflows/_charm-static-analysis.yaml @@ -25,7 +25,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run static analysis for /lib for 3.8 - uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci + uses: canonical/observability/.github/actions/charm-run-task@main with: charm-path: ${{ inputs.charm-path }} test-type: static @@ -47,7 +47,7 @@ jobs: 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 + uses: canonical/observability/.github/actions/charm-run-task@main with: charm-path: ${{ inputs.charm-path }} test-type: static diff --git a/.github/workflows/_charm-tests-integration.yaml b/.github/workflows/_charm-tests-integration.yaml index 0536174..7300d93 100644 --- a/.github/workflows/_charm-tests-integration.yaml +++ b/.github/workflows/_charm-tests-integration.yaml @@ -69,7 +69,7 @@ jobs: run: | sudo snap install --classic astral-uv - name: Run tests - uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci + uses: canonical/observability/.github/actions/charm-run-task@main with: charm-path: ${{ inputs.charm-path }} test-type: integration diff --git a/.github/workflows/_charm-tests-scenario.yaml b/.github/workflows/_charm-tests-scenario.yaml index a000aed..6115135 100644 --- a/.github/workflows/_charm-tests-scenario.yaml +++ b/.github/workflows/_charm-tests-scenario.yaml @@ -25,7 +25,7 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci + uses: canonical/observability/.github/actions/charm-run-task@main with: charm-path: ${{ inputs.charm-path }} test-type: scenario diff --git a/.github/workflows/_charm-tests-unit.yaml b/.github/workflows/_charm-tests-unit.yaml index 66b0ccc..85c6e61 100644 --- a/.github/workflows/_charm-tests-unit.yaml +++ b/.github/workflows/_charm-tests-unit.yaml @@ -25,7 +25,7 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci + uses: canonical/observability/.github/actions/charm-run-task@main with: charm-path: ${{ inputs.charm-path }} test-type: unit diff --git a/.github/workflows/charm-pull-request.yaml b/.github/workflows/charm-pull-request.yaml index b791e93..5986207 100644 --- a/.github/workflows/charm-pull-request.yaml +++ b/.github/workflows/charm-pull-request.yaml @@ -68,7 +68,7 @@ jobs: needs: - ci-ignore if: needs.ci-ignore.outputs.any_modified == 'true' - uses: canonical/observability/.github/workflows/_charm-quality-checks.yaml@feature/conditional-ci + uses: canonical/observability/.github/workflows/_charm-quality-checks.yaml@main secrets: inherit with: charm-path: ${{ inputs.charm-path }} From 6a15400268f8ff5dd508b8ffe83c4ad40a137759 Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 12:58:29 -0500 Subject: [PATCH 14/19] chore: Add uv dependency back --- .github/workflows/_charm-static-analysis.yaml | 8 ++++++-- .github/workflows/_charm-tests-scenario.yaml | 4 +++- .github/workflows/_charm-tests-unit.yaml | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/_charm-static-analysis.yaml b/.github/workflows/_charm-static-analysis.yaml index 375a225..c1b5828 100644 --- a/.github/workflows/_charm-static-analysis.yaml +++ b/.github/workflows/_charm-static-analysis.yaml @@ -21,7 +21,9 @@ jobs: with: python-version: 3.8 - name: Install dependencies - run: python3 -m pip install tox + run: | + python3 -m pip install tox + sudo snap install --classic astral-uv - name: Run static analysis for /lib for 3.8 uses: canonical/observability/.github/actions/charm-run-task@main with: @@ -41,7 +43,9 @@ jobs: with: python-version: 3.8 - name: Install dependencies - run: python3 -m pip install tox + 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@main with: diff --git a/.github/workflows/_charm-tests-scenario.yaml b/.github/workflows/_charm-tests-scenario.yaml index f64f9cc..6115135 100644 --- a/.github/workflows/_charm-tests-scenario.yaml +++ b/.github/workflows/_charm-tests-scenario.yaml @@ -21,7 +21,9 @@ jobs: with: python-version: 3.8 - name: Install dependencies - run: python -m pip install tox + run: | + python -m pip install tox + sudo snap install --classic astral-uv - name: Run tests uses: canonical/observability/.github/actions/charm-run-task@main with: diff --git a/.github/workflows/_charm-tests-unit.yaml b/.github/workflows/_charm-tests-unit.yaml index e8af485..85c6e61 100644 --- a/.github/workflows/_charm-tests-unit.yaml +++ b/.github/workflows/_charm-tests-unit.yaml @@ -21,7 +21,9 @@ jobs: with: python-version: 3.8 - name: Install dependencies - run: python -m pip install tox + run: | + python -m pip install tox + sudo snap install --classic astral-uv - name: Run tests uses: canonical/observability/.github/actions/charm-run-task@main with: From 57e2616426774baa14553b07a5cffabb8bb3ca01 Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 13:28:00 -0500 Subject: [PATCH 15/19] test --- .github/workflows/_charm-linting.yaml | 2 +- .github/workflows/_charm-quality-checks.yaml | 10 +++++----- .github/workflows/_charm-static-analysis.yaml | 4 ++-- .github/workflows/_charm-tests-integration.yaml | 2 +- .github/workflows/_charm-tests-scenario.yaml | 2 +- .github/workflows/_charm-tests-unit.yaml | 2 +- .github/workflows/charm-pull-request.yaml | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/_charm-linting.yaml b/.github/workflows/_charm-linting.yaml index 56d1e62..765dcbf 100644 --- a/.github/workflows/_charm-linting.yaml +++ b/.github/workflows/_charm-linting.yaml @@ -25,7 +25,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: canonical/observability/.github/actions/charm-run-task@main + uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: lint diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 2835693..7228c49 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -64,22 +64,22 @@ jobs: charmcraft-channel: "${{ inputs.charmcraft-channel }}" static-analysis: name: Static Analysis - uses: canonical/observability/.github/workflows/_charm-static-analysis.yaml@main + uses: canonical/observability/.github/workflows/_charm-static-analysis.yaml@feature/conditional-ci with: charm-path: "${{ inputs.charm-path }}" linting: name: Linting - uses: canonical/observability/.github/workflows/_charm-linting.yaml@main + uses: canonical/observability/.github/workflows/_charm-linting.yaml@feature/conditional-ci with: charm-path: "${{ inputs.charm-path }}" unit-test: name: Unit Tests - uses: canonical/observability/.github/workflows/_charm-tests-unit.yaml@main + uses: canonical/observability/.github/workflows/_charm-tests-unit.yaml@feature/conditional-ci with: charm-path: "${{ inputs.charm-path }}" scenario-test: name: Scenario Tests - uses: canonical/observability/.github/workflows/_charm-tests-scenario.yaml@main + uses: canonical/observability/.github/workflows/_charm-tests-scenario.yaml@feature/conditional-ci with: charm-path: "${{ inputs.charm-path }}" integration-test: @@ -89,7 +89,7 @@ jobs: - linting - unit-test - scenario-test - uses: canonical/observability/.github/workflows/_charm-tests-integration.yaml@main + uses: canonical/observability/.github/workflows/_charm-tests-integration.yaml@feature/conditional-ci with: charm-path: "${{ inputs.charm-path }}" provider: "${{ inputs.provider }}" diff --git a/.github/workflows/_charm-static-analysis.yaml b/.github/workflows/_charm-static-analysis.yaml index c1b5828..7f77b09 100644 --- a/.github/workflows/_charm-static-analysis.yaml +++ b/.github/workflows/_charm-static-analysis.yaml @@ -25,7 +25,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run static analysis for /lib for 3.8 - uses: canonical/observability/.github/actions/charm-run-task@main + uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: static @@ -47,7 +47,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run static analysis (charm) - uses: canonical/observability/.github/actions/charm-run-task@main + uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: static diff --git a/.github/workflows/_charm-tests-integration.yaml b/.github/workflows/_charm-tests-integration.yaml index 7300d93..0536174 100644 --- a/.github/workflows/_charm-tests-integration.yaml +++ b/.github/workflows/_charm-tests-integration.yaml @@ -69,7 +69,7 @@ jobs: run: | sudo snap install --classic astral-uv - name: Run tests - uses: canonical/observability/.github/actions/charm-run-task@main + uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: integration diff --git a/.github/workflows/_charm-tests-scenario.yaml b/.github/workflows/_charm-tests-scenario.yaml index 6115135..a000aed 100644 --- a/.github/workflows/_charm-tests-scenario.yaml +++ b/.github/workflows/_charm-tests-scenario.yaml @@ -25,7 +25,7 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: canonical/observability/.github/actions/charm-run-task@main + uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: scenario diff --git a/.github/workflows/_charm-tests-unit.yaml b/.github/workflows/_charm-tests-unit.yaml index 85c6e61..66b0ccc 100644 --- a/.github/workflows/_charm-tests-unit.yaml +++ b/.github/workflows/_charm-tests-unit.yaml @@ -25,7 +25,7 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: canonical/observability/.github/actions/charm-run-task@main + uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci with: charm-path: ${{ inputs.charm-path }} test-type: unit diff --git a/.github/workflows/charm-pull-request.yaml b/.github/workflows/charm-pull-request.yaml index 5986207..b791e93 100644 --- a/.github/workflows/charm-pull-request.yaml +++ b/.github/workflows/charm-pull-request.yaml @@ -68,7 +68,7 @@ jobs: needs: - ci-ignore if: needs.ci-ignore.outputs.any_modified == 'true' - uses: canonical/observability/.github/workflows/_charm-quality-checks.yaml@main + uses: canonical/observability/.github/workflows/_charm-quality-checks.yaml@feature/conditional-ci secrets: inherit with: charm-path: ${{ inputs.charm-path }} From 52318170d345cba740946d1fefe6a8917c18ecba Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 14:58:19 -0500 Subject: [PATCH 16/19] 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 From 110835d723da5edeb55b34f924ac83823a759f00 Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 15:30:04 -0500 Subject: [PATCH 17/19] 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: From 16e80d5f7586229d24d3e46d1806a4be73cc6f27 Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 15:36:30 -0500 Subject: [PATCH 18/19] update warning message --- .github/actions/charm-run-task/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/charm-run-task/action.yaml b/.github/actions/charm-run-task/action.yaml index 3774edc..a54602b 100644 --- a/.github/actions/charm-run-task/action.yaml +++ b/.github/actions/charm-run-task/action.yaml @@ -34,7 +34,7 @@ runs: if grep -q -E "^\s*${{ inputs.test-type }}:" Makefile; then make "${{ inputs.test-type }}" else - echo "Error: Invalid Make target -> ${{ inputs.test-type }}." + echo "Warning: Make target does not exist -> ${{ inputs.test-type }}." fi else echo "Error: Taskrunner file not found." From 08b1c4a13c91ebb2ae5d5e14426603ee403cd623 Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 19 Dec 2024 16:01:48 -0500 Subject: [PATCH 19/19] revert branch to @main --- .github/workflows/_charm-linting.yaml | 2 +- .github/workflows/_charm-quality-checks.yaml | 10 +++++----- .github/workflows/_charm-static-analysis.yaml | 4 ++-- .github/workflows/_charm-tests-integration.yaml | 2 +- .github/workflows/_charm-tests-scenario.yaml | 2 +- .github/workflows/_charm-tests-unit.yaml | 2 +- .github/workflows/charm-pull-request.yaml | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/_charm-linting.yaml b/.github/workflows/_charm-linting.yaml index 6e8c035..4b4612b 100644 --- a/.github/workflows/_charm-linting.yaml +++ b/.github/workflows/_charm-linting.yaml @@ -25,7 +25,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci + uses: canonical/observability/.github/actions/charm-run-task@main with: charm-path: ${{ inputs.charm-path }} test-type: lint diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 7228c49..2835693 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -64,22 +64,22 @@ jobs: charmcraft-channel: "${{ inputs.charmcraft-channel }}" static-analysis: name: Static Analysis - uses: canonical/observability/.github/workflows/_charm-static-analysis.yaml@feature/conditional-ci + uses: canonical/observability/.github/workflows/_charm-static-analysis.yaml@main with: charm-path: "${{ inputs.charm-path }}" linting: name: Linting - uses: canonical/observability/.github/workflows/_charm-linting.yaml@feature/conditional-ci + uses: canonical/observability/.github/workflows/_charm-linting.yaml@main with: charm-path: "${{ inputs.charm-path }}" unit-test: name: Unit Tests - uses: canonical/observability/.github/workflows/_charm-tests-unit.yaml@feature/conditional-ci + uses: canonical/observability/.github/workflows/_charm-tests-unit.yaml@main with: charm-path: "${{ inputs.charm-path }}" scenario-test: name: Scenario Tests - uses: canonical/observability/.github/workflows/_charm-tests-scenario.yaml@feature/conditional-ci + uses: canonical/observability/.github/workflows/_charm-tests-scenario.yaml@main with: charm-path: "${{ inputs.charm-path }}" integration-test: @@ -89,7 +89,7 @@ jobs: - linting - unit-test - scenario-test - uses: canonical/observability/.github/workflows/_charm-tests-integration.yaml@feature/conditional-ci + uses: canonical/observability/.github/workflows/_charm-tests-integration.yaml@main with: charm-path: "${{ inputs.charm-path }}" provider: "${{ inputs.provider }}" diff --git a/.github/workflows/_charm-static-analysis.yaml b/.github/workflows/_charm-static-analysis.yaml index 7683fca..949c277 100644 --- a/.github/workflows/_charm-static-analysis.yaml +++ b/.github/workflows/_charm-static-analysis.yaml @@ -9,7 +9,7 @@ on: jobs: static: - name: Static static analysis for /lib and charm + name: Static analysis (lib and charm) runs-on: ubuntu-20.04 steps: - name: Checkout @@ -25,7 +25,7 @@ jobs: python3 -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci + uses: canonical/observability/.github/actions/charm-run-task@main with: charm-path: ${{ inputs.charm-path }} test-type: static diff --git a/.github/workflows/_charm-tests-integration.yaml b/.github/workflows/_charm-tests-integration.yaml index 68985f6..cf5292a 100644 --- a/.github/workflows/_charm-tests-integration.yaml +++ b/.github/workflows/_charm-tests-integration.yaml @@ -69,7 +69,7 @@ jobs: run: | sudo snap install --classic astral-uv - name: Run tests - uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci + uses: canonical/observability/.github/actions/charm-run-task@main with: charm-path: ${{ inputs.charm-path }} test-type: integration diff --git a/.github/workflows/_charm-tests-scenario.yaml b/.github/workflows/_charm-tests-scenario.yaml index b098303..a281547 100644 --- a/.github/workflows/_charm-tests-scenario.yaml +++ b/.github/workflows/_charm-tests-scenario.yaml @@ -25,7 +25,7 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci + uses: canonical/observability/.github/actions/charm-run-task@main with: charm-path: ${{ inputs.charm-path }} test-type: scenario diff --git a/.github/workflows/_charm-tests-unit.yaml b/.github/workflows/_charm-tests-unit.yaml index d321748..856e593 100644 --- a/.github/workflows/_charm-tests-unit.yaml +++ b/.github/workflows/_charm-tests-unit.yaml @@ -25,7 +25,7 @@ jobs: python -m pip install tox sudo snap install --classic astral-uv - name: Run tests - uses: canonical/observability/.github/actions/charm-run-task@feature/conditional-ci + uses: canonical/observability/.github/actions/charm-run-task@main with: charm-path: ${{ inputs.charm-path }} test-type: unit diff --git a/.github/workflows/charm-pull-request.yaml b/.github/workflows/charm-pull-request.yaml index b791e93..5986207 100644 --- a/.github/workflows/charm-pull-request.yaml +++ b/.github/workflows/charm-pull-request.yaml @@ -68,7 +68,7 @@ jobs: needs: - ci-ignore if: needs.ci-ignore.outputs.any_modified == 'true' - uses: canonical/observability/.github/workflows/_charm-quality-checks.yaml@feature/conditional-ci + uses: canonical/observability/.github/workflows/_charm-quality-checks.yaml@main secrets: inherit with: charm-path: ${{ inputs.charm-path }}