1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
5 # Use bash, and run all lines in each recipe as one shell command
9 APP_NAME?=arvados-workbench2
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 # We don't use BUILD_NUMBER at the moment, but it needs to be defined
17 GIT_COMMIT?=$(shell git rev-parse --short HEAD)
19 # ITERATION is the package iteration, intended for manual change if anything non-code related
20 # changes in the package. (i.e. example config files externally added
23 TARGETS?=centos7 debian10 debian11 ubuntu1804 ubuntu2004
25 ARVADOS_DIRECTORY?=unset
27 DESCRIPTION=Arvados Workbench2 - Arvados is a free and open source platform for big data science.
28 MAINTAINER=Arvados Package Maintainers <packaging@arvados.org>
30 # DEST_DIR will have the build package copied.
31 DEST_DIR=/var/www/$(APP_NAME)/workbench2/
34 DEB_FILE=$(APP_NAME)_$(VERSION)-$(ITERATION)_amd64.deb
37 RPM_FILE=$(APP_NAME)-$(VERSION)-$(ITERATION).x86_64.rpm
39 export WORKSPACE?=$(shell pwd)
41 .PHONY: help clean* yarn-install test build packages packages-with-version integration-tests-in-docker
45 @echo >&2 "There is no default make target here. Did you mean 'make test'?"
47 @echo >&2 "More info:"
48 @echo >&2 " Installing --> http://doc.arvados.org/install"
49 @echo >&2 " Developing/contributing --> https://dev.arvados.org"
50 @echo >&2 " Project home --> https://arvados.org"
55 rm -f $(WORKSPACE)/*.deb
58 rm -f $(WORKSPACE)/*.rpm
61 rm -rf $(WORKSPACE)/node_modules
63 clean: clean-rpm clean-deb clean-node-modules
65 arvados-server-install:
66 cd $(ARVADOS_DIRECTORY)
71 ls -l ~/go/bin/arvados-server
72 ~/go/bin/arvados-server install -type test
74 yarn-install: arvados-server-install
77 unit-tests: yarn-install
78 yarn test --no-watchAll --bail --ci
80 integration-tests: yarn-install
81 yarn run cypress install
82 $(WORKSPACE)/tools/run-integration-tests.sh -a $(ARVADOS_DIRECTORY)
84 integration-tests-in-docker: workbench2-build-image
85 docker run -ti -v$(PWD):/usr/src/workbench2 -v$(ARVADOS_DIRECTORY):/usr/src/arvados -w /usr/src/workbench2 -e ARVADOS_DIRECTORY=/usr/src/arvados workbench2-build make integration-tests
87 test: unit-tests integration-tests
90 VERSION=$(VERSION) BUILD_NUMBER=$(BUILD_NUMBER) GIT_COMMIT=$(GIT_COMMIT) yarn build
98 --iteration "$(ITERATION)" \
99 --vendor="The Arvados Authors" \
100 --maintainer="$(MAINTAINER)" \
101 --url="https://arvados.org" \
102 --license="GNU Affero General Public License, version 3.0" \
103 --description="$(DESCRIPTION)" \
104 --config-files="etc/arvados/$(APP_NAME)/workbench2.example.json" \
105 $(WORKSPACE)/build/=$(DEST_DIR) \
106 etc/arvados/workbench2/workbench2.example.json=/etc/arvados/$(APP_NAME)/workbench2.example.json
114 --iteration "$(ITERATION)" \
115 --vendor="The Arvados Authors" \
116 --maintainer="$(MAINTAINER)" \
117 --url="https://arvados.org" \
118 --license="GNU Affero General Public License, version 3.0" \
119 --description="$(DESCRIPTION)" \
120 --config-files="etc/arvados/$(APP_NAME)/workbench2.example.json" \
121 $(WORKSPACE)/build/=$(DEST_DIR) \
122 etc/arvados/workbench2/workbench2.example.json=/etc/arvados/$(APP_NAME)/workbench2.example.json
124 copy: $(DEB_FILE) $(RPM_FILE)
125 for target in $(TARGETS) ; do \
126 mkdir -p packages/$$target
127 if [[ $$target =~ ^centos ]]; then
128 cp -p $(RPM_FILE) packages/$$target ; \
130 cp -p $(DEB_FILE) packages/$$target ; \
136 # use FPM to create DEB and RPM
139 check-arvados-directory:
140 @if test "${ARVADOS_DIRECTORY}" == "unset"; then echo "the environment variable ARVADOS_DIRECTORY must be set to the path of an arvados git checkout"; exit 1; fi
141 @if ! test -d "${ARVADOS_DIRECTORY}"; then echo "the environment variable ARVADOS_DIRECTORY does not point at a directory"; exit 1; fi
143 packages-in-docker: check-arvados-directory workbench2-build-image
144 docker run --env ci="true" \
145 --env ARVADOS_DIRECTORY=/tmp/arvados \
146 --env APP_NAME=${APP_NAME} \
147 --env ITERATION=${ITERATION} \
148 --env TARGETS="${TARGETS}" \
149 -w="/tmp/workbench2" \
150 -t -v ${WORKSPACE}:/tmp/workbench2 \
151 -v ${ARVADOS_DIRECTORY}:/tmp/arvados workbench2-build:latest \
154 workbench2-build-image:
155 (cd docker && docker build -t workbench2-build .)