Skip to content

gha/macos-homebrew: Fix build on macOS 14 #715

gha/macos-homebrew: Fix build on macOS 14

gha/macos-homebrew: Fix build on macOS 14 #715

name: macos-macports-wheels-build
on: [push, pull_request]
jobs:
macos:
name: Talipot Python wheels build on macOS
runs-on: macos-12
env:
CLANG_VERSION: 16
MACOSX_DEPLOYMENT_TARGET: "12.0"
TWINE_REPOSITORY: https://test.pypi.org/legacy/
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout Talipot code
uses: actions/checkout@v4
- name: Get wheel next dev version
run: |
JSON=$(curl -s 'https://test.pypi.org/pypi/talipot/json')
LAST_VERSION=$(echo $JSON | python -c "
import sys, json
print(json.load(sys.stdin)['info']['version'])" 2>/dev/null)
if [ $? -ne 0 ]
then
DEV_VERSION=1
else
echo last wheel dev version = $LAST_VERSION
# check if dev wheel version needs to be incremented
VERSION_INCREMENT=$(echo $JSON | python -c "
import sys, json
releases = json.load(sys.stdin)['releases']['$LAST_VERSION']
print(any(['macosx' in r['filename'] for r in releases]))")
DEV_VERSION=$(echo $LAST_VERSION | cut -f4 -d '.' | sed 's/dev//')
if [ "$VERSION_INCREMENT" == "True" ]
then
let DEV_VERSION+=1
fi
fi
echo current wheel dev version = $DEV_VERSION
echo "DEV_VERSION=$DEV_VERSION" >> $GITHUB_ENV
- name: Prepare ccache timestamp
id: get-current-date
run: |
echo "date=$(date -u "+%Y-%m-%d-%H-%m-%S")" >> $GITHUB_OUTPUT
shell: bash
- name: Cache files
uses: actions/cache@v4
with:
path: |
/Users/runner/Library/Caches/ccache
/Users/runner/.macports-ci-ccache
key: macos-wheels-ccache-${{ steps.get-current-date.outputs.date }}
restore-keys: |
${{ matrix.config.os }}-ccache-
save-always: true
- name: Install MacPorts
run: |
curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci
source ./macports-ci install
- name: Install Talipot build dependencies
run: sudo port -N install
cmake
clang-${{ env.CLANG_VERSION }}
bison
zlib
zstd
libomp
qhull
yajl
libgit2
graphviz
- name: Install Python versions to build wheels against
run: |
curl -LO https://www.python.org/ftp/python/3.7.6/python-3.7.6-macosx10.9.pkg
sudo installer -pkg python-3.7.6-macosx10.9.pkg -target /
sudo /Library/Frameworks/Python.framework/Versions/3.7/bin/pip3 install wheel
curl -LO https://www.python.org/ftp/python/3.8.1/python-3.8.1-macosx10.9.pkg
sudo installer -pkg python-3.8.1-macosx10.9.pkg -target /
sudo /Library/Frameworks/Python.framework/Versions/3.8/bin/pip3 install wheel
curl -LO https://www.python.org/ftp/python/3.9.0/python-3.9.0-macosx10.9.pkg
sudo installer -pkg python-3.9.0-macosx10.9.pkg -target /
sudo /Library/Frameworks/Python.framework/Versions/3.9/bin/pip3 install wheel
curl -LO https://www.python.org/ftp/python/3.10.0/python-3.10.0post2-macos11.pkg
sudo installer -pkg python-3.10.0post2-macos11.pkg -target /
sudo /Library/Frameworks/Python.framework/Versions/3.10/bin/pip3 install wheel
curl -LO https://www.python.org/ftp/python/3.11.0/python-3.11.0-macos11.pkg
sudo installer -pkg python-3.11.0-macos11.pkg -target /
sudo /Library/Frameworks/Python.framework/Versions/3.11/bin/pip3 install wheel
sudo /Library/Frameworks/Python.framework/Versions/3.11/bin/pip3 install twine
- name: Create build directory
run: mkdir build
- name: Build Talipot Python wheels
working-directory: ./build
run: |
for py3Version in 3.8 3.9 3.10 3.11
do
rm -f CMakeCache.txt || true
sudo /Library/Frameworks/Python.framework/Versions/$py3Version/bin/pip3 install sip
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$PWD/install \
-DCMAKE_C_COMPILER=/opt/local/bin/clang-mp-${{ env.CLANG_VERSION }} \
-DCMAKE_CXX_COMPILER=/opt/local/bin/clang++-mp-${{ env.CLANG_VERSION }} \
-DTALIPOT_ACTIVATE_PYTHON_WHEEL_TARGET=ON \
-DTALIPOT_PYTHON_TEST_WHEEL_SUFFIX=a2.dev${{ env.DEV_VERSION }}\
-DPython3_EXECUTABLE=/Library/Frameworks/Python.framework/Versions/$py3Version/bin/python3 \
-DTALIPOT_USE_CCACHE=ON \
-DTALIPOT_BUILD_CORE_ONLY=ON \
-DTALIPOT_BUILD_DOC=OFF
make -j4 test-wheel
done
- name: Upload Talipot Python wheels on test PyPI
if: github.ref == 'refs/tags/dev-latest'
working-directory: ./build
run: make test-wheel-upload
- name: Test uploaded wheels in clean environment
if: github.ref == 'refs/tags/dev-latest'
run: |
sudo port -N -f uninstall \
cmake \
clang-${CLANG_VERSION} \
qhull \
yajl \
libgit2 \
graphviz
sudo port -N install \
python38 \
py38-pip \
python39 \
py39-pip \
python310 \
py310-pip \
python311 \
py311-pip
sudo pip-3.8 install --index-url https://test.pypi.org/simple/ talipot
python3.8 -c "from talipot import tlp; print(tlp.getLayoutAlgorithmPluginsList())"
python3.8 -c "from talipot import tlp; print(tlp.getImportPluginsList())"
sudo pip-3.9 install --index-url https://test.pypi.org/simple/ talipot
python3.9 -c "from talipot import tlp; print(tlp.getLayoutAlgorithmPluginsList())"
python3.9 -c "from talipot import tlp; print(tlp.getImportPluginsList())"
sudo pip-3.10 install --index-url https://test.pypi.org/simple/ talipot
python3.10 -c "from talipot import tlp; print(tlp.getLayoutAlgorithmPluginsList())"
python3.10 -c "from talipot import tlp; print(tlp.getImportPluginsList())"
sudo pip-3.11 install --index-url https://test.pypi.org/simple/ talipot
python3.11 -c "from talipot import tlp; print(tlp.getLayoutAlgorithmPluginsList())"
python3.11 -c "from talipot import tlp; print(tlp.getImportPluginsList())"