Skip to content

reintroduce mesh deletion option of circumcenters #187

reintroduce mesh deletion option of circumcenters

reintroduce mesh deletion option of circumcenters #187

Workflow file for this run

name: Build and test on macos
on:
push:
branches:
- main
- "release/v[0-9].[0-9].[0-9]"
pull_request:
types:
- opened # triggers build when opened
- synchronize # triggers build when commits are pushed to HEAD
branches:
- main
- "release/v[0-9].[0-9].[0-9]"
- "feature/**"
# Manual trigger
workflow_dispatch:
jobs:
build:
# Build strategy
strategy:
fail-fast: false
matrix:
platform:
- macos-latest
- macos-13-xlarge
build_type:
- Release
#- Debug
#- DebugWithRelInfo
# Build platform
runs-on: ${{ matrix.platform }}
name: ${{ matrix.platform }}-${{ matrix.build_type }}
# Build steps
steps:
# Step: Checkout
- name: Checkout
uses: actions/checkout@v4
# Workaround for getting "git describe --tags" to work in cmake/get_version_from_git.cmake (Build step)
with:
fetch-depth: 0
# Step: Set up Python
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
# Step: Install Python dependencies
- name: Install Python dependencies
run: python -m pip install -r requirements.txt
# Step: Install system-provided dependencies
# macOS
- name: Install backend dependencies
run: | # brew update
brew install boost
brew install doxygen
- name: Get branch name
id: get_branch_name
uses: tj-actions/branch-names@v8
- name: Process branch name
id: process_branch_name
run: |
str=${{ steps.get_branch_name.outputs.current_branch }}
if [[ "$str" = "main" ]]; then
# MeshKernelPy default barnch is called main, but MeshKernel default branch is called master
str="master"
elif [[ "$str" =~ ^release/ ]]; then
# branch name starts with "release/", get the semantic version from MeshKernelPy
str="release"
elif [[ ! "$str" =~ ^feature/ ]]; then
# last possibility is being on a feature branch, which starts with "feature/"
# if not, it is not possile to continue
exit 1
fi
echo "BACK_END_BRANCH=$str" >> $GITHUB_ENV
# Step: Build Wheel
# The default compiler on macos is clang, switch to gcc 11. Specifying the version is necessary.
# It seems like gcc and g++ are symbolic links to the default clang and clang++ compilers, respectively.
# CMAKE_CXX_COMPILER_ID will evaluate to AppleClang rather than GNU on macos.
- name: Build Wheel
env:
CC: gcc-11
CXX: g++-11
run: |
export MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion)
python setup.py build_ext
python setup.py sdist
python setup.py bdist_wheel
# Step: Audit Wheel
- name: Repair platform tag
run: |
wheel_name=$(find ./dist -name "meshkernel-*-macosx_*.whl")
echo Found $wheel_name
# generate the tag: in macosx_[MAJOR_VERSION]_[MINOR_VERSION]_[ARCH], set MINOR_VERSION to 0 otherwise pip install will fail
platform_tag=$(python -c 'import platform; tag = "macosx_" + platform.mac_ver()[0].rsplit(".", 2)[0] + "_0_" + platform.machine().lower(); print(tag)')
# apply new tag only if it is incorrect
if [[ "$wheel_name" != *"$platform_tag"* ]]; then
echo Apply the platform tag $platform_tag to $wheel_name
wheel tags --platform-tag $platform_tag $wheel_name
# remove incorrectly tagged wheel
rm $wheel_name
else
echo Platform tag is correct. No action needed.
fi
# Step: Test
- name: Test
run: |
wheel_name=$(find ./dist -name "meshkernel-*-macosx_*.whl")
python -m pip install $wheel_name
pytest ./tests
# Step: Upload artifact
- name: Upload artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: meshkernel-${{ matrix.platform }}-${{ matrix.build_type }}
path: ./dist
if-no-files-found: error