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 # Cypress test file that can be passed to the integration-test target
15 # VERSION uses all the above to produce X.Y.Z.timestamp
16 # something in the lines of 1.2.0.20180612145021, this will be the package version
17 # it can be overwritten when invoking make as in make packages VERSION=1.2.0
18 VERSION?=$(shell ./version-at-commit.sh HEAD)
19 # We don't use BUILD_NUMBER at the moment, but it needs to be defined
21 GIT_COMMIT?=$(shell git rev-parse --short HEAD)
23 # ITERATION is the package iteration, intended for manual change if anything non-code related
24 # changes in the package. (i.e. example config files externally added
27 TARGETS?=rocky8 debian11 debian12 ubuntu2004 ubuntu2204
29 DESCRIPTION=Arvados Workbench2 - Arvados is a free and open source platform for big data science.
30 MAINTAINER=Arvados Package Maintainers <packaging@arvados.org>
32 # DEST_DIR will have the build package copied.
33 DEST_DIR=/var/www/$(APP_NAME)/workbench2/
36 DEB_FILE=$(APP_NAME)_$(VERSION)-$(ITERATION)_amd64.deb
39 RPM_FILE=$(APP_NAME)-$(VERSION)-$(ITERATION).x86_64.rpm
41 GOPATH=$(shell go env GOPATH)
42 export WORKSPACE?=$(shell pwd)
44 ARVADOS_DIRECTORY?=$(shell env -C $(WORKSPACE) git rev-parse --show-toplevel)
46 .PHONY: help clean* yarn-install test build packages packages-with-version integration-tests-in-docker
50 @echo >&2 "There is no default make target here. Did you mean 'make test'?"
52 @echo >&2 "More info:"
53 @echo >&2 " Installing --> http://doc.arvados.org/install"
54 @echo >&2 " Developing/contributing --> https://dev.arvados.org"
55 @echo >&2 " Project home --> https://arvados.org"
60 rm -f $(WORKSPACE)/*.deb
63 rm -f $(WORKSPACE)/*.rpm
66 rm -rf $(WORKSPACE)/node_modules
68 clean: clean-rpm clean-deb clean-node-modules
70 arvados-server-install: check-arvados-directory
71 cd $(ARVADOS_DIRECTORY)
74 echo GOPATH is $(GOPATH)
75 GOFLAGS=-buildvcs=false go install
77 ls -l $(GOPATH)/bin/arvados-server
78 $(GOPATH)/bin/arvados-server install -type test
83 unit-tests: yarn-install
84 yarn test --no-watchAll --bail --ci
86 integration-tests: yarn-install check-arvados-directory
87 yarn run cypress install
88 ifeq ($(SPECFILE), ALL)
89 $(WORKSPACE)/tools/run-integration-tests.sh -a $(ARVADOS_DIRECTORY)
91 $(WORKSPACE)/tools/run-integration-tests.sh -a $(ARVADOS_DIRECTORY) -- --spec $(SPECFILE)
94 integration-tests-in-docker: workbench2-build-image check-arvados-directory
96 --env ARVADOS_DIRECTORY=/usr/src/arvados \
97 --env GIT_DISCOVERY_ACROSS_FILESYSTEM=1 \
98 -v $(WORKSPACE):/usr/src/arvados/services/workbench2 \
99 -v $(ARVADOS_DIRECTORY):/usr/src/arvados \
100 -w /usr/src/arvados/services/workbench2 \
102 make arvados-server-install integration-tests SPECFILE=$(SPECFILE)
104 unit-tests-in-docker: workbench2-build-image check-arvados-directory
105 docker run -ti --rm \
106 --env ARVADOS_DIRECTORY=/usr/src/arvados \
107 --env GIT_DISCOVERY_ACROSS_FILESYSTEM=1 \
108 -v $(WORKSPACE):/usr/src/arvados/services/workbench2 \
109 -v $(ARVADOS_DIRECTORY):/usr/src/arvados \
110 -w /usr/src/arvados/services/workbench2 \
112 make arvados-server-install unit-tests
114 tests-in-docker: workbench2-build-image check-arvados-directory
115 docker run -ti --rm \
116 --env ARVADOS_DIRECTORY=/usr/src/arvados \
117 --env GIT_DISCOVERY_ACROSS_FILESYSTEM=1 \
119 -v $(WORKSPACE):/usr/src/arvados/services/workbench2 \
120 -v$(ARVADOS_DIRECTORY):/usr/src/arvados \
121 -w /usr/src/arvados/services/workbench2 \
125 test: unit-tests integration-tests
128 VERSION=$(VERSION) BUILD_NUMBER=$(BUILD_NUMBER) GIT_COMMIT=$(GIT_COMMIT) yarn build
136 --iteration "$(ITERATION)" \
137 --vendor="The Arvados Authors" \
138 --maintainer="$(MAINTAINER)" \
139 --url="https://arvados.org" \
140 --license="GNU Affero General Public License, version 3.0" \
141 --description="$(DESCRIPTION)" \
142 --config-files="etc/arvados/$(APP_NAME)/workbench2.example.json" \
143 $(WORKSPACE)/build/=$(DEST_DIR) \
144 etc/arvados/workbench2/workbench2.example.json=/etc/arvados/$(APP_NAME)/workbench2.example.json
152 --iteration "$(ITERATION)" \
153 --vendor="The Arvados Authors" \
154 --maintainer="$(MAINTAINER)" \
155 --url="https://arvados.org" \
156 --license="GNU Affero General Public License, version 3.0" \
157 --description="$(DESCRIPTION)" \
158 --config-files="etc/arvados/$(APP_NAME)/workbench2.example.json" \
159 $(WORKSPACE)/build/=$(DEST_DIR) \
160 etc/arvados/workbench2/workbench2.example.json=/etc/arvados/$(APP_NAME)/workbench2.example.json
162 copy: $(DEB_FILE) $(RPM_FILE)
163 for target in $(TARGETS); do \
164 mkdir -p "packages/$$target" && \
166 centos*|rocky*) cp -p "$(RPM_FILE)" "packages/$$target" ;; \
167 debian*|ubuntu*) cp -p "$(DEB_FILE)" "packages/$$target" ;; \
168 *) echo "Unknown copy target $$target"; exit 1 ;; \
171 rm -f "$(DEB_FILE)" "$(RPM_FILE)"
173 # use FPM to create DEB and RPM
176 check-arvados-directory:
177 @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
178 @if ! test -d "${ARVADOS_DIRECTORY}"; then echo "the environment variable ARVADOS_DIRECTORY does not point at a directory"; exit 1; fi
180 packages-in-docker: check-arvados-directory workbench2-build-image
181 docker run -t --rm --env ci="true" \
182 --env ARVADOS_DIRECTORY=/tmp/arvados \
183 --env APP_NAME=${APP_NAME} \
184 --env VERSION="${VERSION}" \
185 --env ITERATION=${ITERATION} \
186 --env TARGETS="${TARGETS}" \
187 --env MAINTAINER="${MAINTAINER}" \
188 --env DESCRIPTION="${DESCRIPTION}" \
189 --env GIT_DISCOVERY_ACROSS_FILESYSTEM=1 \
190 -w "/tmp/workbench2" \
191 -v ${WORKSPACE}:/tmp/workbench2 \
192 -v ${ARVADOS_DIRECTORY}:/tmp/arvados \
193 workbench2-build:latest \
194 sh -c 'git config --global --add safe.directory /tmp/workbench2 && make packages'
196 workbench2-build-image:
197 docker inspect workbench2-build &> /dev/null || \
198 docker build -t workbench2-build -f docker/Dockerfile ${ARVADOS_DIRECTORY}