Skip to content

Commit 6d0168e

Browse files
authored
switch to use preview aarch64 linux runners from github (#490)
* switch to use preview aarch64 linux runners from github, * removing qemu step and unused cache step * update cibuildwheel to 2.22 * adding explicit macos-13 to avoid x86_64 cross compilation on arm64 runners for macos * adding some speculative fixes and logging to ensure macos issue is resolved for now
1 parent 3c6b466 commit 6d0168e

File tree

2 files changed

+21
-34
lines changed

2 files changed

+21
-34
lines changed

.github/workflows/publish-to-test-and-live-pypi.yml

+11-32
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ jobs:
5454
matrix:
5555
include:
5656
- config: {"name": "Linux", "os": "ubuntu-latest", "arch": "x86_64"}
57-
- config: {"name": "Linux", "os": "ubuntu-latest", "arch": "aarch64"}
58-
- config: {"name": "macOS", "os": "macos-14", "arch": "x86_64"}
57+
- config: {"name": "Linux", "os": "ubuntu-22.04-arm", "arch": "aarch64"}
58+
- config: {"name": "macOS", "os": "macos-13", "arch": "x86_64"}
5959
- config: {"name": "macOS", "os": "macos-14", "arch": "arm64"}
6060
- config: {"name": "Windows", "os": "windows-latest", "arch": "AMD64"}
6161
name: Build SpiceyPy 🌶️ 🥧 Python 🐍 wheels for ${{ matrix.config.os }} ${{ matrix.config.arch }}
6262
env:
63-
CSPICE_CACHE: 1
63+
CSPICE_CACHE: 2
6464
CIBW_ARCHS: ${{ matrix.config.arch }}
6565
runs-on: ${{ matrix.config.os }}
6666
steps:
@@ -70,26 +70,20 @@ jobs:
7070
if: runner.os == 'Windows'
7171
uses: ilammy/[email protected]
7272
- name: set additional environment variables for macOS arm
73-
if: runner.name == 'macOS' && matrix.config.arch == 'arm64'
73+
if: runner.os == 'macOS' && matrix.config.arch == 'arm64'
7474
run: |
7575
echo "CIBW_ARCHS_MACOS=arm64" >> $GITHUB_ENV
7676
echo "ARCHFLAGS='-arch arm64'" >> $GITHUB_ENV
7777
- name: set additional environment variables for macOS x86
78-
if: runner.name == 'macOS' && matrix.config.arch == 'x86_64'
78+
if: runner.os == 'macOS' && matrix.config.arch == 'x86_64'
7979
run: |
8080
echo "CIBW_ARCHS_MACOS=x86_64" >> $GITHUB_ENV
8181
echo "ARCHFLAGS='-arch x86_64'" >> $GITHUB_ENV
82-
- name: Set up QEMU for arm64 builds
83-
if: matrix.config.arch == 'aarch64'
84-
uses: docker/setup-qemu-action@v3
85-
with:
86-
platforms: all
87-
- name: Cache libcspice.so for aarch64 builds because they take an hour to build with qemu
88-
if: matrix.config.arch == 'aarch64'
89-
uses: actions/cache@v4
90-
with:
91-
path: ./src/spiceypy/utils/libcspice.so
92-
key: ${{ env.CSPICE_CACHE }}-${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ hashFiles('get_spice.py') }}-${{ hashFiles('setup.cfg') }}
82+
- name: set additional environment variables for linux aarch64
83+
if: runner.os == 'Linux' && matrix.config.arch == 'aarch64'
84+
run: |
85+
echo "CIBW_ARCHS_LINUX=aarch64" >> $GITHUB_ENV
86+
echo "ARCHFLAGS='-arch aarch64'" >> $GITHUB_ENV
9387
- name: Set up Python 🐍 3.13
9488
uses: actions/setup-python@v5
9589
with:
@@ -100,28 +94,13 @@ jobs:
10094
run: |
10195
python -m pip install --upgrade pip
10296
python -m pip install -r ci-requirements.txt
103-
python -m pip install cibuildwheel==2.21.3
104-
- name: See if libcspice.so is available from cache
105-
if: matrix.config.arch == 'aarch64'
106-
run: |
107-
pwd
108-
ls src/spiceypy/utils -lahtr
97+
python -m pip install cibuildwheel==2.22.0
10998
- name: Build wheels for SpiceyPy 🌶️ 🥧
11099
timeout-minutes: 120
111100
run: |
112101
env | grep CIBW
113102
env | grep ARCH
114103
python -m cibuildwheel --output-dir wheelhouse
115-
- name: Extract libcspice.so for aarch64 builds
116-
if: matrix.config.arch == 'aarch64'
117-
run: |
118-
pwd
119-
ls -lahtr
120-
ls src/ -lahtr
121-
ls src/spiceypy/ -lahtr
122-
ls src/spiceypy/utils -lahtr
123-
ls wheelhouse/*
124-
unzip -o wheelhouse/spiceypy-\*.whl 'spiceypy/utils/libcspice.so' -d src/
125104
- name: Check dists
126105
run: |
127106
twine check wheelhouse/*

get_spice.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@
103103
# macos builds can occur on x86 or arm64 machines.
104104
# but we need to support cross compilation either way
105105
# so be a little pedantic here
106-
requested_arch_x86 = os.environ.get("ARCHFLAGS", "") == "-arch x86_64"
107-
requested_arch_arm = os.environ.get("ARCHFLAGS", "") == "-arch arm64"
106+
requested_arch_x86 = os.environ.get("ARCHFLAGS", "").strip("'\"") == "-arch x86_64"
107+
requested_arch_arm = os.environ.get("ARCHFLAGS", "").strip("'\"") == "-arch arm64"
108108
# if both are false and on macos do something
109109
if is_macos and (not requested_arch_arm and not requested_arch_x86):
110110
# default to building arm on macos
@@ -119,6 +119,14 @@
119119
spice_version = "N0067"
120120
spice_num_v = "67"
121121

122+
if is_macos:
123+
print(f"On macOS {host_OS}, host arch {host_arch}")
124+
print(f"requested_arch_x86: {requested_arch_x86}")
125+
print(f"requested_arch_arm: {requested_arch_arm}")
126+
print(f"build_macox_x86: {build_macos_x86}")
127+
print(f"build_macos_arm: {build_macos_arm}")
128+
print(f"is_macos_arm: {is_macos_arm}")
129+
122130

123131
class GetCSPICE(object):
124132
"""

0 commit comments

Comments
 (0)