Skip to content

Commit 9e90417

Browse files
committed
refactor(mpm): Use cross-rs for arm64 builds instead of QEMU
Replaces Docker buildx + QEMU emulation with cross-rs for cross-compilation. This is much faster (~5 min vs 1+ hour) and avoids QEMU bugs with LTO/linking.
1 parent 3983954 commit 9e90417

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

.github/workflows/publish-mpm.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ jobs:
6666
strategy:
6767
fail-fast: false
6868
matrix:
69-
arch: [amd64, arm64]
7069
include:
7170
- arch: amd64
7271
target: x86_64-unknown-linux-musl
@@ -77,31 +76,33 @@ jobs:
7776
steps:
7877
- uses: actions/checkout@v4
7978

80-
- name: Set up QEMU
81-
uses: docker/setup-qemu-action@v3
79+
- name: Install Rust
80+
uses: dtolnay/rust-toolchain@stable
8281

83-
- name: Set up Docker Buildx
84-
uses: docker/setup-buildx-action@v3
82+
- name: Install cross
83+
run: cargo install cross --git https://github.com/cross-rs/cross
8584

86-
- name: Cache Docker layers
85+
- name: Cache cargo registry
8786
uses: actions/cache@v4
8887
with:
89-
path: /tmp/.buildx-cache
90-
key: ${{ runner.os }}-buildx-${{ matrix.arch }}-${{ hashFiles('utils/mpm/Cargo.lock', 'utils/mpm/Dockerfile') }}
88+
path: |
89+
~/.cargo/registry
90+
~/.cargo/git
91+
utils/mpm/target
92+
key: ${{ runner.os }}-cargo-${{ matrix.arch }}-${{ hashFiles('utils/mpm/Cargo.lock') }}
9193
restore-keys: |
92-
${{ runner.os }}-buildx-${{ matrix.arch }}-
94+
${{ runner.os }}-cargo-${{ matrix.arch }}-
9395
9496
- name: Build static binary
97+
env:
98+
GIT_HASH: ${{ github.sha }}
99+
GIT_DATE: ${{ github.event.head_commit.timestamp }}
100+
CROSS_CONTAINER_IN_CONTAINER: "true"
95101
run: |
96102
cd utils/mpm
97-
TARGETARCH=${{ matrix.arch }} BUILDX_CACHE_DIR=/tmp/.buildx-cache ./build.sh
98-
99-
- name: Move cache
100-
run: |
101-
rm -rf /tmp/.buildx-cache
102-
if [ -d /tmp/.buildx-cache-new ]; then
103-
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
104-
fi
103+
cross build --release --target ${{ matrix.target }}
104+
mkdir -p dist
105+
cp target/${{ matrix.target }}/release/mpm dist/
105106
106107
- name: Get version from tag
107108
id: get_version

0 commit comments

Comments
 (0)