Skip to content

chore(ci): temporary memory probe for the app build heap ceiling #1

chore(ci): temporary memory probe for the app build heap ceiling

chore(ci): temporary memory probe for the app build heap ceiling #1

Workflow file for this run

name: Memory Probe
# Throwaway diagnostic. Builds only the app.Dockerfile builder stage (the stage
# that OOM-killed) on a GitHub-hosted runner across heap ceilings, sampling peak
# memory. 8192 is the control: it must fail, or a pass at 4096 proves nothing.
# Delete this file and the ci-memtest branch once the number is settled.
on:
push:
branches: [ci-memtest]
permissions:
contents: read
jobs:
probe:
name: Build @ ${{ matrix.heap }} MB
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
heap: [8192, 6144, 4096]
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Runner specs
run: |
echo "nproc: $(nproc)"
free -h
echo "MemTotal: $(awk '/MemTotal/{printf "%.2f GiB\n", $2/1048576}' /proc/meminfo)"
- name: Start memory sampler
run: |
nohup sh -c 'while true; do
awk "/MemTotal/{t=\$2} /MemAvailable/{a=\$2} END{printf \"%d\n\", (t-a)/1024}" /proc/meminfo
sleep 3
done' > /tmp/mem-samples.log 2>/dev/null &
echo "sampler_pid=$!" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4
- name: Build builder stage
id: build
continue-on-error: true
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7
with:
context: .
file: ./docker/app.Dockerfile
target: builder
platforms: linux/amd64
push: false
build-args: NEXT_BUILD_HEAP_MB=${{ matrix.heap }}
provenance: false
sbom: false
- name: Report
run: |
kill "${sampler_pid}" 2>/dev/null || true
PEAK=$(sort -n /tmp/mem-samples.log | tail -1)
echo "heap_ceiling_mb=${{ matrix.heap }}"
echo "build_outcome=${{ steps.build.outcome }}"
echo "peak_used_mb=${PEAK}"
{
echo "| heap MB | outcome | peak used MB |"
echo "|---|---|---|"
echo "| ${{ matrix.heap }} | ${{ steps.build.outcome }} | ${PEAK} |"
} >> $GITHUB_STEP_SUMMARY