From 56d9a1e26f4890efa8b4ceb092e45256fd906093 Mon Sep 17 00:00:00 2001 From: Antonio Leblanc Date: Tue, 3 Nov 2026 13:12:55 -0300 Subject: [PATCH] tools: move repo infrastructure to scripts/ and the ANN test source to tests/runANN tools/ is left with what users run (pre/post-processing, the MesoNH case, htdocs, wildfire_ROS_models). The LFS checks and the manylinux NetCDF install are called by CMake, CI and cibuildwheel, never by hand. The Docker builder no longer copies tools/: it now passes -DFOREFIRE_BUILD_TOOLS=OFF, so ANN_test's source is not needed there. --- .github/workflows/main.yml | 2 +- CMakeLists.txt | 4 ++-- Dockerfile | 10 ++++------ pyproject.toml | 2 +- {tools => scripts}/check_all_lfs.bash | 0 {tools/devops => scripts}/install-netcdf-manylinux.sh | 0 {tools/preflight => scripts}/verify-lfs.sh | 2 +- tests/README.md | 2 +- {tools => tests}/runANN/ANNTest.cpp | 0 9 files changed, 10 insertions(+), 12 deletions(-) rename {tools => scripts}/check_all_lfs.bash (100%) rename {tools/devops => scripts}/install-netcdf-manylinux.sh (100%) rename {tools/preflight => scripts}/verify-lfs.sh (95%) rename {tools => tests}/runANN/ANNTest.cpp (100%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 652adde7..e76138ae 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,7 +35,7 @@ jobs: - name: Verify LFS test asset (data.nc) run: | - bash ./tools/preflight/verify-lfs.sh + bash ./scripts/verify-lfs.sh - name: Install Dependencies (Build + Test) run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 883658e7..5cb6ad23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -343,7 +343,7 @@ endif() # Test Executable # ---------------------------------- if(FOREFIRE_BUILD_TOOLS) - add_executable(ANN_test tools/runANN/ANNTest.cpp) + add_executable(ANN_test tests/runANN/ANNTest.cpp) target_link_libraries(ANN_test PRIVATE forefire_netcdf) endif() @@ -479,7 +479,7 @@ if(FOREFIRE_CHECK_LFS) message(STATUS "Running Git LFS data integrity check...") execute_process( - COMMAND bash tools/check_all_lfs.bash + COMMAND bash scripts/check_all_lfs.bash WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} RESULT_VARIABLE LFS_CHECK_RESULT OUTPUT_VARIABLE LFS_CHECK_OUTPUT diff --git a/Dockerfile b/Dockerfile index 8858f716..fc586136 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,20 +25,18 @@ WORKDIR /build # LICENSE is required by CPack at configure time (CMakeLists includes CPack). COPY --link CMakeLists.txt LICENSE pyproject.toml ./ COPY --link app/ ./app/ -# tools/ is needed at configure time: CMakeLists.txt invokes -# tools/check_all_lfs.bash and references tools/runANN/ANNTest.cpp. -COPY --link tools/ ./tools/ COPY --link src/ ./src/ COPY --link third_party/ ./third_party/ # -march=native is off: this image is published and has to run on CPUs other -# than the builder's. The LFS check and the unit tests are off too: tests/ is -# not copied into this stage, so they could only fail. +# than the builder's. The LFS check, the unit tests and ANN_test are off +# too: tests/ and scripts/ are not copied into this stage, so they could only +# fail. # # Only libforefireL.so is carried into the runtime stage, and the wheel build # below compiles the core again on its own terms, so building the `forefire` # and ANN_test executables here as well would just be a wasted compile. -RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DFOREFIRE_NATIVE_ARCH=OFF -DFOREFIRE_CHECK_LFS=OFF -DFOREFIRE_BUILD_TESTS=OFF \ +RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DFOREFIRE_NATIVE_ARCH=OFF -DFOREFIRE_CHECK_LFS=OFF -DFOREFIRE_BUILD_TESTS=OFF -DFOREFIRE_BUILD_TOOLS=OFF \ && cmake --build build -j"$(nproc)" --target forefireL COPY --link bindings/ ./bindings/ diff --git a/pyproject.toml b/pyproject.toml index 907d3474..3efa3aaf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -105,7 +105,7 @@ test-command = [ # x86_64 and aarch64; the C++4 API is built from source by the script below. manylinux-x86_64-image = "manylinux_2_28" manylinux-aarch64-image = "manylinux_2_28" -before-all = "bash {project}/tools/devops/install-netcdf-manylinux.sh" +before-all = "bash {project}/scripts/install-netcdf-manylinux.sh" [tool.cibuildwheel.macos] before-all = "brew install netcdf netcdf-cxx" diff --git a/tools/check_all_lfs.bash b/scripts/check_all_lfs.bash similarity index 100% rename from tools/check_all_lfs.bash rename to scripts/check_all_lfs.bash diff --git a/tools/devops/install-netcdf-manylinux.sh b/scripts/install-netcdf-manylinux.sh similarity index 100% rename from tools/devops/install-netcdf-manylinux.sh rename to scripts/install-netcdf-manylinux.sh diff --git a/tools/preflight/verify-lfs.sh b/scripts/verify-lfs.sh similarity index 95% rename from tools/preflight/verify-lfs.sh rename to scripts/verify-lfs.sh index 344f75ad..0e739746 100644 --- a/tools/preflight/verify-lfs.sh +++ b/scripts/verify-lfs.sh @@ -4,7 +4,7 @@ set -euo pipefail # Minimal preflight check for Git LFS assets used by quick-start tests # Verifies that tests/runff/data.nc is a real NetCDF file (by size) and, if available, via ncdump. -PROJECT_ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd)" +PROJECT_ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)" DATA_FILE_REL="tests/runff/data.nc" DATA_FILE="${PROJECT_ROOT_DIR}/${DATA_FILE_REL}" diff --git a/tests/README.md b/tests/README.md index ff002083..72d9da59 100644 --- a/tests/README.md +++ b/tests/README.md @@ -115,7 +115,7 @@ model — evaluates it over the fuel, slope and wind combinations in `modelrun.csv`, and checks the result. It needs no machine-learning framework. `ANN_test` is a ForeFire tool built -from `tools/runANN/ANNTest.cpp`, and the `.ffann` format is read by ForeFire's +from `tests/runANN/ANNTest.cpp`, and the `.ffann` format is read by ForeFire's own evaluator. The check is the root mean squared error between what the network predicts and diff --git a/tools/runANN/ANNTest.cpp b/tests/runANN/ANNTest.cpp similarity index 100% rename from tools/runANN/ANNTest.cpp rename to tests/runANN/ANNTest.cpp