blob: ccca0c4c9b559dd43b2cdaff1e55551ece147458 [file] [log] [blame]
# Copyright 2014 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# all targets are PHONY because they don't actually generate a file with the
# name of the target.
.PHONY: setup test pylint lint localserver gitclean
.PHONY: pyunit functionaltest jstest _ptests ptest
# setup target sets up the basics of the development environment
setup:
virtualenv venv
venv/bin/pip install -U lxml setuptools
venv/bin/python bootstrap.py
bin/buildout
bin/gen-app-yaml local-devel
bin/paver build --skip-pylint
# run all the tests
test:
bin/run-tests
# run only the lint tests
pylint:
bin/run-tests -t pylint
lint: pylint
# run only the pyunit tests
pyunit: PROCESSES=$(if $(PTESTS),4,-1)
pyunit:
bin/run-tests -t pyunit --processes=$(PROCESSES)
functionaltest:
bin/run-tests -t functional
jstest:
bin/run-tests -t js
# helper target for ptest target (specifies which tests to run)
_ptests: PTESTS=1
_ptests: functionaltest pyunit pylint jstest
@echo
# run tests in parallel (note, output will be interleaved)
ptest:
make -j _ptests
# start a local instance. defaults to port 8080 for the app and 8000
# for the appengine console
localserver:
thirdparty/google_appengine/dev_appserver.py build
# return to a pristine git checkout. *DELETES EVERYTHING WITHOUT PROMPTING*
gitclean:
git clean -xdf
# Targets related to making a release ---
#
# Usage:
# make do-release
# make do-release VERSION=custom-version
# make do-release APP=robert-melange
#
# after running a make gitclean && make setup && make test
.PHONY: update-template-version commit-release push-release-to-appengine
.PHONY: do-release
# Sets the version in app.yaml.template to the version as specified by
# the current day.
# If you need to specify a patchlevel (i.e. -1, -2), you must specify
# the whole VERSION on the make command line.
update-template-version: VERSION=2-1-$(shell date +%Y%m%d)
update-template-version:
sed -i.bak -r 's/^(version: )[^ \t]+/\1$(VERSION)/' app/app.yaml.template
commit-release: VERSION=$(shell awk '/^version: / { print $$2 }' app/app.yaml.template)
commit-release:
git commit -e -m "Set new Melange version number to $(VERSION) in app.yaml.template" app/app.yaml.template
git tag v$(VERSION) HEAD
# TODO(robert): factor gen-app-yaml into its own build target
# TODO(robert): set the default value of APP to local-devel?
push-release-to-appengine:
bin/gen-app-yaml -f $(APP)
thirdparty/google_appengine/appcfg.py --oauth2 update build
do-release: APP=google-melange
do-release: update-template-version commit-release push-release-to-appengine
@echo
@echo ==========================================================
@echo Melange release $(VERSION) pushed successfully!
@echo 1. push the release commit to the repository
@echo git push origin master
@echo 2. go to the App Engine control panel and send it traffic
@echo https://appengine.google.com/deployment?app_id=s~$(APP)