forked from aws/serverless-application-model
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·75 lines (60 loc) · 2.72 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
NAME=samtranslator27
PYTHON_VERSION=2.7.14
CODE_COVERAGE=95
PYENV := $(shell command -v pyenv 2> /dev/null)
target:
$(info ${HELP_MESSAGE})
@exit 0
# Make sure that pyenv is configured properly and that we can use it in our setup target.
validation:
ifndef PYENV
$(error "make sure pyenv is accessible in your path, (usually by adding to PATH variable in bash_profile, zshrc, or other locations based on your platform) See: https://github.com/pyenv/pyenv#installation for the installation insructions.")
endif
ifndef PYENV_SHELL
$(error "Add 'pyenv init' to your shell to enable shims and autocompletion, (usually by adding to your bash_profile, zshrc, or other locations based on your platform)")
endif
ifndef PYENV_VIRTUALENV_INIT
$(error "Add 'pyenv virtualenv-init' to your shell to enable shims and autocompletion, (usually by adding to your bash_profile, zshrc, or other locations based on your platform)")
endif
install:
$(info [*] Install pyenv using https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer...)
@curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer 2> /dev/null | bash
setup: validation
$(info [*] Download and install python $(PYTHON_VERSION)...)
@pyenv install $(PYTHON_VERSION)
@pyenv local $(PYTHON_VERSION)
$(info [*] Create virtualenv $(NAME) using python $(PYTHON_VERSION)...)
@pyenv virtualenv $(PYTHON_VERSION) $(NAME)
@$(MAKE) activate
activate:
$(info [*] Activate virtualenv $(NAME)...)
$(shell eval "$$(pyenv init -)" && eval "$$(pyenv virtualenv-init -)" && pyenv activate $(NAME) && pyenv local $(NAME))
init:
$(info [*] Install requirements...)
@pip install -r requirements/dev.txt -r requirements/base.txt
flake:
$(info [*] Running flake8...)
@flake8 samtranslator
test:
$(info [*] Run the unit test with minimum code coverage of $(CODE_COVERAGE)%...)
@pytest --cov samtranslator --cov-report term-missing --cov-fail-under $(CODE_COVERAGE) tests
build-docs:
$(info [*] Build documentation...)
@pip install -r docs/website/requirements.txt
@$(MAKE) -C docs/website html
# Command to run everytime you make changes to verify everything works
dev: flake test
# Verifications to run before sending a pull request
pr: init dev
define HELP_MESSAGE
Usage: $ make [TARGETS]
TARGETS
install Install pyenv using the pyenv-installer.
setup Download, install and activate a virtualenv for this project.
activate Activate the virtual environment for this project.
init Initialize and install the requirements and dev-requirements for this project.
test Run the Unit tests.
dev Run all development tests after a change.
build-docs Generate the documentation.
pr Perform all checks before submitting a Pull Request.
endef