forked from sofa-framework/SofaPython3
-
Notifications
You must be signed in to change notification settings - Fork 0
220 lines (200 loc) · 8.16 KB
/
macos.yml
File metadata and controls
220 lines (200 loc) · 8.16 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
name: MacOS CI
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, edited]
jobs:
build:
name: Building with SOFA ${{ matrix.sofa_branch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-10.15]
sofa_branch: [master]
env:
SOFA_ROOT: /opt/sofa
SOFA_OS: MacOS
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Set env vars
run: |
echo github.event.number = ${{ github.event.number }}
echo github.event.pull_request.number = ${{ github.event.pull_request.number }}
echo github.event.issue.number = ${{ github.event.issue.number }}
if [ -n "${{ github.event.number }}" ]; then
GIT_BRANCH="PR-${{ github.event.number }}"
elif [ -n "${{ github.event.pull_request.number }}" ]; then
GIT_BRANCH="PR-${{ github.event.pull_request.number }}"
elif [ -n "${{ github.event.issue.number }}" ]; then
GIT_BRANCH="PR-${{ github.event.issue.number }}"
else
GIT_BRANCH="${GITHUB_REF#refs/heads/}"
fi
echo "GIT_BRANCH = $GIT_BRANCH"
if [ -z "$GIT_BRANCH" ]; then exit 1; fi
echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install requirements
shell: bash
run: |
brew install eigen boost
brew install ccache ninja
brew list | grep python | while read package; do
brew unlink $package
done
python3 -m pip install numpy scipy
- name: pybind11 cache files
uses: actions/cache@v2
id: pybind11_cache
with:
path: /tmp/pybind11
key: pybind11_${{ env.GIT_BRANCH }}_${{ matrix.os }}_${{ hashFiles('.github/workflows/*.yml') }}
- name: Build pybind11
if: steps.pybind11_cache.outputs.cache-hit != 'true'
run: |
git clone -b v2.4.3 --depth 1 https://github.com/pybind/pybind11.git /tmp/pybind11
cd /tmp/pybind11
cmake -DCMAKE_BUILD_TYPE=Release -DPYBIND11_TEST=OFF -DPYTHON_EXECUTABLE=$(which python3.7) .
make --silent
- name: Install pybind11
run: |
cd /tmp/pybind11
sudo make --silent install
- name: Download and install the latest SOFA ${{ matrix.sofa_branch }} binaries
shell: bash
run: |
mkdir -p /tmp/sofa_zip
mkdir -p /tmp/sofa_binaries
curl --output /tmp/sofa_zip/${SOFA_OS}.zip -L \
https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/CI_BRANCH=${{ matrix.sofa_branch }},CI_SCOPE=minimal/lastSuccessfulBuild/artifact/${SOFA_OS}/*zip*/${SOFA_OS}.zip
unzip -qq /tmp/sofa_zip/${SOFA_OS}.zip -d /tmp/sofa_zip
unzip -qq /tmp/sofa_zip/${SOFA_OS}/SOFA_*.zip -d /tmp/sofa_binaries
sudo mv /tmp/sofa_binaries/SOFA_* ${SOFA_ROOT}
sudo ls -la ${SOFA_ROOT}
rm -rf /tmp/sofa_*
- name: ccache cache files
uses: actions/cache@v2
with:
path: .ccache
key: ccache_${{ env.GIT_BRANCH }}_${{ matrix.os }}_${{ hashFiles('.github/workflows/*.yml') }}
- name: Build
env:
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 6
CCACHE_MAXSIZE: "500M"
run: |
echo "RUNNER_TOOL_CACHE = $RUNNER_TOOL_CACHE"
python_root="$(find $RUNNER_TOOL_CACHE -maxdepth 3 -type d -path '**/Python/3.7*/x64')"
echo "python_root = $python_root"
export CCACHE_BASEDIR=$GITHUB_WORKSPACE
export CCACHE_DIR=$GITHUB_WORKSPACE/.ccache
ccache -z
cmake \
-GNinja \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake \
-DCMAKE_BUILD_TYPE=Release \
-DPython_EXECUTABLE=$(which python3.7) \
-DPython_ROOT=$python_root \
.
ninja install
echo ${CCACHE_BASEDIR}
ccache -s
- name: Create artifact
uses: actions/upload-artifact@v2
with:
name: SofaPython3_${{ env.GIT_BRANCH }}_SOFA-${{ matrix.sofa_branch }}_${{ env.SOFA_OS }}
path: install
tests:
name: Testing with SOFA ${{ matrix.sofa_branch }}
needs: [build]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-10.15]
sofa_branch: [master, v21.06]
env:
SOFA_ROOT: /opt/sofa
SOFA_OS: MacOS
steps:
- name: Set env vars
run: |
echo github.event.number = ${{ github.event.number }}
echo github.event.pull_request.number = ${{ github.event.pull_request.number }}
echo github.event.issue.number = ${{ github.event.issue.number }}
if [ -n "${{ github.event.number }}" ]; then
GIT_BRANCH="PR-${{ github.event.number }}"
elif [ -n "${{ github.event.pull_request.number }}" ]; then
GIT_BRANCH="PR-${{ github.event.pull_request.number }}"
elif [ -n "${{ github.event.issue.number }}" ]; then
GIT_BRANCH="PR-${{ github.event.issue.number }}"
else
GIT_BRANCH="${GITHUB_REF#refs/heads/}"
fi
echo "GIT_BRANCH = $GIT_BRANCH"
if [ -z "$GIT_BRANCH" ]; then exit 1; fi
echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install requirements
shell: bash
run: |
brew install boost
brew list | grep python | while read package; do
brew unlink $package
done
python3 -m pip install numpy scipy
- name: Download and install the latest SOFA ${{ matrix.sofa_branch }} binaries
shell: bash
run: |
mkdir -p /tmp/sofa_zip
mkdir -p /tmp/sofa_binaries
curl --output /tmp/sofa_zip/${SOFA_OS}.zip -L \
https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/CI_BRANCH=${{ matrix.sofa_branch }},CI_SCOPE=minimal/lastSuccessfulBuild/artifact/${SOFA_OS}/*zip*/${SOFA_OS}.zip
unzip -qq /tmp/sofa_zip/${SOFA_OS}.zip -d /tmp/sofa_zip
unzip -qq /tmp/sofa_zip/${SOFA_OS}/SOFA_*.zip -d /tmp/sofa_binaries
sudo mv /tmp/sofa_binaries/SOFA_* ${SOFA_ROOT}
sudo ls -la ${SOFA_ROOT}
rm -rf /tmp/sofa_*
- name: Install SP3
uses: actions/download-artifact@v2
with:
name: SofaPython3_${{ env.GIT_BRANCH }}_SOFA-${{ matrix.sofa_branch }}_${{ env.SOFA_OS }}
path: SofaPython3
- name: Binding.Sofa.Tests
if: ${{ always() }}
run: |
export DYLD_LIBRARY_PATH=$GITHUB_WORKSPACE/SofaPython3/lib:$SOFA_ROOT/lib
export PYTHONPATH=$GITHUB_WORKSPACE/SofaPython3/lib/python3/site-packages
chmod +x SofaPython3/bin/Bindings.Sofa.Tests
./SofaPython3/bin/Bindings.Sofa.Tests
- name: Bindings.SofaRuntime.Tests
if: ${{ always() }}
run: |
export DYLD_LIBRARY_PATH=$GITHUB_WORKSPACE/SofaPython3/lib:$SOFA_ROOT/lib
export PYTHONPATH=$GITHUB_WORKSPACE/SofaPython3/lib/python3/site-packages
chmod +x SofaPython3/bin/Bindings.SofaRuntime.Tests
./SofaPython3/bin/Bindings.SofaRuntime.Tests
- name: Bindings.SofaTypes.Tests
if: ${{ always() }}
run: |
export DYLD_LIBRARY_PATH=$GITHUB_WORKSPACE/SofaPython3/lib:$SOFA_ROOT/lib
export PYTHONPATH=$GITHUB_WORKSPACE/SofaPython3/lib/python3/site-packages
chmod +x SofaPython3/bin/Bindings.SofaTypes.Tests
./SofaPython3/bin/Bindings.SofaTypes.Tests
- name: Bindings.Modules.Tests
if: ${{ always() }}
run: |
export DYLD_LIBRARY_PATH=$GITHUB_WORKSPACE/SofaPython3/lib:$SOFA_ROOT/lib
export PYTHONPATH=$GITHUB_WORKSPACE/SofaPython3/lib/python3/site-packages
chmod +x SofaPython3/bin/Bindings.Modules.Tests
./SofaPython3/bin/Bindings.Modules.Tests