Default makefile workflow for continuous integration local and remote (GitlabCI, CircleCI, etc)
This package provides a collection of makefiles that should be included in a project as git module (using makefile-core)
These makefiles are designed to standardize and simplify the workflow to build, run and deploy the project.
As a result, the developer only has to learn a small set of command (ex: make help, make build, make test) to manipulate the project without the need to know about the underlying stack.
- π§ Zero Conf philosophy
- β Auto detect stack from project source code (ex:
package.jsonfor NodeJS,Gemfilefor ruby, etc) - β Almost everything should work with very few configuration for the most common cases
- β Everything should be overridable in
Makefile.configorMakefileif needed
- β Auto detect stack from project source code (ex:
- π‘ Use simple
maketargets for better productivity- Generic target will run the equivalent task in every language used by the project (ex:
make lintwill runnpm run lint,bundle exec rubocop, etc) - No more "I forgot to do
bundle install,asdf install, etc",makewill do it for you in a performant way
- Generic target will run the equivalent task in every language used by the project (ex:
- π» Support local and CI environment (with
CIenvironment variable) - π Supported technologies :
- β NodeJS
- β Ruby
- β Docker
- π€ CI friendly !
- π§ Easy configuration : create a job per target (lint =>
make lint, test =>make test, etc) - π Easy debugging (just run
CI=1 make xxxxlocally to reproduce locally the CI command) - π Supported CI provider
- CircleCI
- π§ Easy configuration : create a job per target (lint =>
- π Deploy target
- Scalingo
- Heroku
- (More coming)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/w5s/makefile-core/main/install.sh)"source: Makefile Core
make self-add url=https://github.com/w5s/makefile-cimake helpTo change configuration, edit the file :
<project_root>/Makefile.config: for shared settings for everyone<project_root>/Makefile.local: for local personal settings (this file should not be versioned)
Minimal recommended <project_root>/Makefile.config configuration
# Project name will be used for app name in deployment, and docker image names, etc (ex: vesta)
export CI_PROJECT_NAME ?= <my-project>
# Project namespace (ex: w5s)
export CI_PROJECT_NAMESPACE ?= <MyCompany>For a new project we recommend to generate a new configuration :
make .circleci/config.ymlFor existing project, you can check the CircleCI template for some useful recipes
make helpTo toggle mode use CI environment variable. This variable is already set in most CI provider (CircleCI, GitlabCI, etc).
As a consequence make {{target}} will automatically change mode when launched in local or in CI environment.
Nevertheless it possible to run locally in CI mode :
Warning
Can be useful to debug problems on CI, never use it on a daily basis !
CI=1 make lintTip
Customization of CI_BUILD_VERSION can be done by changing CI_BUILD_VERSION_TEMPLATE
CI_BUILD_VERSION_TEMPLATE ?= $(VERSION).$(CI_PIPELINE_CREATED_AT).foo.barTip
CI_BUILD_VERSION will be automatically created / updated before each workflow target (build, lint, print-env, etc)
Warning
In the CI, your version is changing ? (because you added a timestamp or a random id).
To keep the version for each job of the same pipeline, you have to save the version files in .cache/make in the cache / artifact OR dump using something like make print-env > Makefile.local (This specific file is automatically loaded by makefile-core and enables to override any defined variable)
Warning
Make sure to have enabled at least one cloud provider
Example in Makefile.config to enable scalingo :
SCALINGO_ENABLED ?= true # Example : this will deploy to staging
CI_ENVIRONMENT_NAME=staging make deployTODO
This repository is a copy of Captive-Studio/makefile-ci. jpolo was the author of both, but Captive-Studio team will keep on maintaining their copy.
MIT Β© Julien Polo