diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..259af50902f562e8dac183b90138302e34e2f2a3 --- /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 4449a02834f6cc7b023cc075c0135a6fd63e3d59..e5cadec8ab28214689e988cecb2bf3deb9272ab1 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 0000000000000000000000000000000000000000..b7efaceca752fbdbc3b6fd3a965bd2f844c379c5 --- /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 0000000000000000000000000000000000000000..baa3397cfa55fc9dbba96f61e74b6a64ed97cf1f --- /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 0000000000000000000000000000000000000000..42fe3c732542f4a3b9433667cd67c5569c091226 --- /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 0000000000000000000000000000000000000000..0e9847193f13fcad1cb16d8a4c77147d35f2a90d --- /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 0000000000000000000000000000000000000000..356cabb80bd5101d69dc0995e52a6ed18f720aea --- /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 +