1111 - ' .github/workflows/README.md'
1212 tags :
1313 - ' v*'
14+
1415 pull_request :
1516 branches :
1617 - release
1718 paths-ignore :
1819 - ' **.md'
1920 - ' docs/**'
2021 - ' LICENSE'
22+
2123 workflow_dispatch :
2224
2325jobs :
2830 permissions :
2931 contents : read
3032 packages : write
33+
3134 strategy :
3235 fail-fast : false
3336 matrix :
@@ -51,27 +54,20 @@ jobs:
5154 CIBW_DEBUG : " 1"
5255 CIBW_PRERELEASE_PYTHONS : " True"
5356
54- # Build selection (from ARM workflow; keep if you want same set on x86)
55- CIBW_SKIP : " pp*"
56- CIBW_BUILD : " cp38-* cp39-* cp310-* cp311-* cp312-*"
57-
58- # Host cache from your original workflow
57+ # Linux host cache used by your original workflow (still fine on x86)
5958 HOST_CACHE_DIR : " /tmp/cibw_cache"
6059
61- # ARM portable baseline flags (used only in ARM build step)
62- PORTABLE_FLAGS : " -O3 -march=armv8-a -mtune=generic -flto"
63-
64- # Pin images for ARM (used only in ARM build step)
65- CIBW_MANYLINUX_AARCH64_IMAGE : " manylinux_2_28"
66- CIBW_MUSLLINUX_AARCH64_IMAGE : " musllinux_1_2"
60+ # ARM workflow defaults
61+ CIBW_SKIP : " pp*"
62+ CIBW_BUILD : " cp38-* cp39-* cp310-* cp311-* cp312-*"
6763
6864 steps :
6965 - name : Checkout code
7066 uses : actions/checkout@v4
7167 with :
7268 fetch-depth : 0
7369
74- # FIX: do NOT force x64; let runner arch decide (works on ARM + x86 )
70+ # FIX: do not force x64 architecture (breaks ARM)
7571 - name : Set up Python (host)
7672 uses : actions/setup-python@v5
7773 with :
@@ -82,50 +78,43 @@ jobs:
8278 python -m pip install --upgrade pip
8379 pip install cibuildwheel
8480
85- - name : Cache cibuildwheel artifacts (Linux host cache)
81+ # Keep your original linux cache (works for both, but mostly helps x86 job)
82+ - name : Cache cibuildwheel artifacts (Linux)
8683 if : runner.os == 'Linux'
8784 uses : actions/cache@v4
8885 with :
8986 path : ${{ env.HOST_CACHE_DIR }}
9087 key : ${{ runner.os }}-${{ runner.arch }}-cibw-cache-RocksDB-${{ env.ROCKSDB_VERSION }}
9188
92- # ARM-only: RocksDB build cache (your .tar.gz store)
89+ # -----------------------
90+ # ARM-only: RocksDB cache
91+ # -----------------------
9392 - name : Cache RocksDB builds (ARM)
9493 if : matrix.cibw_archs_linux == 'aarch64'
9594 uses : actions/cache@v4
9695 with :
9796 path : .cibw-rocksdb-cache
9897 key : >-
9998 rocksdb-${{ runner.os }}-linux-arch=${{ matrix.cibw_archs_linux }}-v=${{ env.ROCKSDB_VERSION }}
100- -manylinux=${{ env.CIBW_MANYLINUX_AARCH64_IMAGE }} -musllinux=${{ env.CIBW_MUSLLINUX_AARCH64_IMAGE }}
101- -flags=${{ env.PORTABLE_FLAGS }}
99+ -manylinux=manylinux_2_28 -musllinux=musllinux_1_2
100+ -flags=-O3_-march=armv8-a_-mtune=generic_-flto
102101 restore-keys : |
103102 rocksdb-${{ runner.os }}-linux-arch=${{ matrix.cibw_archs_linux }}-v=${{ env.ROCKSDB_VERSION }}-
104103
105- # -----------------------
106- # Build wheels (non-ARM)
107- # -----------------------
108- - name : Build wheels (non-ARM)
109- if : matrix.cibw_archs_linux != 'aarch64'
104+ - name : Build wheels
110105 env :
106+ # build correct Linux arch per runner
111107 CIBW_ARCHS_LINUX : ${{ matrix.cibw_archs_linux }}
112- CIBW_ENVIRONMENT : >-
113- PYREX_VERSION='${{ env.PYREX_VERSION }}'
114- ROCKSDB_VERSION='${{ env.ROCKSDB_VERSION }}'
115- run : cibuildwheel --output-dir wheelhouse
116108
117- # -----------------------
118- # Build wheels (ARM)
119- # -----------------------
120- - name : Build wheels (ARM aarch64)
121- if : matrix.cibw_archs_linux == 'aarch64'
122- env :
123- CIBW_ARCHS_LINUX : " aarch64"
109+ # ARM-specific images/flags (empty on x86)
110+ CIBW_MANYLINUX_AARCH64_IMAGE : ${{ matrix.cibw_archs_linux == 'aarch64' && 'manylinux_2_28' || '' }}
111+ CIBW_MUSLLINUX_AARCH64_IMAGE : ${{ matrix.cibw_archs_linux == 'aarch64' && 'musllinux_1_2' || '' }}
112+ PORTABLE_FLAGS : ${{ matrix.cibw_archs_linux == 'aarch64' && '-O3 -march=armv8-a -mtune=generic -flto' || '' }}
124113
125- # Use docker and mount cache directory into container
126- CIBW_CONTAINER_ENGINE : " docker; create-args: --network=host -v ${{ github.workspace }} /.cibw-rocksdb-cache:/cibw-cache"
114+ # ARM-only: mount cache into container
115+ CIBW_CONTAINER_ENGINE : ${{ matrix.cibw_archs_linux == 'aarch64' && format(' docker; create-args: --network=host -v {0} /.cibw-rocksdb-cache:/cibw-cache', github.workspace) || '' }}
127116
128- # Make sure these are present in the container env
117+ # pass versions into your build
129118 CIBW_ENVIRONMENT : >-
130119 PYREX_VERSION='${{ env.PYREX_VERSION }}'
131120 ROCKSDB_VERSION='${{ env.ROCKSDB_VERSION }}'
@@ -135,22 +124,20 @@ jobs:
135124 CFLAGS="${{ env.PORTABLE_FLAGS }}"
136125 CXXFLAGS="${{ env.PORTABLE_FLAGS }}"
137126 LDFLAGS="-flto"
138- CC=clang
139- CXX=clang++
140- CMAKE_PREFIX_PATH="/opt/rocksdb"
141- CPPFLAGS="-I/opt/rocksdb/include $CPPFLAGS"
142- LDFLAGS="-L/opt/rocksdb/lib $LDFLAGS"
143- LD_LIBRARY_PATH="/opt/rocksdb/lib:$LD_LIBRARY_PATH"
144- PKG_CONFIG_PATH="/opt/rocksdb/lib/pkgconfig:$PKG_CONFIG_PATH"
145127
128+ # ARM-only: your cached RocksDB builder/restorer (no-op on x86)
146129 CIBW_BEFORE_ALL_LINUX : |
130+ if [ "${{ matrix.cibw_archs_linux }}" != "aarch64" ]; then
131+ echo "Non-ARM build: skipping ARM RocksDB bootstrap."
132+ exit 0
133+ fi
134+
147135 set -euxo pipefail
148136
149137 ARCH="aarch64"
150138 PREFIX="/opt/rocksdb"
151139 FLAGS="${PORTABLE_FLAGS}"
152140
153- # Separate caches for glibc (manylinux) vs musl (musllinux)
154141 if [ -f /etc/alpine-release ]; then
155142 LIBC="musl"
156143 IMAGE_TAG="${CIBW_MUSLLINUX_AARCH64_IMAGE:-musllinux_unknown}"
@@ -172,7 +159,6 @@ jobs:
172159
173160 echo "ℹ️ No cache found. Building RocksDB and caching..."
174161
175- # Install deps
176162 if [ "${LIBC}" = "musl" ]; then
177163 apk add --no-cache \
178164 bash build-base clang clang-dev cmake git ninja \
@@ -294,6 +280,7 @@ jobs:
294280 needs : test_wheels
295281 runs-on : ubuntu-latest
296282 if : github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v')
283+
297284 permissions :
298285 contents : read
299286 id-token : write
0 commit comments