Enforce hinted at data types #69
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and test on macos | |
on: | |
push: | |
branches: | |
- master | |
- "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: | |
- master | |
- "release/v[0-9].[0-9].[0-9]" | |
- "feature/**" | |
# Manual trigger | |
workflow_dispatch: | |
jobs: | |
build: | |
# Build strategy | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
#- ubuntu-latest | |
- macos-latest | |
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@v3 | |
# 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@v4 | |
with: | |
python-version: 3.9 | |
# Step: Install Python dependencies | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install wheel | |
python -m pip install numpy | |
python -m pip install matplotlib | |
python -m pip install pytest | |
python -m pip install type_enforced | |
# Step: Install system-provided dependencies | |
# macOS | |
- if: runner.os == '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@v7 | |
- 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: | | |
python setup.py build_ext | |
python setup.py sdist bdist_wheel | |
# 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@v3 | |
if: always() | |
with: | |
name: meshkernel-${{ matrix.platform }}-${{ matrix.build_type }} | |
path: ./dist | |
if-no-files-found: error |