-
Notifications
You must be signed in to change notification settings - Fork 4
118 lines (105 loc) · 3.46 KB
/
build-macos.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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