CTL standard makefiles
Collects them all in one place.
To use, copy the relevant files into your project and add a master
Makefile that looks something like:
APP=myapp
JS_FILES=media/js/src/ media/js/tests
MAX_COMPLEXITY=7
all: jenkins
include *.mk
The key aspects being:
- define whatever required and optional global variables are expected.
- explicitly set the
alltarget. Otherwise it will default to the first target it finds, which will depend on the order of the file includes which is not ideal. - include all the
.mkfiles - if you want to override any targets from those makefiles, define those new targets after the include line
- if you want to add new targets that are project specific, consider
making a new
.mkfile for them - makefiles are explicitly versioned so we can keep track of them and automatically update them across projects
- if you've included the
make.mkfile, you can domake update_makefilesand it will update every.mkfile in your app to the version that is current in this repo.
- parameterize everything you can, make as few assumptions about the code as you can get away with.
- use the
?=operator to define variables in the.mkthat can be overridden in the top-levelMakefileor on the commandline - if you change something, bump the
VERSIONin the comment on the first line as appropriate (semver rules) - update this README with documentation of variables required below
- add a changelog comment to the file you've changed, especially if something potentially is not backwards compatible
Required:
APPto specify you django app
Optional:
VE, virtualenv directory, defaults to./veMANAGE, manage.py command, defaults to./manage.pyFLAKE8, flake8 command, default$(VE)/bin/flake8REQUIREMENTS, location of requirements.txt file,requirements.txtSYS_PYTHON, system python, defaultpythonPIP, pip command, default$(VE)/bin/pipPY_SENTINAL, python sentinal location, default$(VE)/sentinalWHEEL_VERSION, version of python wheel library to install, default0.24.0VIRTUALENV, location of embedded virtualenv.py, defaultvirtualenv.pySUPPORT_DIR, directory with support librarires, defaultrequirements/virtualenv_support/MAX_COMPLEXITY, flake8 max complexity, default 10INTERFACE, runserver interface, defaultlocalhostRUNSERVER_PORT, runserver port, default8000PY_DIRS, directories with python code (to flake8), default$(APP)
Required:
APPto specify you django app. same as withdjango.mk
Optional:
WHEELHOUSE, directory to stash.whlfiles, defaultwheelhouseORG, docker hub organization, defaultccnmtlBUILDER_IMAGE, django builder image to use, defaultccnmtl/django.build
Optional:
HUGO, path to hugo binary, default/usr/local/bin/hugoS3CMD, s3cmd, defaults3cmdPUBLIC, location of hugo's publish directory, defaultpublicDRAFT_FLAGS, commandline flags for draft building mode, default--buildDrafts --verboseLog=true -vPROD_FLAGS, hugo flags to use for production publish step, default-s .S3_FLAGS, flags to use for s3cmd publish step, default--acl-public --delete-removed --no-progress --no-mime-magic --guess-mime-typeINTERMEDIATE_STEPS, commands to run between hugo publish and s3 publish steps (eg, json/lunr.js tweaks), defaultecho nothing
Optional:
JS_FILES, where to look for eslint, defaults tomedia/jsNODE_MODULES, node_modules dir, default./node_modulesJS_SENTINAL, location of the js sentinal file, default$(NODE_MODULES)/sentinalESLINT, eslint command, default$(NODE_MODULES)/eslint/bin/eslint
Optional:
GITHUB_BASE, where to look for new versions, default https://raw.githubusercontent.com/ccnmtl/makefiles/master/WGET, wget binary, defaultwgetWGET_FLAGS, flags for wget command, default-O
PROJECT, sets the project name to be used for container names.DC_MYSQL_USER, sets the MySQL username in the docker-compose and in the local settings file.DC_MYSQL_PASSWORD, sets the MySQL password in docker-compose and in the local settings file.