mirror of
https://github.com/haidaraM/ansible-playbook-grapher
synced 2024-11-10 14:14:19 +00:00
Add a makefile to build, test the installation and deploy the package to pypi
This commit is contained in:
parent
5f0fee9dba
commit
0b824f6307
2 changed files with 52 additions and 0 deletions
24
Makefile
Normal file
24
Makefile
Normal file
|
@ -0,0 +1,24 @@
|
|||
ANSIBLE_VERSION=2.4
|
||||
VIRTUALENV_DIR=venv
|
||||
PACKAGE := dist/$(shell ls dist 2> /dev/null)
|
||||
SRC=$(wildcard ansibleplaybookgrapher/*.py setup.py)
|
||||
|
||||
build: $(PACKAGE)
|
||||
|
||||
$(PACKAGE): $(SRC)
|
||||
@echo "Building the package..."
|
||||
@python3 setup.py bdist_wheel
|
||||
|
||||
deploy: build
|
||||
@twine upload dist/*
|
||||
|
||||
setup_virtualenv:
|
||||
@./test_install.sh $(VIRTUALENV_DIR) $(ANSIBLE_VERSION)
|
||||
|
||||
test_install: build setup_virtualenv
|
||||
|
||||
clean:
|
||||
@echo "Cleaning..."
|
||||
@rm -rf ansible_playbook_grapher.egg-info build dist $(VIRTUALENV_DIR) example.svg
|
||||
|
||||
.PHONY: clean test_install
|
28
test_install.sh
Executable file
28
test_install.sh
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
GREEN='\033[32m'
|
||||
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo -e "${RED}You must provide the virtualenv directory and the Ansible version to use.${NC}"
|
||||
echo -e "${RED}Usage: test_install.sh virtualenv_dir ansible_version. ${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VIRTUALENV_DIR=$1
|
||||
ANSIBLE_VERSION=$2
|
||||
|
||||
virtualenv --clear ${VIRTUALENV_DIR}
|
||||
|
||||
source ${VIRTUALENV_DIR}/bin/activate
|
||||
|
||||
package=dist/$(ls dist)
|
||||
|
||||
echo -e "${GREEN}Installing the packages ${package} and ansible ${ANSIBLE_VERSION} ${NC}"
|
||||
|
||||
pip install -q ${package} ansible==${ANSIBLE_VERSION}
|
||||
|
||||
ansible-playbook-grapher --version
|
||||
|
||||
ansible-playbook-grapher examples/example.yml
|
Loading…
Reference in a new issue