avocado-framework/avocado

View on GitHub
Makefile.gh

Summary

Maintainability
Test Coverage
# This Makefile contains targets used by GitHub Actions
include Makefile.include

ifndef AVOCADO_OPTIONAL_PLUGINS
AVOCADO_OPTIONAL_PLUGINS=$(shell find ./optional_plugins -maxdepth 1 -mindepth 1 -type d)
endif
ifndef DEVEL_NAME
DEVEL_NAME=$(shell git config --get user.name)
endif
ifndef DEVEL_MAIL
DEVEL_NAME=$(shell git config --get user.email)
endif


all:
    @echo
    @echo "This file contains targets used by GitHub Actions."
    @echo

codespell:
    pip install codespell==2.2.4
    codespell --check-filenames --check-hidden --skip ".git,*.js,./selftests/unit/utils/cpu.py.data/*,./avocado/utils/pmem.py,./avocado/utils/cpu.py,./avocado/utils/linux_modules.py,./selftests/functional/output.py,./selftests/unit/utils/vmimage.py"

bandit:
    pip install bandit
    bandit -o bandit-output.txt -r --skip B101,B105,B311,B404,B603 .


propagate-version:
    echo "$(VERSION)" > VERSION
    for DIR in $(AVOCADO_OPTIONAL_PLUGINS); do\
        if test -f "$$DIR/VERSION"; then\
            echo ">> Updating $$DIR"; echo "$(VERSION)" > "$$DIR/VERSION";\
        else echo ">> Skipping $$DIR"; fi;\
    done

release-update-spec:
    rpmdev-bumpspec -n "$(VERSION)" -u "$(DEVEL_NAME) <$(DEVEL_MAIL)>" -c "New release" python-avocado.spec
    sed -i 's/^Release:.*/Release: 1%{?gitrel}%{?dist}/' python-avocado.spec

release-commit-tag:
    git commit -m "Changes for release $(VERSION)" -a
    git tag "$(VERSION)" -m "Release $(VERSION)"

build-update-readthedocs:
ifndef TOKEN_RTD
    $(error TOKEN_RTD is undefined)
endif
ifndef URL
    $(error URL is undefined)
endif
    # Activate version
    curl -X PATCH \
        -H "Authorization: Token $(TOKEN_RTD)" "$(URL)/versions/$(VERSION)/" \
        -H "Content-Type: application/json" -d '{"active": true, "hidden": false }'

    # Build new version
    curl -X POST \
        -H "Authorization: Token $(TOKEN_RTD)" "$(URL)/versions/$(VERSION)/builds/"

build-wheel: pip
    $(PYTHON) -m pip install $(PYTHON_DEVELOP_ARGS) build
    if test ! -d PYPI_UPLOAD; then mkdir PYPI_UPLOAD; fi
    $(PYTHON) -m build -o PYPI_UPLOAD
    for PLUGIN in $(AVOCADO_OPTIONAL_PLUGINS); do\
        if test -f $$PLUGIN/setup.py; then\
            cd $$PLUGIN;\
            $(PYTHON) -m build -o ../../PYPI_UPLOAD;\
            cd -;\
        fi;\
    done

check-wheel: build-wheel
    $(PYTHON) -m pip install twine
    twine check --strict ./PYPI_UPLOAD/*

build-egg:
    if test ! -d EGG_UPLOAD; then mkdir EGG_UPLOAD; fi
    $(PYTHON) setup.py bdist_egg -d EGG_UPLOAD
    for PLUGIN in $(AVOCADO_OPTIONAL_PLUGINS); do\
        if test -f $$PLUGIN/setup.py; then\
            cd $$PLUGIN;\
            $(PYTHON) setup.py bdist_egg -d ../../EGG_UPLOAD;\
            cd -;\
        fi;\
    done

update-pypi:
ifndef TWINE_USERNAME
    $(error TWINE_USERNAME is undefined)
endif
ifndef TWINE_PASSWORD
    $(error TWINE_PASSWORD is undefined)
endif
    pip install twine
    export TWINE_NON_INTERACTIVE=true
    twine upload PYPI_UPLOAD/*.{tar.gz,whl}

variables:
    @echo "PYTHON: $(PYTHON)"
    @echo "VERSION: $(VERSION)"
    @echo "AVOCADO_OPTIONAL_PLUGINS: $(AVOCADO_OPTIONAL_PLUGINS)"
    @echo "DEVEL_NAME: $(DEVEL_NAME)"
    @echo "DEVEL_MAIL: $(DEVEL_MAIL)"