Skip to content

Mixed differentiation #1039

Mixed differentiation

Mixed differentiation #1039

Workflow file for this run

# This file generates Python wheels for macOS
on:
push:
branches:
- codac1
- codac2
- codac2_codac4matlab
tags-ignore: ['**'] # Ignore all tag pushes
pull_request:
jobs:
macosmatrix:
runs-on: ${{ matrix.cfg.os }}
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.cfg.trgt }}
_PYTHON_HOST_PLATFORM: macosx-${{ matrix.cfg.trgt }}-${{ matrix.cfg.arch }}
defaults:
run:
shell: ${{ matrix.cfg.shell }}
strategy:
fail-fast: false
matrix:
cfg:
- { os: macos-14 , shell: bash, arch: arm64 , runtime: sonoma , cmake_flags: '-fPIC', trgt: '11.0' , cpcfg: '-macosx_11_0_arm64' , py_v_maj: 3, py_v_min: 14, desc: 'macOS Sonoma Python 3.14 arm64' }
- { os: macos-14 , shell: bash, arch: arm64 , runtime: sonoma , cmake_flags: '-fPIC', trgt: '11.0' , cpcfg: '-macosx_11_0_arm64' , py_v_maj: 3, py_v_min: 13, desc: 'macOS Sonoma Python 3.13 arm64' }
- { os: macos-14 , shell: bash, arch: arm64 , runtime: sonoma , cmake_flags: '-fPIC', trgt: '11.0' , cpcfg: '-macosx_11_0_arm64' , py_v_maj: 3, py_v_min: 12, desc: 'macOS Sonoma Python 3.12 arm64' }
- { os: macos-14 , shell: bash, arch: arm64 , runtime: sonoma , cmake_flags: '-fPIC', trgt: '11.0' , cpcfg: '-macosx_11_0_arm64' , py_v_maj: 3, py_v_min: 11, desc: 'macOS Sonoma Python 3.11 arm64' }
- { os: macos-15-intel , shell: bash, arch: x86_64 , runtime: sequoia , cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 14, desc: 'macOS Sequoia Python 3.14 x86_64' }
- { os: macos-15-intel , shell: bash, arch: x86_64 , runtime: sequoia , cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 13, desc: 'macOS Sequoia Python 3.13 x86_64' }
- { os: macos-15-intel , shell: bash, arch: x86_64 , runtime: sequoia , cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 12, desc: 'macOS Sequoia Python 3.12 x86_64' }
- { os: macos-15-intel , shell: bash, arch: x86_64 , runtime: sequoia , cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 11, desc: 'macOS Sequoia Python 3.11 x86_64' }
- { os: macos-15-intel , shell: bash, arch: x86_64 , runtime: sequoia , cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 10, desc: 'macOS Sequoia Python 3.10 x86_64' }
- { os: macos-15-intel , shell: bash, arch: x86_64 , runtime: sequoia , cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 9 , desc: 'macOS Sequoia Python 3.9 x86_64' }
- { os: macos-15-intel , shell: bash, arch: x86_64 , runtime: sequoia , cmake_flags: '-fPIC', trgt: '10.16', cpcfg: '-macosx_10_16_x86_64', py_v_maj: 3, py_v_min: 8 , desc: 'macOS Sequoia Python 3.8 x86_64' }
name: ${{ matrix.cfg.desc }}
steps:
- uses: actions/checkout@v7
with:
submodules: true
fetch-depth: 0
clean: false
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.cfg.py_v_maj }}.${{ matrix.cfg.py_v_min }}
architecture: x64
if: matrix.cfg.py_v_maj!=''
- run: |
python -c "import sys; print(sys.version)"
echo ${{ matrix.cfg.py_v_maj }}.${{ matrix.cfg.py_v_min }}
if: matrix.cfg.py_v_maj!=''
- run: echo "VERBOSE=1" >> $GITHUB_ENV
shell: bash
#- run: brew install eigen
# if: runner.os=='macOS'
- run: brew install catch2 # Issues with binary packages when cross-compiling...
if: (runner.os=='macOS')&&(matrix.cfg.cross!=true)
# Doxygen 1.18.0 crashes when parsing Codac headers on macOS.
# Doxygen 1.16.1 ARM64 binaries require macOS 15: build from source on macOS 14.
- name: Install Doxygen 1.16.1
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
case "${{ matrix.cfg.arch }}" in
arm64) archive="doxygen-1.16.1.src.tar.gz" ;;
x86_64) archive="doxygen-1.16.1-mac-intel.zip" ;;
*) echo "Unsupported architecture" >&2; exit 1 ;;
esac
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
# Verify the archive using its official GitHub release SHA-256 digest.
expected_sha="$(
curl -fsSL --retry 3 \
-H "Authorization: Bearer ${GH_TOKEN}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/doxygen/doxygen/releases/tags/Release_1_16_1 \
| python3 -c 'import json,sys; a=next(x for x in json.load(sys.stdin)["assets"] if x["name"]==sys.argv[1]); d=a["digest"]; assert d and d.startswith("sha256:") and len(d)==71; print(d[7:])' "$archive"
)"
curl -fsSL --retry 3 \
"https://github.com/doxygen/doxygen/releases/download/Release_1_16_1/${archive}" \
-o "$tmpdir/$archive"
echo "${expected_sha} ${tmpdir}/${archive}" | shasum -a 256 -c
if [[ "${{ matrix.cfg.arch }}" == arm64 ]]; then
brew install ninja flex bison
mkdir "$tmpdir/src"
tar -xzf "$tmpdir/$archive" -C "$tmpdir/src"
export PATH="$(brew --prefix flex)/bin:$(brew --prefix bison)/bin:$PATH"
cmake -G Ninja -S "$tmpdir/src/doxygen-1.16.1" -B "$tmpdir/build" \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
-Dbuild_wizard=OFF -Dbuild_doc=OFF -Duse_libclang=OFF
cmake --build "$tmpdir/build" --target doxygen --parallel 4
doxygen_bin="$tmpdir/build/bin/doxygen"
else
unzip -q "$tmpdir/$archive" -d "$tmpdir/unpacked"
doxygen_bin="$(find "$tmpdir/unpacked" -type f -name doxygen -print -quit)"
fi
mkdir -p "$RUNNER_TEMP/codac-doxygen-bin"
install -m 755 "$doxygen_bin" "$RUNNER_TEMP/codac-doxygen-bin/doxygen"
echo "$RUNNER_TEMP/codac-doxygen-bin" >> "$GITHUB_PATH"
"$RUNNER_TEMP/codac-doxygen-bin/doxygen" --version
- run: brew install graphviz ; python -m pip install --upgrade pip ; pip install --upgrade wheel setuptools sphinx breathe sphinx_rtd_theme sphinx-tabs sphinx-issues sphinx-reredirects furo sphinx-math-dollar sphinx_togglebutton sympy
if: runner.os=='macOS'
- run: |
wget https://github.com/lebarsfa/ibex-lib/releases/download/ibex-2.8.9.20260819/ibex_${{ matrix.cfg.arch }}_${{ matrix.cfg.runtime }}.zip --no-check-certificate -nv
unzip -q ibex_${{ matrix.cfg.arch }}_${{ matrix.cfg.runtime }}.zip
rm -Rf ibex_${{ matrix.cfg.arch }}_${{ matrix.cfg.runtime }}.zip
sudo cp -Rf ibex/* /usr/local/
shell: bash
- run: |
mkdir build ; cd build
cmake -E env CXXFLAGS="${{ matrix.cfg.cmake_flags }}" CFLAGS="${{ matrix.cfg.cmake_flags }}" cmake ${{ matrix.cfg.cmake_params }} -D CMAKE_SYSTEM_NAME=Darwin -D CMAKE_OSX_ARCHITECTURES=${{ matrix.cfg.arch }} -D CMAKE_INSTALL_PREFIX="../codac" -D BUILD_TESTS=ON -D WITH_CAPD=OFF -D WITH_PYTHON=ON -D PYBIND11_FINDPYTHON=OFF ..
cmake --build . -j 4 --config Release --target install
cmake --build . --config Release --target pip_package ; cp `ls *.whl` ../`ls *.whl | sed "s/py3-none-any/cp${{ matrix.cfg.py_v_maj }}${{ matrix.cfg.py_v_min }}-cp${{ matrix.cfg.py_v_maj }}${{ matrix.cfg.py_v_min }}${{ matrix.cfg.cpcfg }}/"`
cd ..
shell: bash
- uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "*.whl"
overwrite: true
tag_name: autotagname-${{ github.sha }}
if: (github.event_name!='pull_request')&&((github.ref_name=='codac1')||(github.ref_name=='codac2')||(github.ref_name=='codac2_codac4matlab'))
- run: |
pip install --no-deps --no-index *.whl
python -c "import sys; print(sys.version)" ; python examples/02_centered_form/main.py
pip install numpy sympy --prefer-binary
python -m unittest discover codac.tests
cd build && ctest -C Release -V --output-on-failure
cd ..
shell: bash
if: (matrix.cfg.cross!=true)&&(github.ref_name!='codac2_codac4matlab')&&(github.event.pull_request.base.ref!='codac2_codac4matlab')