From 3f12e397e3e7def89416f0363edd20ec3da39c84 Mon Sep 17 00:00:00 2001 From: Your Name <you@example.com> Date: Sun, 19 Jan 2025 16:05:01 +0100 Subject: [PATCH] include doc --- .gitlab-ci.yml | 22 ++++++++++++++++++++++ install_and_test.md | 24 +++++++----------------- test_bulk.bash | 2 ++ test_checkup.bash | 1 + test_editable.bash | 8 ++++++++ test_install_octree.bash | 2 ++ test_pip_all.bash | 7 +++++++ 7 files changed, 49 insertions(+), 17 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100755 test_bulk.bash create mode 100755 test_checkup.bash create mode 100755 test_editable.bash create mode 100755 test_install_octree.bash create mode 100755 test_pip_all.bash diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..259af50 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,22 @@ +before_script: + - | + docker build --build-arg CACHE_BUSTER=$(openssl rand -hex 12) --build-arg USER=${CI_REGISTRY_USER} --build-arg PASS=${CI_JOB_TOKEN} -t hwmd -f - . <<EOF + FROM debian:latest + ENV DEBIAN_FRONTEND=noninteractive + RUN apt-get update + RUN apt-get install -y bash git gcc-12 openmpi-bin libopenmpi-dev build-essential python3 pip indent + RUN rm /usr/lib/python*/EXTERNALLY-MANAGED + RUN pip install -U autopep8 Jinja2 numpy PyYAML libclang + ENV HW_FLAGS="-Wl,--no-as-needed" + ENV MPIRUN='mpirun --allow-run-as-root -n 2' + ENV OMP_NUM_THREADS=2 + ARG USER + ARG PASS + RUN git config --global url."https://\${USER}:\${PASS}@www.ict.inaf.it/gitlab".insteadOf ssh://git@git.ia2.inaf.it + WORKDIR /app + COPY . /app + EOF + +testing: + script: + - docker run hwmd bash -c './test_install_octree.bash; ./test_checkup.bash; ./test_pip_all.bash; ./test_editable.bash; ./test_bulk.bash' \ No newline at end of file diff --git a/install_and_test.md b/install_and_test.md index 4449a02..e5cadec 100644 --- a/install_and_test.md +++ b/install_and_test.md @@ -9,7 +9,7 @@ For the user that is not going to edit the code and is only interested in runnin For instance, to perform a simulation with particle mesh one can execute: ```bash -pip install 'hotwheels_PM[tested] @ git+ssh://git@git.ia2.inaf.it/hotwheels/PM.git@v0.0.0alpha' +::include{file=test_install_octree.bash} ``` This will install also the following hotwheels packages: core, io, timestep. @@ -20,7 +20,7 @@ The `[tested]` tag will install the versions of the dependencies used to test th To run the C and python tests of the installed `hotwheels` components, run: ```bash -python -m hotwheels.checkup hotwheels +::include{file=test_checkup.bash} ``` Here below some relevant environment variables to change hotwheels default settings: @@ -46,10 +46,7 @@ Here below some relevant environment variables to change hotwheels default setti In case you want to run the module with other `hotwheel` component version you can install each manually: ```bash -pip install git+ssh://git@git.ia2.inaf.it/hotwheels/core.git@v0.0.0alpha -pip install git+ssh://git@git.ia2.inaf.it/hotwheels/io.git@v0.0.0alpha -pip install git+ssh://git@git.ia2.inaf.it/hotwheels/timestep.git@v0.0.0alpha -pip install git+ssh://git@git.ia2.inaf.it/hotwheels/PM.git@v0.0.0alpha +::include{file=test_pip_all.bash} ``` ## If you need to put hands on the source code @@ -58,14 +55,7 @@ In case you find that you need to edit the source code of hotwheels (maybe you f can re-install a python module in **editable mode (use -e in pip install)**. For instance, let's suppose that now you need to edit the timestep module and re-run all tests. You can do the following ```bash -git clone ssh://git@git.ia2.inaf.it/hotwheels/timestep.git -cd timestep -# very IMPORTANT the -e will install in editable mode -pip install -e . -# -# edit the files of your choice. Edits will take effect -# without the need of re-installing the package -# +::include{file=test_editable.bash} ``` ## Bulk install of all modules @@ -73,11 +63,11 @@ pip install -e . In case you need to work on many modules, you can clone and install all default packages with the [cloneall.bash](cloneall.bash) script: ```bash -wget https://www.ict.inaf.it/gitlab/hotwheels/gitlab-profile/-/raw/main/cloneall.bash -bash cloneall.bash -c # will clone all hotwheels modules +::include{file=test_editable.bash} ``` -If you want to create a folder with all the modules soft-linked into the folder `hotwheels/*`, add the flag `-l` to `cloneall.bash` to get this folder tree in a folder named `full/hotwheels/*`. This is helpful in navigating the files with the IDE when development has strong refactoring and one need to edit multiple modules. +If you want to create a folder with all the modules soft-linked into the folder `hotwheels/*`, add the flag `-l` to `cloneall.bash` to get this folder tree in a folder named `full/hotwheels/*`. +This is helpful in navigating the files with the IDE when development has strong refactoring and one need to edit multiple modules. If you want to also create a multi-windows tmux session where each panel corresponds to a hotwheels module add the flag `-t` to `cloneall.bash` (will laso include the folder `full` if exists). diff --git a/test_bulk.bash b/test_bulk.bash new file mode 100755 index 0000000..b7eface --- /dev/null +++ b/test_bulk.bash @@ -0,0 +1,2 @@ +wget https://www.ict.inaf.it/gitlab/hotwheels/gitlab-profile/-/raw/main/cloneall.bash +bash cloneall.bash -c # will clone all hotwheels modules diff --git a/test_checkup.bash b/test_checkup.bash new file mode 100755 index 0000000..baa3397 --- /dev/null +++ b/test_checkup.bash @@ -0,0 +1 @@ +python3 -m hotwheels_core.checkup hotwheels_io diff --git a/test_editable.bash b/test_editable.bash new file mode 100755 index 0000000..42fe3c7 --- /dev/null +++ b/test_editable.bash @@ -0,0 +1,8 @@ +git clone ssh://git@git.ia2.inaf.it/hotwheels/timestep.git +cd timestep +# very IMPORTANT the -e will install in editable mode +pip install -e . +# +# edit the files of your choice. Edits will take effect +# without the need of re-installing the package +# diff --git a/test_install_octree.bash b/test_install_octree.bash new file mode 100755 index 0000000..0e98471 --- /dev/null +++ b/test_install_octree.bash @@ -0,0 +1,2 @@ +pip install 'hotwheels_io[tested] @ git+ssh://git@git.ia2.inaf.it/hotwheels/io.git@v0.0.2alpha' + diff --git a/test_pip_all.bash b/test_pip_all.bash new file mode 100755 index 0000000..356cabb --- /dev/null +++ b/test_pip_all.bash @@ -0,0 +1,7 @@ +pip install git+ssh://git@git.ia2.inaf.it/hotwheels/core.git@v0.0.2alpha +pip install git+ssh://git@git.ia2.inaf.it/hotwheels/io.git@v0.0.2alpha +pip install git+ssh://git@git.ia2.inaf.it/hotwheels/timestep.git@v0.0.2alpha +pip install git+ssh://git@git.ia2.inaf.it/hotwheels/octree.git@v0.0.2alpha +pip install git+ssh://git@git.ia2.inaf.it/hotwheels/domain.git@v0.0.2alpha +pip install git+ssh://git@git.ia2.inaf.it/hotwheels/PM.git@v0.0.2alpha + -- GitLab