From 698c62b52d7f3f550bfdb4836c4b92296aa07b03 Mon Sep 17 00:00:00 2001 From: Samuel Allan Date: Wed, 18 Sep 2024 10:52:20 +0930 Subject: [PATCH] Remove old files --- .github/workflows/check.yaml | 16 +++- .github/workflows/sonar.yaml | 17 ---- Makefile | 81 ------------------- rename.sh | 17 ---- .../tests/bundles/overlays/focal.yaml.j2 | 3 + .../tests/bundles/overlays/jammy.yaml.j2 | 3 + .../overlays/local-charm-overlay.yaml.j2 | 3 - tox.ini | 13 --- 8 files changed, 18 insertions(+), 135 deletions(-) delete mode 100644 .github/workflows/sonar.yaml delete mode 100644 Makefile delete mode 100755 rename.sh delete mode 100644 tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index b2bbc95..6088f6e 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -83,7 +83,7 @@ jobs: fail-fast: false matrix: runs-on: [[ubuntu-22.04]] - test-command: ['make functional'] + test-command: ['tox -e func'] juju-channel: ["3.4/stable"] steps: @@ -91,11 +91,11 @@ jobs: with: submodules: true - # arm64 runners don't have make or gcc installed by default + # arm64 runners don't have gcc installed by default - name: Install dependencies run: | sudo apt update - sudo apt install -y make gcc + sudo apt install -y gcc - name: Setup Python uses: actions/setup-python@v5 @@ -116,8 +116,16 @@ jobs: echo "TEST_MODEL_CONSTRAINTS=arch=arm64" >> "$GITHUB_ENV" fi + - name: Build the charm + run: charmcraft -v pack + - name: Run tests - run: ${{ matrix.test-command }} + run: | + export CHARM_PATH_JAMMY="$(pwd)/$(ls | grep '.*22.04.*\.charm$')" + echo "$CHARM_PATH_JAMMY" + export CHARM_PATH_FOCAL="$(pwd)/$(ls | grep '.*20.04.*\.charm$')" + echo "$CHARM_PATH_FOCAL" + ${{ matrix.test-command }} env: TEST_JUJU3: "1" # https://github.com/openstack-charmers/zaza/pull/653 TEST_JUJU_CHANNEL: ${{ matrix.juju-channel }} diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml deleted file mode 100644 index df30d49..0000000 --- a/.github/workflows/sonar.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# This is a template `sonar.yaml` file for ops charms -# This file is managed by bootstack-charms-spec and should not be modified -# within individual charm repos. https://launchpad.net/bootstack-charms-spec - -name: SonarCloud -on: - workflow_run: - workflows: - - PR workflow running lint checkers, unit and functional tests - types: [completed] - -jobs: - sonar: - uses: canonical/bootstack-actions/.github/workflows/sonar.yaml@main - secrets: inherit - with: - workflow-name: PR workflow running lint checkers, unit and functional tests diff --git a/Makefile b/Makefile deleted file mode 100644 index 7feb86c..0000000 --- a/Makefile +++ /dev/null @@ -1,81 +0,0 @@ -# This is a template `Makefile` file for ops charms -# This file is managed by bootstack-charms-spec and should not be modified -# within individual charm repos. https://launchpad.net/bootstack-charms-spec - -PYTHON := /usr/bin/python3 - -PROJECTPATH=$(dir $(realpath $(MAKEFILE_LIST))) -RELEASE_CHANNEL:=edge -METADATA_FILE="metadata.yaml" -CHARM_NAME=$(shell cat ${PROJECTPATH}/${METADATA_FILE} | grep -E '^name:' | awk '{print $$2}') - -help: - @echo "This project supports the following targets" - @echo "" - @echo " make help - show this text" - @echo " make dev-environment - setup the development environment" - @echo " make pre-commit - run pre-commit checks on all the files" - @echo " make submodules - initialize, fetch, and checkout any nested submodules" - @echo " make submodules-update - update submodules to latest changes on remote branch" - @echo " make clean - remove unneeded files and clean charmcraft environment" - @echo " make build - build the charm" - @echo " make release - run clean, build and upload charm" - @echo " make lint - run flake8, black --check and isort --check" - @echo " make reformat - run black and isort and reformat files" - @echo " make unittests - run the tests defined in the unittest subdirectory" - @echo " make functional - run the tests defined in the functional subdirectory" - @echo " make test - run lint, unittests and functional targets" - @echo "" - -dev-environment: - @echo "Creating virtualenv with pre-commit installed" - @tox -r -e dev-environment - -pre-commit: - @tox -e pre-commit - -submodules: - @echo "Cloning submodules" - @git submodule update --init --recursive - -submodules-update: - @echo "Pulling latest updates for submodules" - @git submodule update --init --recursive --remote --merge - -clean: - @echo "Cleaning existing build" - @rm -rf ${PROJECTPATH}/${CHARM_NAME}*.charm - @echo "Cleaning charmcraft" - @charmcraft clean - -build: clean - @echo "Building charm" - @charmcraft -v pack ${BUILD_ARGS} - @bash -c ./rename.sh - - -release: build - @echo "Releasing charm to ${RELEASE_CHANNEL} channel" - @charmcraft upload ${CHARM_NAME}.charm --release ${RELEASE_CHANNEL} - -lint: - @echo "Running lint checks" - @tox -e lint - -reformat: - @echo "Reformat files with black and isort" - @tox -e reformat - -unittests: - @echo "Running unit tests" - @tox -e unit -- ${UNIT_ARGS} - -functional: build - @echo "Executing functional tests using built charm at ${PROJECTPATH}" - @CHARM_LOCATION=${PROJECTPATH} tox -e func -- ${FUNC_ARGS} - -test: lint unittests functional - @echo "Tests completed for charm ${CHARM_NAME}." - -# The targets below don't depend on a file -.PHONY: help dev-environment pre-commit submodules submodules-update clean build lint reformat unittests functional diff --git a/rename.sh b/rename.sh deleted file mode 100755 index 853c18e..0000000 --- a/rename.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# This is a template `rename.sh` file for ops charms -# This file is managed by bootstack-charms-spec and should not be modified -# within individual charm repos. https://launchpad.net/bootstack-charms-spec - -charm=$(grep -E "^name:" charmcraft.yaml | awk '{print $2}') -echo "renaming ${charm}_*.charm to ${charm}.charm" -echo -n "pwd: " -pwd -ls -al -echo "Removing previous charm if it exists" -if [[ -e "${charm}.charm" ]]; -then - rm "${charm}.charm" -fi -echo "Renaming charm here." -mv ${charm}_*.charm ${charm}.charm \ No newline at end of file diff --git a/tests/functional/tests/bundles/overlays/focal.yaml.j2 b/tests/functional/tests/bundles/overlays/focal.yaml.j2 index d3f46ab..09da097 100644 --- a/tests/functional/tests/bundles/overlays/focal.yaml.j2 +++ b/tests/functional/tests/bundles/overlays/focal.yaml.j2 @@ -1 +1,4 @@ series: focal +applications: + {{ charm_name }}: + charm: "{{ CHARM_PATH_JAMMY }}" diff --git a/tests/functional/tests/bundles/overlays/jammy.yaml.j2 b/tests/functional/tests/bundles/overlays/jammy.yaml.j2 index bc860fa..7081fc3 100644 --- a/tests/functional/tests/bundles/overlays/jammy.yaml.j2 +++ b/tests/functional/tests/bundles/overlays/jammy.yaml.j2 @@ -1 +1,4 @@ series: jammy +applications: + {{ charm_name }}: + charm: "{{ CHARM_PATH_JAMMY }}" diff --git a/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 b/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 deleted file mode 100644 index 45065bc..0000000 --- a/tests/functional/tests/bundles/overlays/local-charm-overlay.yaml.j2 +++ /dev/null @@ -1,3 +0,0 @@ -applications: - {{ charm_name }}: - charm: "{{ CHARM_LOCATION }}/{{ charm_name }}.charm" diff --git a/tox.ini b/tox.ini index 8e79992..391ddcd 100644 --- a/tox.ini +++ b/tox.ini @@ -27,19 +27,6 @@ passenv = OS_* TEST_JUJU3 -[testenv:dev-environment] -envdir = {toxinidir}/.venv -deps = - pre-commit - {[testenv:lint]deps} - {[testenv:unit]deps} - {[testenv:func]deps} - -[testenv:pre-commit] -envdir = {[testenv:dev-environment]envdir} -deps = {[testenv:dev-environment]deps} # ensure that dev-environment is installed -commands = pre-commit run --all-files - [testenv:lint] commands = pflake8