-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
185 lines (167 loc) · 4.62 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
APT_GET := $(shell command -v apt-get 2> /dev/null)
BREW := $(shell command -v brew 2> /dev/null)
PLATFORM = $(shell uname -s | sed -e 's/Darwin/Mac/')
VERSION = $(shell cat grow/VERSION)
FILENAME = Grow-SDK-$(PLATFORM)-$(VERSION).zip
GITHUB_USER = grow
GITHUB_REPO = grow
export GOPATH := $(HOME)/go/
export PATH := $(HOME)/go/bin/:$(PATH)
# Default test target for "make test". Allows "make target=grow.pods.pods_test test"
target ?= 'grow/'
develop:
@pip --version > /dev/null || { \
echo "pip not installed. Trying to install pip..."; \
sudo easy_install pip; \
}
@virtualenv --version > /dev/null || { \
echo "virtualenv not installed. Trying to install virtualenv..."; \
sudo pip install virtualenv; \
}
virtualenv env --distribute
. env/bin/activate
@echo "Trying to install libyaml..."
@if [ $(BREW) ]; then \
brew install libyaml || { \
echo " Error installing libyaml with brew."; \
echo " Try installing from source: http://pyyaml.org/wiki/LibYAML"; \
}; \
elif [ $(APT_GET) ]; then \
sudo apt-get install libyaml-dev; \
else \
echo " You must install libyaml from source: http://pyyaml.org/wiki/LibYAML"; \
fi
$(MAKE) build-ui
./env/bin/pip install -r requirements-dev.txt
./env/bin/pip install --upgrade PyYAML==3.10
build-ui:
@npm --version > /dev/null || { \
if [ $(APT_GET) ]; then \
echo "npm not installed. Trying to install npm..."; \
sudo apt-get -f install -y --no-install-recommends nodejs-legacy npm; \
else \
echo "npm not installed. You must install npm."; \
echo "Try installing via nvm: https://github.com/creationix/nvm" \
exit 1; \
fi \
}
@cd grow/ui; npm install .
@cd grow/ui; ./node_modules/gulp/bin/gulp.js build
develop-linux:
sudo apt-get install \
build-essential \
libc6 \
libffi-dev \
libssl-dev \
libxml2-dev \
libxslt-dev \
libyaml-dev \
python \
python-all-dev zip \
python-pip \
zip
sudo pip install --upgrade pip
sudo pip install --upgrade six
$(MAKE) develop
test:
. env/bin/activate
./env/bin/nosetests \
-v \
--rednose \
--with-coverage \
--cover-erase \
--cover-html \
--cover-html-dir=htmlcov \
--cover-package=grow \
$(target)
test-nosetests:
nosetests \
-v \
--rednose \
--with-coverage \
--cover-erase \
--cover-html \
--cover-html-dir=htmlcov \
--cover-package=grow \
grow
test-gae:
virtualenv gaenv --distribute
. gaenv/bin/activate
./gaenv/bin/pip install -r requirements-dev.txt
./gaenv/bin/pip install gaenv
./gaenv/bin/pip install NoseGAE==0.5.8
# https://github.com/faisalraja/gaenv/issues/11
cat requirements.txt > ./gaenv/requirements-gae.txt
echo "pyasn1-modules>=0.0.5" >> ./gaenv/requirements-gae.txt
./gaenv/bin/gaenv -r ./gaenv/requirements-gae.txt --lib lib --no-import .
NOSEGAE=1 ./gaenv/bin/nosetests \
-v \
--rednose \
--with-gae \
--nocapture \
--nologcapture \
--gae-application=./grow/testing/testdata/pod/ \
--gae-lib-root=$(HOME)/google_appengine/ \
$(target)
test-ci:
$(MAKE) build-ui
$(MAKE) test-nosetests
$(MAKE) test-gae
prep-release:
$(MAKE) build-ui
$(MAKE) test
upload-pypi:
. env/bin/activate
$(MAKE) ensure-master
git pull origin master
$(MAKE) prep-release
python setup.py sdist upload
upload-github:
@github-release > /dev/null || { \
go get github.com/aktau/github-release; \
}
. env/bin/activate
$(MAKE) ensure-master
git pull origin master
$(MAKE) prep-release
$(MAKE) release
@if github-release info -u $(GITHUB_USER) -r $(GITHUB_REPO) -t $(VERSION); then \
echo "Using existing release."; \
else \
echo "Creating new release."; \
git tag $(VERSION) && git push --tags; \
github-release \
release \
-u $(GITHUB_USER) \
-r $(GITHUB_REPO) \
-t $(VERSION) \
-n "$(VERSION)" \
--draft; \
fi
@echo "Uploading: $(FILENAME)"
github-release \
upload \
-u $(GITHUB_USER) \
-r $(GITHUB_REPO) \
-t $(VERSION) \
-n "$(FILENAME)" \
--file dist/$(FILENAME)
# https://github.com/grow/grow/issues/302
setup-release:
make develop
. env/bin/activate
./env/bin/pip install git+https://github.com/pyinstaller/pyinstaller.git\#b78bfe530cdc2904f65ce098bdf2de08c9037abb
release:
. env/bin/activate
./env/bin/pyinstaller grow.spec
chmod +x dist/grow
cd dist && zip -r $(FILENAME) grow && cd ..
./dist/grow
./dist/grow build ./grow/testing/testdata/pod/
@echo "Built: dist/$(FILENAME)"
ensure-master:
@if [ `git rev-parse --abbrev-ref HEAD` != "master" ]; then \
echo 'Releases must be uploaded from "master".'; \
exit 1; \
fi
.PHONY: develop develop-linux test test-ci test-gae test-nosetests upload-pypi upload-github ensure-master