Browse Source

[UPD] cruft

master
Justin Lecher 3 days ago
parent
commit
2c7e7dbc64
  1. 29
      .cruft.json
  2. 1
      .gitignore
  3. 34
      .pre-commit-config.yaml
  4. 56
      Makefile
  5. 2
      Pipfile

29
.cruft.json

@ -1,15 +1,16 @@
{
"template": "git@git.ercpe.de:justin/cookiecutter-ansible-collection.git",
"commit": "d862a91fa29e53ae88a668d7cc2ecb50d9f04c0d",
"context": {
"cookiecutter": {
"full_name": "Justin Lecher",
"email": "justin@jlec.de",
"ansible_namespace": "jlec",
"ansible_collection": "hashicorp",
"collection_short_description": "HashiCorp tools and technology",
"_template": "git@git.ercpe.de:justin/cookiecutter-ansible-collection.git"
}
},
"directory": null
}
"template": "git@git.ercpe.de:justin/cookiecutter-ansible-collection.git",
"commit": "0946809efa1d7e38d957ca30f51df8384d43c375",
"context": {
"cookiecutter": {
"full_name": "Justin Lecher",
"email": "justin@jlec.de",
"ansible_namespace": "jlec",
"ansible_collection": "hashicorp",
"collection_short_description": "HashiCorp tools and technology",
"_template": "git@git.ercpe.de:justin/cookiecutter-ansible-collection.git"
}
},
"directory": null,
"checkout": null
}

1
.gitignore

@ -25,6 +25,7 @@ pip-delete-this-directory.txt
packer_cache/
# CUSTOM
pytestdebug.log
setup*done
tmp

34
.pre-commit-config.yaml

@ -0,0 +1,34 @@
---
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
- id: check-toml
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/adrienverge/yamllint
rev: v1.26.1
hooks:
- id: yamllint
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 2.1.5
hooks:
- id: shellcheck
- repo: https://github.com/psf/black
rev: 21.4b2
hooks:
- id: black
args: ["--line-length", "128"]
- repo: https://github.com/jlec/pre-commit-cruft
rev: v0.1.1
hooks:
- id: cruft
- repo: https://github.com/ansible-community/ansible-lint
rev: v5.0.7
hooks:
- id: ansible-lint

56
Makefile

@ -1,16 +1,13 @@
ROLES := $(wildcard roles/*/.)
PIPENV := pipenv run
BLACKARGS ?= --line-length 128 --check --diff
PYTESTARGS ?= -x -vvl
.PHONY: help update
.PHONY: help
help:
@echo "Make targets:\n"
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
update:
cruft update
################################################################################
#
# Environment Setup
@ -26,9 +23,11 @@ requirements.txt: Pipfile.lock
setup.done: Pipfile.lock
pipenv sync
$(PIPENV) pre-commit install
$(PIPENV) pre-commit install --install-hooks
touch setup.done
setup-dev.done: Pipfile.lock
setup-dev.done: Pipfile.lock setup.done
pipenv sync --dev
touch setup-dev.done
@ -40,7 +39,7 @@ setup-dev: setup-dev.done
# Release management
#
################################################################################
.PHONY: release release-major release-micro
.PHONY: publish release release-major release-micro
release: setup-dev.done
$(PIPENV) bumpversion --verbose minor
@ -51,26 +50,45 @@ release-major: setup-dev.done
release-micro: setup-dev.done
$(PIPENV) bumpversion --verbose patch
publish:
git push -v --progress
git push -v --progress --tags
################################################################################
#
# Custom targets
# Checking and Linting
#
################################################################################
.PHONY: build clean lint push test $(ROLES)
.PHONY: ansible-lint black check cruft-check lint linting pytest test
lint: setup-dev.done
$(PIPENV) ansible-lint roles
$(PIPENV) black ${BLACKARGS} .
$(PIPENV) yamllint .
check: cruft-check lint test
push:
git push -v --progress
git push -v --progress --tags
clean:
rm -rvf tmp
cruft-check: setup-dev.done
$(PIPENV) cruft check
$(PIPENV) cruft diff --exit-code
test: $(ROLES)
pre-commit: setup-dev.done
$(PIPENV) pre-commit run --all-files
lint: linting
linting: pre-commit
################################################################################
#
# Custom options
#
################################################################################
.PHONY: clean cruft-update $(ROLES)
cruft-update: setup-dev.done
git stash
$(PIPENV) cruft update --allow-untracked-files
git stash pop
$(ROLES):
$(MAKE) -C $@ test
clean:
rm -rvf tmp setup*done

2
Pipfile

@ -7,8 +7,10 @@ verify_ssl = true
ansible = "*"
ansible-lint = "*"
black = "*"
cruft = "*"
bumpversion = "*"
molecule = {extras = [ "ansible", "docker", "lint" ], version = "*"}
pre-commit = "*"
pytest = "*"
pytest-testinfra = "*"
yamllint = "*"

Loading…
Cancel
Save