| # Copyright 2017 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| INFRAPYTHON := "../../ENV/bin/python" |
| GAE_PY := "gae.py" |
| APPID := "findit-for-me" |
| STAGING_APPID := "findit-for-me-staging" |
| # Should come with infra repository, if this step fails run |
| # ...$ gclient sync |
| PROTOC := "../../cipd/protoc" |
| MODULES := default frontend waterfall-backend flake-detection-backend |
| LOCAL_VERSION := `$(INFRAPYTHON) $(GAE_PY) version` |
| LOCAL_HASH := `git rev-parse --short HEAD` |
| # If there are multiple active versions just use the latest one. |
| REMOTE_VERSION := `$(INFRAPYTHON) $(GAE_PY) active -b -A $(APPID)|tail -n 1` |
| REMOTE_HASH := `python -c "print '$$($(INFRAPYTHON) $(GAE_PY) active -b -A $(APPID))'.split('-')[:2][-1]"` |
| |
| |
| help: |
| @echo "To deploy a new version of findit, check out the appropriate" \ |
| "revision and run \`gclient sync\` then run" \ |
| "\`make deploy-prod\` for production or \`make deploy-staging\`"\ |
| "for staging." |
| @echo "To migrate the traffic to the newly deployed version use " \ |
| "\`make migrate\`, this is only necessary for production." |
| @echo "To revert to the previous version, use the command displayed " \ |
| "by make when running the line above, or better yet, use the" \ |
| "web interface to make the previous release default." |
| @echo |
| @echo "To format code use \`make format\`" |
| @echo "To run tests use \`make test\`" |
| @echo "To run findit locally use \`make run\`" |
| |
| |
| ##### App Engine ### |
| deploy-prod: _deploy |
| @echo "New version '$(LOCAL_VERSION)' of Findit was" \ |
| "deployed to $(APPID)." |
| @echo |
| @echo "Please force a re-run of a recent build failure on dashboard: "\ |
| "https://$(LOCAL_VERSION)-dot-frontend-"\ |
| "dot-$(APPID).appspot.com/waterfall/list-analyses" |
| @echo "Choose a first failure to make sure a new try job is triggered." |
| @echo "Please also force a re-run of a recent flake analysis on dashboard: "\ |
| "https://$(LOCAL_VERSION)-dot-frontend-"\ |
| "dot-$(APPID).appspot.com/waterfall/list-flakes" |
| @echo "ensure that the analyses are run in the new-version waterfall" \ |
| "frontend & backend and gives correct results," |
| @echo "and then set the new version as default for four modules" \ |
| "default, frontend, waterfall-backend and flake-detection-backend." |
| @echo "You can do this by running \`make migrate\`" |
| @echo |
| @echo "If the release is for findit-for-me, please email" \ |
| "chrome-findit with the following:" |
| @echo "Subject: Release: findit-for-me updated to" \ |
| "$(LOCAL_VERSION)" |
| @echo "Hi all," |
| @echo |
| @echo "The app findit-for-me was updated from" \ |
| "$(REMOTE_VERSION) to $(LOCAL_VERSION)" |
| @echo "Changelogs:" |
| @echo "https://chromium.googlesource.com/infra/infra/+log/"\ |
| "$(REMOTE_HASH)..$(LOCAL_HASH)"\ |
| "/appengine/findit?pretty=fuller" |
| @echo |
| @echo "If your bug fixes/features are included in the release," \ |
| "please verify on ${app_id} and mark them as verified on" \ |
| "http://crbug.com" |
| @echo |
| @echo "Thanks," |
| @echo "Released by $(USER)@" |
| |
| deploy-staging: test |
| @$(INFRAPYTHON) $(GAE_PY) upload -A $(STAGING_APPID); |
| |
| _deploy: test |
| @$(INFRAPYTHON) $(GAE_PY) upload -A $(APPID); |
| |
| migrate: |
| @echo "To revert to the previous version run the following command:" |
| @echo "\`$(INFRAPYTHON) $(GAE_PY) switch -A $(APPID) " \ |
| "$(REMOTE_VERSION) \`" |
| $(INFRAPYTHON) $(GAE_PY) switch -A $(APPID) |
| |
| |
| ##### Development ### |
| run: |
| $(INFRAPYTHON) $(GAE_PY) devserver |
| |
| YAPF := $(shell command -v yapf 2> /dev/null) |
| format: |
| ifndef YAPF |
| @echo "Please install yapf first: https://github.com/google/yapf." && false |
| endif |
| git cl format --full --python |
| |
| proto: |
| @$(PROTOC) --proto_path=model/proto/ \ |
| --python_out=model/proto/gen \ |
| model/proto/*.proto |
| |
| |
| |
| ##### Unit tests ### |
| clean-expect_tests: # $$ is to escape $ in makefile. |
| ps auxef | grep ENV/bin/expect_tests | grep -v grep | \ |
| awk '{print $$2}' | xargs kill -9 >/dev/null 2>&1 | echo |
| |
| test: clean-expect_tests |
| @mkdir -p $(TMPDIR)/coverage |
| $(INFRAPYTHON) ../../test.py test appengine/findit \ |
| --html-report $(TMPDIR)/coverage |
| |
| node_deps: |
| npm install |
| |
| wct: node_deps |
| npx run-wct --base ui/ --dep third_party |
| |
| wct_debug: node_deps |
| npx run-wct --base ui/ --dep third_party --debug |
| |
| ##### TMP ### |
| TMPDIR := $(shell mkdir -p .tmp 2> /dev/null && realpath .tmp) |
| ifndef TMPDIR |
| TMPDIR := $(shell mktemp -d) |
| endif |
| |
| .PHONY: _deploy test update \ |
| help migrate deploy-prod deploy-staging |