From c0565363d771d8188d549361e25ffc93e53912e8 Mon Sep 17 00:00:00 2001 From: Samuel Allan Date: Wed, 18 Sep 2024 10:48:47 +0930 Subject: [PATCH] Remove old files --- .github/workflows/check.yaml | 16 +++++-- .pre-commit-config.yaml | 23 ---------- Makefile | 81 ------------------------------------ rename.sh | 17 -------- tox.ini | 13 ------ 5 files changed, 12 insertions(+), 138 deletions(-) delete mode 100644 .pre-commit-config.yaml delete mode 100644 Makefile delete mode 100755 rename.sh diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index c5c0da0..f8e76c2 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -38,7 +38,7 @@ jobs: fail-fast: false matrix: runs-on: [[ubuntu-22.04]] - test-command: ['FUNC_ARGS="--series focal" make functional', 'FUNC_ARGS="--series jammy" make functional'] + test-command: ['tox -e func -- --series focal -v', 'tox -e func -- --series jammy -v'] juju-channel: ["3.4/stable"] steps: @@ -46,11 +46,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 @@ -71,8 +71,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/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index 7f9ac7d..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# This is a template `.pre-commit-config.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 - -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 - hooks: - - id: check-executables-have-shebangs - - id: check-merge-conflict - - id: end-of-file-fixer - - id: trailing-whitespace - - id: check-added-large-files - - id: check-json - - id: check-yaml - - repo: local - hooks: - - id: lint - name: lint - entry: make lint - language: system - types: [ python ] -exclude: ^templates/ diff --git a/Makefile b/Makefile deleted file mode 100644 index c8d53bf..0000000 --- a/Makefile +++ /dev/null @@ -1,81 +0,0 @@ -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 version - create version file based on the git tag" - @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 lint checkers" - @echo " make reformat - run lint tools to auto format code" - @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 - -version: - @git describe --tags --dirty --always --long > version - -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 version - @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: - @echo "Executing functional tests with args: ${FUNC_ARGS}" - @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 version submodules submodules-update clean build lint reformat unittests functional diff --git a/rename.sh b/rename.sh deleted file mode 100755 index afb3062..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:" metadata.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 diff --git a/tox.ini b/tox.ini index 9f3bb66..a43e0d0 100644 --- a/tox.ini +++ b/tox.ini @@ -26,19 +26,6 @@ passenv = SNAP_HTTPS_PROXY OS_* -[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