Skip to content

Macos

Macos #3002

Workflow file for this run

# Main doc: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/introduction-to-github-actions
# Runners spec: https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners
# Glob expressions: https://github.com/actions/toolkit/tree/main/packages/glob
name: Macos
###############################################################################
# Schedule:
# - push on any branch whose name matches v** or master
# - any pull request
###############################################################################
on:
push:
branches:
- main
pull_request:
branches:
- "**"
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
inputs:
platform:
description: "Arguments for the platform script:"
required: true
default: "-extent=x -parallel=p -jobs=2 -large=e -compcert=y -set-switch=y"
###############################################################################
# Platform script options shared among all jobs
###############################################################################
env:
PLATFORM_ARGS: -extent=x -parallel=p -jobs=2 -large=e -compcert=y -set-switch=y
COQREGTESTING: y
HOMEBREW_NO_INSTALL_FROM_API:
# See https://github.com/orgs/Homebrew/discussions/4612#discussioncomment-6351357
###############################################################################
# Macos
#
# CAVEATS:
# - COQREGTESTING broken, it makes the script loop, so we install opam by hand
###############################################################################
jobs:
Macos_platform:
name: Macos
runs-on: macos-15
strategy:
fail-fast: false
matrix:
variant:
# Keep this in sync with the Smoke test below
- "9.1~2026.01"
- "9.0~2025.08"
steps:
- name: Setup Xcode 16.0
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "16.0"
- name: Print toolchain info
run: |
sw_vers
xcodebuild -version
xcode-select -p
xcrun --show-sdk-path
xcrun --show-sdk-platform-version || true
- name: Git checkout
uses: actions/checkout@v4
- name: Set PLATFORM
if: ${{ github.event.inputs.platform != '' }}
run: echo "PLATFORM=${{ github.event.inputs.platform }}" >> $GITHUB_ENV
- name: Cleanup, update and upgrade HomeBrew
# This is to avoid errors of these kinds:
# - ==> Downloading https://ghcr.io/v2/homebrew/core/harfbuzz/manifests/5.1.0
# Error: adwaita-icon-theme: Failed to download resource "harfbuzz_bottle_manifest"
# The downloaded GitHub Packages manifest was corrupted or modified (it is not valid JSON):
# - dyld[45184]: Library not loaded: '/usr/local/opt/libunistring/lib/libunistring.2.dylib'
# Referenced from: '/usr/local/Cellar/wget/1.21.3/bin/wget'
# Reason: tried: '/usr/local/opt/libunistring/lib/libunistring.2.dylib' (no such file),
run: |
brew cleanup
# See https://github.com/orgs/Homebrew/discussions/4612#discussioncomment-6351357
brew config
brew untap homebrew/core homebrew/cask
brew config
brew update
# Note: brew upgrade does fail regularly, but brew is anyway in a better state afterwards
brew upgrade || true
# make sure we are using homebrew python, since we install some python packages via homebrew
brew install python3
brew link --overwrite python3
ls -l $(which python3)
ls -l $(which pip3)
# create a virtual environment so that we can use pip3
# (since python 3.12 using pip3 on package manager installed python requires a virtual environment)
python3 -m venv .venv
. .venv/bin/activate
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
echo PATH=$PATH >> $GITHUB_ENV
ls -l $(which python3)
ls -l $(which pip3)
- name: Install homebrew packages required by main script
run: brew install wget
- name: Run common platform script
shell: bash
run: |
ARGS="${PLATFORM:-$PLATFORM_ARGS}"
echo "Using ARGS=$ARGS"
./coq_platform_make.sh -packages=${{matrix.variant}} $ARGS -dumplogs
- name: "Upload opam log folder on failure"
uses: actions/upload-artifact@v4
if: failure()
with:
name: "Opam log folder ${{matrix.variant}}"
path: /Users/runner/.opam/log/
- name: "Upload opam build folder on failure"
uses: actions/upload-artifact@v4
if: failure()
with:
name: "Opam build folder ${{matrix.variant}}"
path: /Users/runner/.opam/RP*${{matrix.variant}}/.opam-switch/build
- name: Install bash (needed by smoke scripts)
run: brew install bash
- name: Create smoke test kit
shell: bash
run: |
eval $(opam env)
shell_scripts/create_smoke_test_kit.sh
- name: "Upload smoke test kit"
uses: actions/upload-artifact@v4
with:
name: "Smoke Test Kit Macos ${{matrix.variant}}"
path: smoke-test-kit/
retention-days: 5
- name: Install findutils, coreutils and macpack (needed by DMG script)
shell: bash
run: |
set -euo pipefail
brew install findutils coreutils
. .venv/bin/activate
pip3 install macpack
# Patch macpack to create/set an asyncio loop on Python 3.14
python3 <<'EOF'
import sysconfig
import pathlib
import re
pure = sysconfig.get_paths()['purelib']
print(f"Searching for macpack in: {pure}")
patched = False
for rel in ('macpack/patcher.py', 'tmp/patcher.py'):
p = pathlib.Path(pure) / rel
if not p.exists():
print(f"Not found: {p}")
continue
print(f"Found patcher.py at: {p}")
s = p.read_text()
# Replace the problematic line with proper indentation
old_pattern = r'(\s*)loop\s*=\s*asyncio\.get_event_loop\(\)'
def replacement(match):
indent = match.group(1)
return f'''{indent}try:
{indent} loop = asyncio.get_running_loop()
{indent}except RuntimeError:
{indent} loop = asyncio.new_event_loop()
{indent} asyncio.set_event_loop(loop)'''
s2 = re.sub(old_pattern, replacement, s, count=1)
if s2 != s:
p.write_text(s2)
print(f"✓ Patched: {p}")
patched = True
# Verify the patch
if 'get_running_loop' in s2:
print("✓ Patch verification successful")
break
else:
print(f"Pattern not found in: {p}")
if not patched:
print("⚠ WARNING: Could not find or patch macpack/patcher.py")
print("This may cause issues with Python 3.14")
EOF
# Sanity check: show which macpack will run
which macpack
python3 -c "import macpack; print('macpack imported successfully')"
# Sanity check: show which macpack will run
which macpack
python3 -c "import macpack; print('macpack imported successfully')"
- name: "Build DMG installer"
uses: Wandalen/wretry.action@v3
with:
attempt_limit: 5
attempt_delay: 5000
command: |
eval $(opam env)
macos/create_installer_macos.sh
- name: "Upload DMG script logs on failure"
uses: actions/upload-artifact@v4
if: failure()
with:
name: "DMG script error logs ${{matrix.variant}}"
path: macos_installer/logs/
- name: Set APP_PREFIX (Coq vs Rocq)
shell: bash
run: |
if [[ "${{ matrix.variant }}" == 9.* ]]; then
echo "APP_PREFIX=Rocq-Platform" >> "$GITHUB_ENV"
else
echo "APP_PREFIX=Coq-Platform" >> "$GITHUB_ENV"
fi
- name: "Upload Artifact"
uses: actions/upload-artifact@v4
with:
name: "Macos installer ${{matrix.variant}} x86_64"
path: macos_installer/${{ env.APP_PREFIX }}-*.dmg
retention-days: 5
Macos_smoke:
name: Smoke test Macos
needs: Macos_platform
runs-on: macos-15
strategy:
fail-fast: false
matrix:
variant:
- "9.1~2026.01"
- "9.0~2025.08"
steps:
- name: Install bash
run: brew install bash
- name: "Download Artifact"
uses: actions/download-artifact@v4
id: download
with:
name: "Macos installer ${{matrix.variant}} x86_64"
- name: "Download smoke test kit"
uses: actions/download-artifact@v4
id: download-smoke
with:
name: "Smoke Test Kit Macos ${{matrix.variant}}"
- name: Set APP_PREFIX (Coq vs Rocq)
shell: bash
run: |
if [[ "${{ matrix.variant }}" == 9.* ]]; then
echo "APP_PREFIX=Rocq-Platform" >> "$GITHUB_ENV"
else
echo "APP_PREFIX=Coq-Platform" >> "$GITHUB_ENV"
fi
- name: "Run Installer"
shell: bash
run: |
cd ${{steps.download.outputs.download-path}}
DMG=$(ls "${APP_PREFIX}"-*.dmg)
hdiutil attach "$DMG"
cp -r "/Volumes/${DMG%%.dmg}/${APP_PREFIX}"*.app /Applications/
hdiutil detach "/Volumes/${DMG%%.dmg}/"
- name: "Smoke coqc"
shell: bash
run: |
cd /Applications/${APP_PREFIX}*.app/Contents/Resources/bin/
# Try default coqc first
if ./coqc -v 2>/dev/null; then
exit 0
fi
echo "coqc -v failed, trying with library path detection for Rocq 9.0+"
# Try to find library path and use -coqlib
for path in ../lib/coq ../lib/rocq ../lib/coq-stdlib; do
if [ -d "$path" ] && ([ -f "$path/theories/Init/Prelude.vo" ] || [ -f "$path/Init/Prelude.vo" ]); then
echo "Trying with -coqlib $path"
./coqc -coqlib "$path" -v && exit 0
fi
done
# Last resort: boot mode
echo "Trying boot mode..."
./coqc -boot -noinit -v
- name: "Run Macos smoke test kit"
shell: bash
run: |
ls /Applications/${APP_PREFIX}*.app
export PATH="$PATH:$(cd /Applications/${APP_PREFIX}*.app/Contents/Resources/bin/; pwd)"
# Prefer ROCQLIB for Rocq 9+, but keep COQLIB fallback
if ROCQLIB_TEMP=$(coqc -where 2>/dev/null); then
export ROCQLIB="$ROCQLIB_TEMP"
export COQLIB="$ROCQLIB_TEMP"
echo "ROCQLIB set to: $ROCQLIB"
else
echo "Warning: coqc -where failed, ROCQLIB/COQLIB not set"
export ROCQLIB=""
export COQLIB=""
fi
cd ${{steps.download-smoke.outputs.download-path}}
chmod a+x ./run-smoke-test.sh
./run-smoke-test.sh