14990: added 404 page with wildcard route
[arvados-workbench2.git] / Makefile
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: Apache-2.0
4
5 # Use bash, and run all lines in each recipe as one shell command
6 SHELL := /bin/bash
7 .ONESHELL:
8
9 APP_NAME?=arvados-workbench2
10
11 # VERSION uses all the above to produce X.Y.Z.timestamp
12 # something in the lines of 1.2.0.20180612145021, this will be the package version
13 # it can be overwritten when invoking make as in make packages VERSION=1.2.0
14 VERSION?=$(shell ./version-at-commit.sh HEAD)
15
16 # ITERATION is the package iteration, intended for manual change if anything non-code related
17 # changes in the package. (i.e. example config files externally added
18 ITERATION?=1
19
20 TARGETS?="centos7 debian8 debian9 debian10 ubuntu1404 ubuntu1604 ubuntu1804"
21
22 DESCRIPTION=Arvados Workbench2 - Arvados is a free and open source platform for big data science.
23 MAINTAINER=Arvados Package Maintainers <packaging@arvados.org>
24
25 # DEST_DIR will have the build package copied.
26 DEST_DIR=/var/www/arvados-workbench2/workbench2/
27
28 # Debian package file
29 DEB_FILE=$(APP_NAME)_$(VERSION)-$(ITERATION)_amd64.deb
30
31 # redHat package file
32 RPM_FILE=$(APP_NAME)-$(VERSION)-$(ITERATION).x86_64.rpm
33
34 export WORKSPACE?=$(shell pwd)
35
36 .PHONY: help clean* yarn-install test build packages packages-with-version integration-tests-in-docker
37
38 help:
39         @echo >&2
40         @echo >&2 "There is no default make target here.  Did you mean 'make test'?"
41         @echo >&2
42         @echo >&2 "More info:"
43         @echo >&2 "  Installing              --> http://doc.arvados.org/install"
44         @echo >&2 "  Developing/contributing --> https://dev.arvados.org"
45         @echo >&2 "  Project home            --> https://arvados.org"
46         @echo >&2
47         @false
48
49 clean-deb:
50         rm -f $(WORKSPACE)/*.deb
51
52 clean-rpm:
53         rm -f $(WORKSPACE)/*.rpm
54
55 clean-node-modules:
56         rm -rf $(WORKSPACE)/node_modules
57
58 clean: clean-rpm clean-deb clean-node-modules
59
60 yarn-install:
61         yarn install
62
63 unit-tests: yarn-install
64         yarn test --no-watchAll --bail --ci
65
66 integration-tests: yarn-install
67         yarn run cypress install
68         $(WORKSPACE)/tools/run-integration-tests.sh
69
70 integration-tests-in-docker: workbench2-build-image
71         docker run -ti -v$(PWD):$(PWD) -w$(PWD) workbench2-build make integration-tests
72
73 test: unit-tests integration-tests
74
75 build: test
76         VERSION=$(VERSION) yarn build
77
78 $(DEB_FILE): build
79         fpm \
80          -s dir \
81          -t deb \
82          -n "$(APP_NAME)" \
83          -v "$(VERSION)" \
84          --iteration "$(ITERATION)" \
85          --vendor="The Arvados Authors" \
86          --maintainer="$(MAINTAINER)" \
87          --url="https://arvados.org" \
88          --license="GNU Affero General Public License, version 3.0" \
89          --description="$(DESCRIPTION)" \
90          --config-files="etc/arvados/workbench2/workbench2.example.json" \
91         $(WORKSPACE)/build/=$(DEST_DIR)
92
93 $(RPM_FILE): build
94         fpm \
95          -s dir \
96          -t rpm \
97          -n "$(APP_NAME)" \
98          -v "$(VERSION)" \
99          --iteration "$(ITERATION)" \
100          --vendor="The Arvados Authors" \
101          --maintainer="$(MAINTAINER)" \
102          --url="https://arvados.org" \
103          --license="GNU Affero General Public License, version 3.0" \
104          --description="$(DESCRIPTION)" \
105          --config-files="etc/arvados/workbench2/workbench2.example.json" \
106          $(WORKSPACE)/build/=$(DEST_DIR)
107
108 copy: $(DEB_FILE) $(RPM_FILE)
109         for target in $(TARGETS) ; do \
110                 mkdir -p packages/$$target
111                 if [[ $$target =~ ^centos ]]; then
112                         cp -p $(RPM_FILE) packages/$$target ; \
113                 else
114                         cp -p $(DEB_FILE) packages/$$target ; \
115                 fi
116         done
117         rm -f $(RPM_FILE)
118         rm -f $(DEB_FILE)
119
120 # use FPM to create DEB and RPM
121 packages: copy
122
123 workbench2-build-image:
124         (cd docker && docker build -t workbench2-build .)