Skip to content

Commit b57572b

Browse files
chore(ci): temporary memory probe for the app build heap ceiling
1 parent 7867d86 commit b57572b

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

.github/workflows/memprobe.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Memory Probe
2+
3+
# Throwaway diagnostic. Builds only the app.Dockerfile builder stage (the stage
4+
# that OOM-killed) on a GitHub-hosted runner across heap ceilings, sampling peak
5+
# memory. 8192 is the control: it must fail, or a pass at 4096 proves nothing.
6+
# Delete this file and the ci-memtest branch once the number is settled.
7+
8+
on:
9+
push:
10+
branches: [ci-memtest]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
probe:
17+
name: Build @ ${{ matrix.heap }} MB
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 45
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
heap: [8192, 6144, 4096]
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
27+
28+
- name: Runner specs
29+
run: |
30+
echo "nproc: $(nproc)"
31+
free -h
32+
echo "MemTotal: $(awk '/MemTotal/{printf "%.2f GiB\n", $2/1048576}' /proc/meminfo)"
33+
34+
- name: Start memory sampler
35+
run: |
36+
nohup sh -c 'while true; do
37+
awk "/MemTotal/{t=\$2} /MemAvailable/{a=\$2} END{printf \"%d\n\", (t-a)/1024}" /proc/meminfo
38+
sleep 3
39+
done' > /tmp/mem-samples.log 2>/dev/null &
40+
echo "sampler_pid=$!" >> $GITHUB_ENV
41+
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4
44+
45+
- name: Build builder stage
46+
id: build
47+
continue-on-error: true
48+
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7
49+
with:
50+
context: .
51+
file: ./docker/app.Dockerfile
52+
target: builder
53+
platforms: linux/amd64
54+
push: false
55+
build-args: NEXT_BUILD_HEAP_MB=${{ matrix.heap }}
56+
provenance: false
57+
sbom: false
58+
59+
- name: Report
60+
run: |
61+
kill "${sampler_pid}" 2>/dev/null || true
62+
PEAK=$(sort -n /tmp/mem-samples.log | tail -1)
63+
echo "heap_ceiling_mb=${{ matrix.heap }}"
64+
echo "build_outcome=${{ steps.build.outcome }}"
65+
echo "peak_used_mb=${PEAK}"
66+
{
67+
echo "| heap MB | outcome | peak used MB |"
68+
echo "|---|---|---|"
69+
echo "| ${{ matrix.heap }} | ${{ steps.build.outcome }} | ${PEAK} |"
70+
} >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)