diff --git a/.github/actions/lfs-runff/action.yml b/.github/actions/lfs-runff/action.yml new file mode 100644 index 00000000..4cf45d80 --- /dev/null +++ b/.github/actions/lfs-runff/action.yml @@ -0,0 +1,22 @@ +name: Fetch runff LFS data +description: > + Pulls only the LFS files tests/runff reads (~4 MB of the ~61 MB in LFS), + cached by object id so a run downloads nothing unless they change. + Checkout must run with `lfs: false` first. + +runs: + using: composite + steps: + - name: LFS cache key + id: key + shell: bash + run: echo "key=lfs-runff-$(git lfs ls-files -l -I 'tests/runff/*' | cut -d' ' -f1,3 | git hash-object --stdin)" >> "$GITHUB_OUTPUT" + + - uses: actions/cache@v4 + with: + path: .git/lfs + key: ${{ steps.key.outputs.key }} + + - name: Pull runff LFS data + shell: bash + run: git lfs pull --include="tests/runff/*" diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 353b33ab..22f22bfa 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -23,7 +23,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v6 with: - lfs: true + lfs: false # only tests/runff is needed, fetched below + + - uses: ./.github/actions/lfs-runff - name: Log in to GitHub Container Registry uses: docker/login-action@v3 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 7df9b1ae..a940bfb9 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -15,12 +15,17 @@ jobs: - name: Checkout repository uses: actions/checkout@v6 with: - lfs: true + lfs: false # only tests/runff is needed, fetched below + + - uses: ./.github/actions/lfs-runff - name: Make install script executable run: chmod +x ./install-forefire-osx.sh - name: Build ForeFire using macOS install script + # The LFS check would curl back the LFS files the step above skips. + env: + FOREFIRE_CHECK_LFS: "OFF" run: ./install-forefire-osx.sh - name: Check ForeFire version diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 78ad1131..ff104d63 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v6 with: - lfs: true # we use LFS to store large files (e.g. data.nc) + lfs: false # only tests/runff is needed, fetched below + + - uses: ./.github/actions/lfs-runff - name: Verify LFS test asset (data.nc) run: | @@ -38,7 +40,8 @@ jobs: pip3 install --no-cache-dir lxml xarray netCDF4 - name: ForeFire build - run: sudo bash ./install-forefire.sh -y + # The LFS check would curl back the LFS files the step above skips. + run: sudo env FOREFIRE_CHECK_LFS=OFF bash ./install-forefire.sh -y - name: Check ForeFire version run: ./bin/forefire -v diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.yml index 72248457..f0a204de 100644 --- a/.github/workflows/sanitizers.yml +++ b/.github/workflows/sanitizers.yml @@ -38,7 +38,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v6 with: - lfs: true # runff reads data.nc, which is stored in LFS + lfs: false # only tests/runff is needed, fetched below + + - uses: ./.github/actions/lfs-runff - name: Install Dependencies run: | @@ -53,7 +55,7 @@ jobs: # FOREFIRE_SANITIZE also switches the compile flags to -g -O1 # -fno-omit-frame-pointer, so the stack traces are readable. run: | - cmake -S . -B build-asan -DFOREFIRE_SANITIZE=address + cmake -S . -B build-asan -DFOREFIRE_SANITIZE=address -DFOREFIRE_CHECK_LFS=OFF cmake --build build-asan -j"$(nproc)" # Leaks are blocking here: the unit suite reports none since the model diff --git a/Dockerfile b/Dockerfile index 4dc854d8..7bc291ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,12 +31,13 @@ COPY --link tools/ ./tools/ COPY --link src/ ./src/ # -march=native is off: this image is published and has to run on CPUs other -# than the builder's. +# than the builder's. The LFS check is off too: tests/ is not copied into this +# stage, so it 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 \ +RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DFOREFIRE_NATIVE_ARCH=OFF -DFOREFIRE_CHECK_LFS=OFF \ && cmake --build build -j"$(nproc)" --target forefireL COPY --link bindings/ ./bindings/ diff --git a/tools/check_all_lfs.bash b/tools/check_all_lfs.bash index c578c272..ad28a641 100644 --- a/tools/check_all_lfs.bash +++ b/tools/check_all_lfs.bash @@ -5,6 +5,13 @@ set -e set -o pipefail +# CI fetches only the LFS files its tests read (tests/runff); without this the +# check would curl the other ~57 MB back on every configure. +if [ "${FOREFIRE_CHECK_LFS:-ON}" = "OFF" ]; then + echo "LFS check skipped (FOREFIRE_CHECK_LFS=OFF)" + exit 0 +fi + BASE_URL="https://github.com/forefireAPI/forefire/raw/refs/heads/master" # File list: md5:path