Skip to content

Commit a6261c8

Browse files
committed
ci: test macOS HVF runtime on fork
1 parent caae9bf commit a6261c8

1 file changed

Lines changed: 106 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,109 @@ jobs:
259259
path: build/scan-build
260260
retention-days: 7
261261
if-no-files-found: ignore
262+
runtime-macos:
263+
name: Runtime (macOS Apple Silicon, HVF)
264+
needs: build-macos
265+
if: >
266+
github.event_name == 'push' ||
267+
(github.event_name == 'pull_request' &&
268+
github.event.pull_request.head.repo.full_name == github.repository &&
269+
contains(github.event.pull_request.labels.*.name, 'ci-hvf'))
270+
runs-on: [self-hosted, macOS, arm64, hvf]
271+
timeout-minutes: 60
272+
273+
concurrency:
274+
group: runtime-macos-${{ github.ref }}
275+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
276+
277+
env:
278+
LINUX_TOOLCHAIN: /opt/toolchain/aarch64-linux-gnu
279+
GNU_OBJCOPY: /opt/homebrew/opt/binutils/bin/objcopy
280+
HOMEBREW_NO_INSTALL_CLEANUP: 1
281+
HOMEBREW_NO_AUTO_UPDATE: 1
282+
BREW_PKGS: binutils qemu
283+
284+
steps:
285+
- name: Checkout
286+
uses: actions/checkout@v6
287+
288+
- name: Host info
289+
run: |
290+
sw_vers
291+
uname -a
292+
uname -m
293+
sysctl kern.hv_support || true
294+
test "$(uname -m)" = "arm64"
295+
296+
- name: Cache Homebrew downloads
297+
uses: actions/cache@v5
298+
with:
299+
path: ~/Library/Caches/Homebrew/downloads
300+
key: brew-runtime-${{ runner.os }}-${{ runner.arch }}-${{ env.BREW_PKGS }}
301+
302+
- name: Install missing Homebrew packages
303+
run: |
304+
missing=()
305+
306+
for pkg in $BREW_PKGS; do
307+
if ! brew list --formula "$pkg" >/dev/null 2>&1; then
308+
missing+=("$pkg")
309+
fi
310+
done
311+
312+
if [ "${#missing[@]}" -gt 0 ]; then
313+
brew install --quiet "${missing[@]}"
314+
else
315+
echo "All Homebrew packages are already installed: $BREW_PKGS"
316+
fi
317+
318+
- name: Tool versions
319+
run: |
320+
command -v make
321+
command -v "$GNU_OBJCOPY"
322+
make -V .MAKE.VERSION 2>/dev/null || true
323+
"$GNU_OBJCOPY" --version | head -1
324+
qemu-aarch64 --version | head -1 || true
325+
python3 --version
326+
327+
- name: Check Rosetta for Linux
328+
run: |
329+
ROSETTA=/Library/Apple/usr/libexec/oah/RosettaLinux/rosetta
330+
331+
if [ ! -x "$ROSETTA" ]; then
332+
echo "::error::Rosetta for Linux runtime was not found at $ROSETTA"
333+
echo
334+
echo "Install Rosetta on the self-hosted Mac runner first:"
335+
echo " sudo softwareupdate --install-rosetta --agree-to-license"
336+
echo
337+
echo "Current /Library/Apple/usr/libexec/oah contents:"
338+
ls -R /Library/Apple/usr/libexec/oah || true
339+
exit 1
340+
fi
341+
342+
ls -l "$ROSETTA"
343+
344+
- name: Build elfuse
345+
run: |
346+
make elfuse
347+
348+
- name: Verify HVF entitlement is embedded
349+
run: |
350+
codesign -d --entitlements - build/elfuse 2>&1 \
351+
| grep -q 'com\.apple\.security\.hypervisor'
352+
353+
- name: test-hello
354+
run: |
355+
make test-hello
356+
357+
- name: test-multi-vcpu
358+
run: |
359+
make test-multi-vcpu
360+
361+
- name: make check
362+
run: |
363+
make check
364+
365+
- name: Test matrix
366+
run: |
367+
bash tests/test-matrix.sh all

0 commit comments

Comments
 (0)