Merge branch '17337-files-not-visible-in-arvados'
[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 debian10 ubuntu1404 ubuntu1604 ubuntu1804 ubuntu2004"
21
22 ARVADOS_DIRECTORY?=unset
23
24 DESCRIPTION=Arvados Workbench2 - Arvados is a free and open source platform for big data science.
25 MAINTAINER=Arvados Package Maintainers <packaging@arvados.org>
26
27 # DEST_DIR will have the build package copied.
28 DEST_DIR=/var/www/arvados-workbench2/workbench2/
29
30 # Debian package file
31 DEB_FILE=$(APP_NAME)_$(VERSION)-$(ITERATION)_amd64.deb
32
33 # redHat package file
34 RPM_FILE=$(APP_NAME)-$(VERSION)-$(ITERATION).x86_64.rpm
35
36 export WORKSPACE?=$(shell pwd)
37
38 .PHONY: help clean* yarn-install test build packages packages-with-version integration-tests-in-docker
39
40 help:
41         @echo >&2
42         @echo >&2 "There is no default make target here.  Did you mean 'make test'?"
43         @echo >&2
44         @echo >&2 "More info:"
45         @echo >&2 "  Installing              --> http://doc.arvados.org/install"
46         @echo >&2 "  Developing/contributing --> https://dev.arvados.org"
47         @echo >&2 "  Project home            --> https://arvados.org"
48         @echo >&2
49         @false
50
51 clean-deb:
52         rm -f $(WORKSPACE)/*.deb
53
54 clean-rpm:
55         rm -f $(WORKSPACE)/*.rpm
56
57 clean-node-modules:
58         rm -rf $(WORKSPACE)/node_modules
59
60 clean: clean-rpm clean-deb clean-node-modules
61
62 yarn-install:
63         yarn install
64
65 unit-tests: yarn-install
66         yarn test --no-watchAll --bail --ci
67
68 integration-tests: yarn-install
69         yarn run cypress install
70         $(WORKSPACE)/tools/run-integration-tests.sh -a $(ARVADOS_DIRECTORY)
71
72 integration-tests-in-docker: workbench2-build-image
73         docker run -ti -v$(PWD):$(PWD) -w$(PWD) workbench2-build make integration-tests
74
75 test: unit-tests integration-tests
76
77 build: yarn-install
78         VERSION=$(VERSION) yarn build
79
80 $(DEB_FILE): build
81         fpm \
82          -s dir \
83          -t deb \
84          -n "$(APP_NAME)" \
85          -v "$(VERSION)" \
86          --iteration "$(ITERATION)" \
87          --vendor="The Arvados Authors" \
88          --maintainer="$(MAINTAINER)" \
89          --url="https://arvados.org" \
90          --license="GNU Affero General Public License, version 3.0" \
91          --description="$(DESCRIPTION)" \
92          --config-files="etc/arvados/workbench2/workbench2.example.json" \
93         $(WORKSPACE)/build/=$(DEST_DIR)
94
95 $(RPM_FILE): build
96         fpm \
97          -s dir \
98          -t rpm \
99          -n "$(APP_NAME)" \
100          -v "$(VERSION)" \
101          --iteration "$(ITERATION)" \
102          --vendor="The Arvados Authors" \
103          --maintainer="$(MAINTAINER)" \
104          --url="https://arvados.org" \
105          --license="GNU Affero General Public License, version 3.0" \
106          --description="$(DESCRIPTION)" \
107          --config-files="etc/arvados/workbench2/workbench2.example.json" \
108          $(WORKSPACE)/build/=$(DEST_DIR)
109
110 copy: $(DEB_FILE) $(RPM_FILE)
111         for target in $(TARGETS) ; do \
112                 mkdir -p packages/$$target
113                 if [[ $$target =~ ^centos ]]; then
114                         cp -p $(RPM_FILE) packages/$$target ; \
115                 else
116                         cp -p $(DEB_FILE) packages/$$target ; \
117                 fi
118         done
119         rm -f $(RPM_FILE)
120         rm -f $(DEB_FILE)
121
122 # use FPM to create DEB and RPM
123 packages: copy
124
125 workbench2-build-image:
126         (cd docker && docker build -t workbench2-build .)