13544: Package Iteration was missing in the Makefile.
[arvados-workbench2.git] / Makefile
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: Apache-2.0
4
5 APP_NAME?=arvados-workbench2
6
7 # GIT_TAG is the last tagged stable release (i.e. 1.2.0)
8 GIT_TAG?=$(shell git describe --abbrev=0)
9
10 # TS_GIT is the timestamp in the current directory (i.e. 1528815021).
11 # Note that it will only change if files change.
12 TS_GIT?=$(shell git log -n1 --first-parent "--format=format:%ct" .)
13
14 # DATE_FROM_TS_GIT is the human(ish)-readable version of TS_GIT
15 # 1528815021 -> 20180612145021
16 DATE_FROM_TS_GIT?=$(shell date -ud @$(TS_GIT) +%Y%m%d%H%M%S)
17
18 # NIGHTLY_VERSION uses all the above to produce X.Y.Z.timestamp
19 # something in the lines of 1.2.0.20180612145021, this will be the package version
20 NIGHTLY_VERSION?=$(GIT_TAG).$(DATE_FROM_TS_GIT)
21
22 # ITERATION is the package iteration, intended for manual change if anything non-code related
23 # changes in the package. (i.e. example config files externally added
24 ITERATION?=1
25
26 DESCRIPTION=Arvados Workbench2 - Arvados is a free and open source platform for big data science.
27 MAINTAINER=Ward Vandewege <wvandewege@veritasgenetics.com>
28
29 # DEST_DIR will have the build package copied.
30 DEST_DIR=/var/www/arvados-workbench2/workbench2/
31
32 export WORKSPACE?=$(shell pwd)
33
34 .PHONY: help clean* yarn-install test build packages packages-with-version 
35
36 help:
37         @echo >&2
38         @echo >&2 "There is no default make target here.  Did you mean 'make test'?"
39         @echo >&2
40         @echo >&2 "More info:"
41         @echo >&2 "  Installing              --> http://doc.arvados.org/install"
42         @echo >&2 "  Developing/contributing --> https://dev.arvados.org"
43         @echo >&2 "  Project home            --> https://arvados.org"
44         @echo >&2
45         @false
46
47 clean-deb:
48         rm -f $(WORKSPACE)/*.deb
49
50 clean-rpm:
51         rm -f $(WORKSPACE)/*.rpm
52
53 clean-node-modules:
54         rm -rf $(WORKSPACE)/node_modules
55
56 clean: clean-rpm clean-deb clean-node-modules
57
58 yarn-install:
59         yarn install
60
61 test: yarn-install
62         yarn test       --no-watchAll --bail --ci
63
64 build: yarn-install test
65         yarn build
66
67 # use FPM to create DEB and RPM with a version (usually triggered from CI to make a release)
68 packages-with-version: build
69         fpm \
70          -s dir \
71          -t deb \
72          -n "$(APP_NAME)" \
73          -v "$(VERSION)" \
74          --iteration "$(ITERATION)" \
75          --maintainer="$(MAINTAINER)" \
76          --description="$(DESCRIPTION)" \
77          --deb-no-default-config-files \
78         $(WORKSPACE)/build/=DEST_DIR
79         fpm \
80          -s dir \
81          -t rpm \
82          -n "$(APP_NAME)" \
83          -v "$(VERSION)" \
84          --iteration "$(ITERATION)" \
85          --maintainer="$(MAINTAINER)" \
86          --description="$(DESCRIPTION)" \
87          $(WORKSPACE)/build/=DEST_DIR
88
89 # use FPM to create DEB and RPM
90 packages: build
91         fpm \
92          -s dir \
93          -t deb \
94          -n "$(APP_NAME)" \
95          -v "$(NIGHTLY_VERSION)" \
96          --iteration "$(ITERATION)" \
97          --maintainer="$(MAINTAINER)" \
98          --description="$(DESCRIPTION)" \
99          --deb-no-default-config-files \
100         $(WORKSPACE)/build/=DEST_DIR
101         fpm \
102          -s dir \
103          -t rpm \
104          -n "$(APP_NAME)" \
105          -v "$(NIGHTLY_VERSION)" \
106          --iteration "$(ITERATION)" \
107          --maintainer="$(MAINTAINER)" \
108          --description="$(DESCRIPTION)" \
109          $(WORKSPACE)/build/=DEST_DIR