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
10 APP_NAME?=arvados-workbench2
12 # VERSION uses all the above to produce X.Y.Z.timestamp
13 # something in the lines of 1.2.0.20180612145021, this will be the package version
14 # it can be overwritten when invoking make as in make packages VERSION=1.2.0
15 VERSION?=$(shell ./version-at-commit.sh HEAD)
16 # We don't use BUILD_NUMBER at the moment, but it needs to be defined
18 GIT_COMMIT?=$(shell git rev-parse --short HEAD)
20 # ITERATION is the package iteration, intended for manual change if anything non-code related
21 # changes in the package. (i.e. example config files externally added
24 TARGETS?=centos7 rocky8 debian10 debian11 ubuntu1804 ubuntu2004
26 ARVADOS_DIRECTORY?=unset
28 DESCRIPTION=Arvados Workbench2 - Arvados is a free and open source platform for big data science.
29 MAINTAINER=Arvados Package Maintainers <packaging@arvados.org>
31 # DEST_DIR will have the build package copied.
32 DEST_DIR=/var/www/$(APP_NAME)/workbench2/
35 DEB_FILE=$(APP_NAME)_$(VERSION)-$(ITERATION)_amd64.deb
38 RPM_FILE=$(APP_NAME)-$(VERSION)-$(ITERATION).x86_64.rpm
40 GOPATH=$(shell go env GOPATH)
41 export WORKSPACE?=$(shell pwd)
43 .PHONY: help clean* yarn-install test build packages packages-with-version integration-tests-in-docker
47 @echo >&2 "There is no default make target here. Did you mean 'make test'?"
49 @echo >&2 "More info:"
50 @echo >&2 " Installing --> http://doc.arvados.org/install"
51 @echo >&2 " Developing/contributing --> https://dev.arvados.org"
52 @echo >&2 " Project home --> https://arvados.org"
57 rm -f $(WORKSPACE)/*.deb
60 rm -f $(WORKSPACE)/*.rpm
63 rm -rf $(WORKSPACE)/node_modules
65 clean: clean-rpm clean-deb clean-node-modules
67 arvados-server-install: check-arvados-directory
68 cd $(ARVADOS_DIRECTORY)
71 echo GOPATH is $(GOPATH)
72 GOFLAGS=-buildvcs=false go install
74 ls -l $(GOPATH)/bin/arvados-server
75 $(GOPATH)/bin/arvados-server install -type test
80 unit-tests: yarn-install
81 yarn test --no-watchAll --bail --ci
83 integration-tests: yarn-install check-arvados-directory
84 yarn run cypress install
85 $(WORKSPACE)/tools/run-integration-tests.sh -a $(ARVADOS_DIRECTORY)
87 integration-tests-in-docker: workbench2-build-image check-arvados-directory
88 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 arvados-server-install integration-tests
90 unit-tests-in-docker: workbench2-build-image check-arvados-directory
91 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 arvados-server-install unit-tests
93 tests-in-docker: workbench2-build-image check-arvados-directory
94 docker run -t -v$(PWD):/usr/src/workbench2 -v$(ARVADOS_DIRECTORY):/usr/src/arvados -w /usr/src/workbench2 -e ARVADOS_DIRECTORY=/usr/src/arvados -e ci="${ci}" workbench2-build make test
96 test: unit-tests integration-tests
99 VERSION=$(VERSION) BUILD_NUMBER=$(BUILD_NUMBER) GIT_COMMIT=$(GIT_COMMIT) yarn build
107 --iteration "$(ITERATION)" \
108 --vendor="The Arvados Authors" \
109 --maintainer="$(MAINTAINER)" \
110 --url="https://arvados.org" \
111 --license="GNU Affero General Public License, version 3.0" \
112 --description="$(DESCRIPTION)" \
113 --config-files="etc/arvados/$(APP_NAME)/workbench2.example.json" \
114 $(WORKSPACE)/build/=$(DEST_DIR) \
115 etc/arvados/workbench2/workbench2.example.json=/etc/arvados/$(APP_NAME)/workbench2.example.json
123 --iteration "$(ITERATION)" \
124 --vendor="The Arvados Authors" \
125 --maintainer="$(MAINTAINER)" \
126 --url="https://arvados.org" \
127 --license="GNU Affero General Public License, version 3.0" \
128 --description="$(DESCRIPTION)" \
129 --config-files="etc/arvados/$(APP_NAME)/workbench2.example.json" \
130 $(WORKSPACE)/build/=$(DEST_DIR) \
131 etc/arvados/workbench2/workbench2.example.json=/etc/arvados/$(APP_NAME)/workbench2.example.json
133 copy: $(DEB_FILE) $(RPM_FILE)
134 for target in $(TARGETS); do \
135 mkdir -p "packages/$$target" && \
137 centos*|rocky*) cp -p "$(RPM_FILE)" "packages/$$target" ;; \
138 debian*|ubuntu*) cp -p "$(DEB_FILE)" "packages/$$target" ;; \
139 *) echo "Unknown copy target $$target"; exit 1 ;; \
142 rm -f "$(DEB_FILE)" "$(RPM_FILE)"
144 # use FPM to create DEB and RPM
147 check-arvados-directory:
148 @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
149 @if ! test -d "${ARVADOS_DIRECTORY}"; then echo "the environment variable ARVADOS_DIRECTORY does not point at a directory"; exit 1; fi
151 packages-in-docker: check-arvados-directory workbench2-build-image
152 docker run --env ci="true" \
153 --env ARVADOS_DIRECTORY=/tmp/arvados \
154 --env APP_NAME=${APP_NAME} \
155 --env ITERATION=${ITERATION} \
156 --env TARGETS="${TARGETS}" \
157 -w="/tmp/workbench2" \
158 -t -v ${WORKSPACE}:/tmp/workbench2 \
159 -v ${ARVADOS_DIRECTORY}:/tmp/arvados workbench2-build:latest \
162 workbench2-build-image:
163 (cd docker && docker build -t workbench2-build .)