Skip to content

Commit a3ececc

Browse files
committed
ci(cross-compilation): add swap space and limit jobs for LTO memory usage
- Add 8GB swap space for Linux cross-compilation to handle LTO memory needs - Limit CARGO_BUILD_JOBS to 2 to reduce peak RAM usage during whisper-rs LTO builds - Applied to both agent_engine_build.yml and agent_engine_release.yml workflows
1 parent 3ddd556 commit a3ececc

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

.github/workflows/agent_engine_build.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ jobs:
9999
if: startsWith(matrix.os, 'macos')
100100
run: brew install llvm
101101

102+
- name: Add swap space (Linux cross-compilation needs extra RAM for LTO)
103+
if: matrix.cross
104+
run: |
105+
sudo fallocate -l 8G /swapfile
106+
sudo chmod 600 /swapfile
107+
sudo mkswap /swapfile
108+
sudo swapon /swapfile
109+
free -h
110+
102111
- name: setup cross-rs
103112
if: matrix.cross
104113
run: |
@@ -134,6 +143,9 @@ jobs:
134143
135144
- name: build linux-like artifacts
136145
if: matrix.cross
146+
env:
147+
# Limit parallel codegen/link jobs to reduce peak RAM (LTO + whisper-rs is very memory-hungry)
148+
CARGO_BUILD_JOBS: 2
137149
run: |
138150
CROSS_NO_WARNINGS=0 cross test --release --target ${{ matrix.target }} || exit 1
139151
CROSS_NO_WARNINGS=0 cross build --release --target ${{ matrix.target }} || exit 1

.github/workflows/agent_engine_release.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ jobs:
8686
if: startsWith(matrix.os, 'macos')
8787
run: brew install llvm
8888

89+
- name: Add swap space (Linux cross-compilation needs extra RAM for LTO)
90+
if: matrix.cross
91+
run: |
92+
sudo fallocate -l 8G /swapfile
93+
sudo chmod 600 /swapfile
94+
sudo mkswap /swapfile
95+
sudo swapon /swapfile
96+
free -h
97+
8998
- name: setup cross-rs
9099
if: matrix.cross
91100
run: |
@@ -121,6 +130,9 @@ jobs:
121130
122131
- name: build linux-like artifacts
123132
if: matrix.cross
133+
env:
134+
# Limit parallel codegen/link jobs to reduce peak RAM (LTO + whisper-rs is very memory-hungry)
135+
CARGO_BUILD_JOBS: 2
124136
run: |
125137
CROSS_NO_WARNINGS=0 cross test --release --target ${{ matrix.target }} || exit 1
126138
CROSS_NO_WARNINGS=0 cross build --release --target ${{ matrix.target }} || exit 1

0 commit comments

Comments
 (0)