diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index 65ed21ae..c8832647 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -155,7 +155,13 @@ jobs: sh -euc '\ mkdir -p /app && cd /app && tar xf - && \ mix deps.get && \ - cp -a /opt/exla-cache/cache /app/deps/exla/cache && \ + if [ -d /opt/exla-cache/cache/0.13.0 ]; then \ + rm -rf /app/deps/exla/cache && \ + cp -a /opt/exla-cache/cache /app/deps/exla/cache; \ + echo "Restored pre-built EXLA cache"; \ + else \ + echo "No pre-built EXLA cache found, will compile from source"; \ + fi && \ mix ecto.create --quiet && \ mix ecto.migrate --quiet && \ mix test' diff --git a/Dockerfile.ci b/Dockerfile.ci index baee63e1..1cb36852 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -34,9 +34,11 @@ COPY vendor /tmp/exla_warm/vendor RUN mkdir -p /tmp/exla_warm/config && \ printf 'import Config\nconfig :nx, :default_backend, EXLA.Backend\n' > /tmp/exla_warm/config/config.exs -# Compile all deps. EXLA's cached_make downloads the XLA archive, compiles -# the C++ NIF, and caches libexla.so at ~/.cache/xla/exla/{key}/. -RUN mix deps.get && mix deps.compile +# Compile all deps. DEBUG=1 tells the EXLA Makefile to use -g instead +# of -O3 — this avoids the heavy optimization passes that OOM-kill g++ +# on low-memory CI runners. MAKEFLAGS=-j1 serializes make jobs. The +# resulting unoptimized NIF is fine for tests. +RUN MAKEFLAGS="-j1" DEBUG=1 mix deps.get && MAKEFLAGS="-j1" DEBUG=1 mix deps.compile # Save the full build cache (libexla.so + .o files + xla_extension lib) # so Make finds all targets already built when restored in the test step.