From 759b3cc7ea6a5f7a9ea30d0e1b3212d92fb1e9d9 Mon Sep 17 00:00:00 2001 From: Rutger van Haasteren Date: Fri, 10 Apr 2026 10:52:51 +0000 Subject: [PATCH] =?UTF-8?q?fix(ci):=20pin=20macOS=20CI=20to=20x86=5F64=20?= =?UTF-8?q?=E2=80=94=20tempo2=20requires=20128-bit=20long=20double?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tempo2 relies on 128-bit long double for quad-precision timing. On arm64 macOS (Apple Silicon), long double is only 64 bits (same as double), so tempo2 produces silently incorrect results. The old macos-latest runner was x86_64 Intel, but GitHub moved it to arm64 in 2024-2025 and removed macos-13 (the last x86_64 image) in Dec 2025. Pin macOS CI to macos-15-intel (x86_64, available until Aug 2027). On Linux aarch64, long double is 128-bit IEEE quad (software-emulated), so ubuntu-latest continues to work regardless of host architecture. Other fixes in this commit: - Update actions/checkout v2→v4, actions/setup-python v2→v5, actions/download-artifact v4.1.7→v4 - Set TEMPO2_PREFIX via GITHUB_ENV so setup.py finds tempo2 under pip's build isolation - Replace fragile `brew unlink gcc && brew link gcc` with `brew install automake libtool gcc && brew link --overwrite gcc` (ensures gfortran symlink exists even when gcc is pre-installed) - Fix sed quoting bug in install_tempo2.sh (macOS BSD sed needs -i and '' as separate arguments) - Drop Python 3.8 (EOL); keep 3.9 on Linux only; add Python 3.13 - Simplify build job (Linux-only, remove dead macOS if-block) --- .github/workflows/ci_tests.yml | 51 +++++++++++++++++++--------------- install_tempo2.sh | 15 ++++++---- 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 31140b8..b74ed87 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -8,7 +8,7 @@ on: branches: [ master ] pull_request: branches: [ master ] - release: + release: types: - published @@ -19,26 +19,37 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + os: [ubuntu-latest, macos-15-intel] + python-version: ['3.10', '3.11', '3.12', '3.13'] + include: + - os: ubuntu-latest + python-version: '3.9' steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install tempo2 on mac if: runner.os == 'macOS' run: | - brew unlink gcc && brew link gcc - brew install automake libtool + brew install automake libtool gcc + sudo ln -sf "$(brew --prefix gcc)/bin/gfortran-$(brew list --versions gcc | awk '{print $2}' | cut -d. -f1)" /usr/local/bin/gfortran + gfortran --version ./install_tempo2.sh + echo "TEMPO2_PREFIX=$HOME/.local" >> "$GITHUB_ENV" + echo "--- tempo2 install verification ---" + ls -la "$HOME/.local/include/" || echo "WARNING: $HOME/.local/include/ does not exist" + ls -la "$HOME/.local/lib/" || echo "WARNING: $HOME/.local/lib/ does not exist" + test -f "$HOME/.local/include/tempo2.h" || { echo "FATAL: tempo2.h not found at $HOME/.local/include/tempo2.h"; exit 1; } - name: Install tempo2 on linux if: runner.os == 'Linux' run: | ./install_tempo2.sh + echo "TEMPO2_PREFIX=$HOME/.local" >> "$GITHUB_ENV" + test -f "$HOME/.local/include/tempo2.h" || { echo "FATAL: tempo2.h not found at $HOME/.local/include/tempo2.h"; exit 1; } - name: Install dependencies and package run: | python -m pip install --upgrade pip @@ -55,21 +66,15 @@ jobs: runs-on: ubuntu-latest if: github.event_name == 'release' steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 with: - python-version: '3.10' - - name: Install tempo2 on mac - if: runner.os == 'macOS' - run: | - brew unlink gcc && brew link gcc - brew install automake - ./install_tempo2.sh - - name: Install tempo2 on linux - if: runner.os == 'Linux' + python-version: '3.12' + - name: Install tempo2 run: | ./install_tempo2.sh + echo "TEMPO2_PREFIX=$HOME/.local" >> "$GITHUB_ENV" - name: Build run: | python -m pip install --upgrade pip setuptools wheel build @@ -77,7 +82,7 @@ jobs: make dist - name: Test the sdist run: | - mkdir tmp + mkdir tmp cd tmp python -m venv venv-sdist venv-sdist/bin/python -m pip install --upgrade pip setuptools @@ -94,9 +99,9 @@ jobs: runs-on: ubuntu-latest if: github.event_name == 'release' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.x' - name: Install dependencies @@ -104,7 +109,7 @@ jobs: python -m pip install --upgrade pip pip install setuptools wheel twine - name: Download wheel/dist from build - uses: actions/download-artifact@v4.1.7 + uses: actions/download-artifact@v4 with: name: dist path: dist diff --git a/install_tempo2.sh b/install_tempo2.sh index 44eeb69..a9e64a6 100755 --- a/install_tempo2.sh +++ b/install_tempo2.sh @@ -20,15 +20,18 @@ tar zxvf 2021.07.1-correct.tar.gz cd psrsoft-tempo2-* # remove LT_LIB_DLLOAD from configure.ac -sed_in_place="-i ''" # For macOS -if [[ "$(uname -s)" == "Linux" ]]; then - sed_in_place="-i" # For Linux +if [[ "$(uname -s)" == "Darwin" ]]; then + sed -i '' "s/LT_LIB_DLLOAD//g" "configure.ac" +else + sed -i "s/LT_LIB_DLLOAD//g" "configure.ac" fi -sed "$sed_in_place" "s/LT_LIB_DLLOAD//g" "configure.ac" ./bootstrap -./configure --prefix=$prefix -make && make install +# Prevent autoconf from enabling C23 (where bool is a keyword), +# which breaks tempo2's jpleph.c `typedef int bool;` +./configure --prefix=$prefix ac_cv_prog_cc_c23=no +make +make install cp -r T2runtime/* $TEMPO2 cd ..