-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jorge Moreno
committed
Jul 17, 2024
1 parent
64f2624
commit 587cb5d
Showing
151 changed files
with
175,328 additions
and
2,090 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Copyright (c) 2011-2023, Lawrence Livermore National Security, LLC. | ||
Copyright (c) 2011-2024, Lawrence Livermore National Security, LLC. | ||
Produced at the Lawrence Livermore National Laboratory | ||
Written by Mason Kwiat, Douglas S. Miller, and Kevin Griffin, Edward Rusu, Sarah El-Jurf, Jorge Moreno | ||
Written by Mason Kwiat, Douglas S. Miller, and Kevin Griffin, Ephraim Rusu, Sarah El-Jurf, Jorge Moreno | ||
e-mail: [email protected], [email protected] | ||
LLNL-CODE-507071 | ||
All rights reserved. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
SHELL := /bin/bash | ||
|
||
USER_WORKSPACE := $(if $(USER_WORKSPACE), $(USER_WORKSPACE),/usr/workspace/$(USER)) | ||
WORKSPACE = $(USER_WORKSPACE)/gitlab/weave/pydv | ||
PYDV_ENV := $(if $(PYDV_ENV), $(PYDV_ENV),pydv_env) | ||
PYDV_ENV := $(if $(PYDV_ENV),$(PYDV_ENV),$(HOME)/pydv_env) | ||
|
||
PKG_REGISTRY_URL = $(CI_API_V4_URL)/projects/$(CI_PROJECT_ID)/packages/generic/archive | ||
DEPLOY_PATH = /usr/gapps/pydv | ||
|
@@ -12,84 +10,84 @@ RZ_GITLAB = "ssh://[email protected]:7999" | |
PROJECT = "weave/pydv.git" | ||
|
||
RZ_TESTS_WORKDIR = /usr/gapps/pydv/wsc_tests_workdir | ||
PYTHON_CMD = /usr/tce/bin/python3 | ||
|
||
define create_env | ||
# call from the directory where env will be created | ||
# arg1: name of env | ||
$(PYTHON_CMD) -m venv $1 | ||
source $1/bin/activate && | ||
pip3 install --upgrade pip && | ||
pip3 install --force pytest && | ||
pip3 install numpy scipy matplotlib PySide2 && | ||
which pytest | ||
WEAVE_DEVELOP_VENV = /usr/apps/weave/weave-develop-cpu | ||
PYTHON_CMD = $(WEAVE_DEVELOP_VENV)/bin/python3 | ||
|
||
ifeq ($(SOURCE_ZONE),SCF) | ||
WEAVE_DEPLOY_GROUP = sduser | ||
else | ||
WEAVE_DEPLOY_GROUP = llnl_emp | ||
endif | ||
SPACK_WEAVE_VIEW = /usr/workspace/$(WEAVE_DEPLOY_GROUP)/weave/repos/spack/spack_core_environment/0.20/$(LCSCHEDCLUSTER)/local/ | ||
ADD_PATH = $(SPACK_WEAVE_VIEW)/bin:$(WEAVE_DEVELOP_VENV)/bin | ||
ADD_PYTHONPATH = $(SPACK_WEAVE_VIEW)/lib/python3.9/site-packages:$(WEAVE_DEVELOP_VENV)/lib/python3.9/site-packages | ||
|
||
define do_create_env | ||
source $(WEAVE_DEVELOP_VENV)/bin/activate && \ | ||
$(PYTHON_CMD) -m venv --system-site-packages $1 && \ | ||
deactivate | ||
echo export PATH=$(PATH):$(ADD_PATH) >> $1/bin/activate | ||
echo export PYTHONPATH=$(PYTHONPATH):$(ADD_PYTHONPATH) >> $1/bin/activate | ||
source $1/bin/activate && \ | ||
which pytest && \ | ||
pip list | ||
endef | ||
|
||
define run_pydv_tests | ||
# call from the top repository directory | ||
# arg1: full path to venv | ||
source $1/bin/activate && which pip && which pytest && | ||
if [ -z $(DISPLAY) ]; then | ||
xvfb-run --auto-servernum pytest --capture=tee-sys -v tests/; | ||
else | ||
pytest --capture=tee-sys -v tests/; | ||
source $1/bin/activate && which pip && which pytest && \ | ||
if [ -z $(DISPLAY) ]; then \ | ||
xvfb-run --auto-servernum pytest --capture=tee-sys -v tests/; \ | ||
else \ | ||
pytest --capture=tee-sys -v tests/; \ | ||
fi | ||
endef | ||
|
||
define do_run_rz_tests | ||
cd $(RZ_TESTS_WORKDIR) && rm -rf pydv && | ||
/usr/tce/bin/git clone -b $(CI_COMMIT_BRANCH) $(RZ_GITLAB)/$(PROJECT) && | ||
chgrp -R weavedev pydv && cd pydv && | ||
$(call create_env,$(PYDV_ENV)) && | ||
cd tests && ln -s /usr/gapps/pydv/dev/tests/wsc_tests . && cd .. && | ||
$(call run_pydv_tests,$(RZ_TESTS_WORKDIR)/pydv/$(PYDV_ENV)) && | ||
source $(RZ_TESTS_WORKDIR)/pydv/$(PYDV_ENV)/bin/activate && | ||
if [ -z $(DISPLAY) ]; then | ||
xvfb-run --auto-servernum python3 -m pytest tests/wsc_tests/test_*py | ||
else | ||
python3 -m pytest -v tests/wsc_tests/test_*py | ||
# arg1: full path to venv | ||
source $1/bin/activate && pip list && pwd | ||
cd tests && ln -s /usr/gapps/pydv/dev/tests/wsc_tests . && cd .. | ||
if [ -z $(DISPLAY) ]; then \ | ||
xvfb-run --auto-servernum python3 -m pytest tests/wsc_tests/test_*py; \ | ||
else \ | ||
python3 -m pytest -v tests/wsc_tests/test_*py; \ | ||
fi | ||
endef | ||
|
||
.PHONY: create_env | ||
create_env: | ||
@echo "Create venv for running pydv...$(WORKSPACE)"; | ||
@[ -d $(WORKSPACE) ] || mkdir -p $(WORKSPACE); | ||
cd $(WORKSPACE); | ||
if [ -d $(PYDV_ENV) ]; then \ | ||
rm -rf $(PYDV_ENV); \ | ||
fi; | ||
$(call create_env,$(PYDV_ENV)) | ||
$(call do_create_env,$(PYDV_ENV)) | ||
|
||
|
||
.PHONY: run_tests | ||
run_tests: | ||
@echo "Run tests..."; | ||
$(call run_pydv_tests,$(WORKSPACE)/$(PYDV_ENV)) | ||
$(call run_pydv_tests,$(PYDV_ENV)) | ||
|
||
|
||
.PHONY: run_rz_tests | ||
.ONESHELL: | ||
run_rz_tests: | ||
@echo "Run RZ tests...RZ_TESTS_WORKDIR: $(RZ_TESTS_WORKDIR)"; | ||
xsu weaveci -c "umask 007 && sg weavedev -c '$(call do_run_rz_tests)'" | ||
echo "Run RZ tests...RZ_TESTS_WORKDIR: $(RZ_TESTS_WORKDIR)" | ||
$(call do_run_rz_tests,$(PYDV_ENV)) | ||
|
||
|
||
.PHONY: release | ||
release: | ||
@echo "...create a release....TAG: $(CI_COMMIT_TAG), PKG_REGISTRY_URL: $(PKG_REGISTRY_URL)"; \ | ||
$(eval TAG=$(shell echo $(CI_COMMIT_TAG) | sed -e "s/^pydv-//")) | ||
$(eval TAG=$(shell echo $(CI_COMMIT_TAG) | sed -e "s/^pydv-//")) \ | ||
env; \ | ||
$(CI_UTILS)/bin/release-cli create --name "PyDV $(CI_COMMIT_TAG)" --tag-name $(CI_COMMIT_TAG); \ | ||
tar -cvf $(TAG).tar pydv; \ | ||
tar -cvf $(TAG).tar pydv docs; \ | ||
ls; \ | ||
gzip $(TAG).tar; \ | ||
curl --header "JOB-TOKEN: $(CI_JOB_TOKEN)" --upload-file $(TAG).tar.gz $(PKG_REGISTRY_URL)/$(CI_COMMIT_TAG)/$(TAG).tar.gz | ||
|
||
.PHONY: deploy | ||
.ONESHELL: | ||
deploy: | ||
@echo "...deploy...only run from CI... "; \ | ||
@echo "...deploy...only run from CI... "; | ||
$(eval TAG=$(shell echo $(CI_COMMIT_TAG) | sed -e "s/^pydv-//")) | ||
wget --header="JOB-TOKEN:$(CI_JOB_TOKEN)" $(PKG_REGISTRY_URL)/$(CI_COMMIT_TAG)/$(TAG).tar.gz -O $(TAG).tar.gz | ||
give weaveci $(TAG).tar.gz | ||
|
@@ -102,10 +100,10 @@ deploy: | |
tar -xvf $(TAG).tar | ||
rm $(TAG).tar | ||
mv pydv $(TAG) | ||
mv docs $(TAG) | ||
chmod -R 750 $(TAG) | ||
rm -f current | ||
ln -s $(TAG) current | ||
sed -i 's|python|$(PYTHON_CMD)|' $(TAG)/pdv | ||
AS_WEAVECI_USER | ||
|
||
|
||
|
@@ -114,20 +112,19 @@ deploy: | |
deploy_to_develop: | ||
$(eval VERSION=`cat $(CI_PROJECT_DIR)/pydv/scripts/version.txt`) | ||
echo "...deploy_to_develop...VERSION: $(VERSION)" | ||
cd pydv && if [ -d __pycache__ ]; then rm -rf __pycache__; fi | ||
if [ -f $(VERSION).tar.gz ]; then rm -f $(VERSION).tar.gz; fi | ||
tar -cvf $(VERSION).tar * && gzip $(VERSION).tar | ||
cd pydv && rm -rf __pycache__ | ||
rm -f $(VERSION).tar.gz | ||
tar -cvf $(VERSION).tar * ../docs && gzip $(VERSION).tar | ||
give --force weaveci $(VERSION).tar.gz | ||
$(eval GIVE_USER=$(shell echo ${USER})) | ||
xsu weaveci -c "sg us_cit" <<AS_WEAVECI_USER | ||
umask 027 | ||
cd $(DEPLOY_PATH) | ||
if [ ! -d $(DEPLOY_PATH)/develop ]; then mkdir -p $(DEPLOY_PATH)/develop; fi | ||
mkdir -p $(DEPLOY_PATH)/develop | ||
cd $(DEPLOY_PATH)/develop | ||
take $(GIVE_USER) -f | ||
gunzip $(VERSION).tar.gz | ||
tar -xvf $(VERSION).tar && rm $(VERSION).tar | ||
cd .. && chmod -R 750 develop | ||
sed -i 's|python|$(PYTHON_CMD)|' develop/pdv | ||
AS_WEAVECI_USER | ||
|
File renamed without changes.
Oops, something went wrong.