diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d8fa8bed..54b722c2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,6 @@ -stages: [check] +stages: + - check + - pages variables: COLUMNS: 9000 @@ -15,3 +17,29 @@ check: - export COLUMNS=$COLUMNS - export TERM=$TERM - python3 pmodules_tools/pmodules_tools.py --deps-check + +pages: + stage: pages + artifacts: + paths: + - public + image: ubuntu:20.04 + script: + - apt update + - apt -y install pandoc + - mkdir -p /opt && pushd $_ + - ln -s /afs/psi.ch/sys/psi.x86_64_el6 psi + - popd + + - export PMODULES_VERSION=1.0.0rc14 + - export COLUMNS=$COLUMNS + - export TERM=$TERM + + - source /opt/psi/config/profile.bash + - module load Python + - mkdir public + - cd pmodules_tools/ + - python3 pmodules_tools.py --db-check + - pandoc pmodules_changes.md -o index.html + - cp -v index.html $CI_PROJECT_DIR/public + when: always \ No newline at end of file diff --git a/README.md b/README.md index 9481c5a2..e9ae6b16 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,11 @@ # Pmodules tools -Dependency checker:
[![Pipeline](https://git.psi.ch/Pmodules/dependency-checker/badges/master/pipeline.svg)](https://git.psi.ch/Pmodules/dependency-checker) +## Pages + +[Pmodules Database Report](https://pmodules.gitpages.psi.ch/dependency-checker) + ## Intro A python project to analyse Pmodules modules and their status changes. diff --git a/pmodules_tools/db_diff/check.py b/pmodules_tools/db_diff/check.py index f84b4a8e..7f089722 100644 --- a/pmodules_tools/db_diff/check.py +++ b/pmodules_tools/db_diff/check.py @@ -32,12 +32,14 @@ def db_check_diff(current_pmodule_state, Pmodules_db_path, Pmodules_states): print_pmodules_differences( current_pmodule_state, old_pmodule_state, Pmodules_states ) + else: + print_to_markdown([], [], []) # There is no database available or there are differences with the old pmodule state, writing current state. if no_current_db or compare_states_sha( current_pmodule_state, old_pmodule_state, current_sha ): - write_curent_state(current_pmodule_state, current_sha, Pmodules_db_path) + write_current_state(current_pmodule_state, current_sha, Pmodules_db_path) def compare_states_sha(current_pmodule_state, old_pmodule_state, current_sha): @@ -58,11 +60,11 @@ def print_to_markdown(new_module_list, deleted_module_list, changed_module_list) for index in range(0, len(changed_module_list) - 1, 2): md_file.write( changed_module_list[index] - + "
Changed state from " + + "
Changed state from " + changed_module_list[index + 1].split()[1] + " to ---> " + changed_module_list[index].split()[1] - + "
" + + "
" ) standard_print(md_file, deleted_module_list, "Deleted modules:") @@ -143,10 +145,10 @@ def standard_print(file, module_list, string): file.write("\n# " + string + " \n") for diff in module_list: if diff != "": - file.write(diff + "
") + file.write(diff + "
") -def write_curent_state(current_pmodule_state, current_sha, Pmodules_db_path): +def write_current_state(current_pmodule_state, current_sha, Pmodules_db_path): # Emptying Pmodules database first if os.path.exists(Pmodules_db_path): shutil.rmtree(Pmodules_db_path) diff --git a/pmodules_tools/deps_status/check.py b/pmodules_tools/deps_status/check.py index 5f768c8e..43c9bbe8 100644 --- a/pmodules_tools/deps_status/check.py +++ b/pmodules_tools/deps_status/check.py @@ -72,7 +72,11 @@ class PmodulePackage: @staticmethod @cache def Pmoduliser(pckg_name="", compiler="", mpi_provider=""): - default_module_cmd = "module search " + pckg_name + " -a --all-deps --no-header" + default_module_cmd = ( + "$PMODULES_HOME/bin/modulecmd bash search " + + pckg_name + + " -a --all-deps --no-header" + ) # try to precise the module search if compiler and/or mpi_provider are given module_cmd = default_module_cmd diff --git a/pmodules_tools/pmodules_tools.py b/pmodules_tools/pmodules_tools.py index 1af971c7..ef31cba4 100644 --- a/pmodules_tools/pmodules_tools.py +++ b/pmodules_tools/pmodules_tools.py @@ -43,12 +43,14 @@ def main(): cli_args = parse_args() # Global variables - Pmodules_db_path = "/afs/psi.ch/sys/spack-rhel7/test/" + Pmodules_db_path = "/opt/psi/var/cache/pmodules_db/" Pmodules_states = ["deprecated", "stable", "unstable"] # Main search to analyse module_cmd = ( - "module search -a " + cli_args.select_module + " --all-deps --no-header" + "$PMODULES_HOME/bin/modulecmd bash search -a " + + cli_args.select_module + + " --all-deps --no-header" ) module_cmd_process = subprocess_cmd(module_cmd)