-
Notifications
You must be signed in to change notification settings - Fork 17
293 lines (253 loc) · 9.03 KB
/
build.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
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
name: Build and test
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
jobs:
build:
strategy:
matrix:
name: [ubuntu-gcc-10,
# ubuntu-gcc-11-sanitize,
ubuntu-gcc-11-debugoptimized,
ubuntu-gcc-11-DEBUG_MACHINE,
ubuntu-gcc-11,
ubuntu-gcc-12,
ubuntu-clang-13,
macos-xcode-14,
windows
]
include:
- name: ubuntu-gcc-10
os: ubuntu-20.04
compiler: gcc
version: "10"
buildtype: "release"
arch: "linux64"
# - name: ubuntu-gcc-11-sanitize
# os: ubuntu-22.04
# compiler: gcc
# version: "11"
# buildtype: "release"
# sanitize: "address"
# arch: "linux64"
- name: ubuntu-gcc-11-debugoptimized
os: ubuntu-22.04
compiler: gcc
version: "11"
buildtype: "debugoptimized"
arch: "linux64"
- name: ubuntu-gcc-11-DEBUG_MACHINE
os: ubuntu-22.04
compiler: gcc
version: "11"
buildtype: "debugoptimized"
cxxflags: "-DDEBUG_MACHINE=1"
arch: "linux64"
- name: ubuntu-gcc-11
os: ubuntu-22.04
compiler: gcc
version: "11"
buildtype: "release"
arch: "linux64"
- name: ubuntu-gcc-12
os: ubuntu-22.04
compiler: gcc
version: "12"
buildtype: "release"
arch: "linux64"
- name: ubuntu-clang-13
os: ubuntu-22.04
compiler: clang
version: "13"
buildtype: "release"
arch: "linux64"
- name: macos-xcode-14
os: macos-12
compiler: xcode
version: "14"
buildtype: "release"
arch: "mac64"
- name: windows
os: ubuntu-22.04
compiler: mingw
version: "N/A"
buildtype: "release"
arch: "win64"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install (Linux)
if: runner.os == 'Linux' && matrix.name != 'windows'
run: |
sudo apt-get install -y pandoc ccache
sudo rm -rf /usr/local/share/boost
sudo apt-get install -y libboost-all-dev nlohmann-json3-dev librange-v3-dev libeigen3-dev libcairo2-dev
if [ "${{ matrix.compiler }}" = "gcc" ]; then
# For newer GCCs, maybe.
# sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
# sudo apt-get update
sudo apt-get install -y g++-${{ matrix.version }}
echo "CC=ccache gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=ccache g++-${{ matrix.version }}" >> $GITHUB_ENV
else
sudo apt-get install -y clang-${{ matrix.version }}
echo "CC=ccache clang-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=ccache clang++-${{ matrix.version }}" >> $GITHUB_ENV
fi
- name: Install (Linux -> Windows [cross])
if: matrix.name == 'windows'
run: |
# For mingw/gcc-12.
cat /etc/apt/sources.list
sudo sed -i 's/jammy/lunar/g' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y pandoc ccache
sudo apt-get install -y dos2unix g++-mingw-w64 wine64 zstd
- name: Select XCode version (macOS)
if: runner.os == 'macOS'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.version }}
- name: Install (macOS)
if: runner.os == 'macOS'
run: |
brew install pkg-config pandoc ccache coreutils
brew install boost eigen range-v3 nlohmann-json cairo
echo "CC=ccache clang" >> $GITHUB_ENV
echo "CXX=ccache clang++" >> $GITHUB_ENV
- name: Install meson
run: |
python3 -mpip install meson ninja
# Caches for different branches are isolated, so we don't need to put the branch name into the key.
# The total size for all caches in a repository is 5Gb.
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: |
ccache --set-config=cache_dir=$HOME/.ccache
if [ "${{ runner.os }}" = "Linux" ]; then
stamp=$(date '+%s')
else
stamp=$(gdate '+%s')
fi
echo "${stamp}"
echo "timestamp=${stamp}" >> $GITHUB_OUTPUT
- name: ccache cache files
# uses: actions/cache@v2
uses: pat-s/[email protected]
with:
path: ~/.ccache
key: ${{ matrix.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
${{ matrix.name }}-ccache-
- name: Make windows sysroot and generate cross file
if: matrix.name == 'windows'
# This command also generates the cross file
run: |
${GITHUB_WORKSPACE}/scripts/make_winroot.sh
- name: Configure
run: |
if [ "${{ runner.os }}" = "macOS" ]; then
export CFLAGS="-mmacosx-version-min=10.15"
export CXXFLAGS="-mmacosx-version-min=10.15"
export LDFLAGS="-mmacosx-version-min=10.15"
fi
CPPARGS="-g"
if [ "${{ matrix.cxxflags }}" != "" ] ; then
CPPARGS="$CPPARGS ${{ matrix.cxxflags }}"
fi
if [ "${{ matrix.arch }}" = "win64" ]; then
ARGS="${ARGS} --cross-file=win64-cross.txt"
fi
if [ "${{ runner.os }}" = "Linux" ] && [ "${{ matrix.name }}" != "windows" ] && [ "${{ matrix.sanitize }}" != "" ] ; then
# Address sanitizer can't find its dylibs on OS X?
ARGS="${ARGS} -Db_sanitize=${{ matrix.sanitize }}"
fi
echo meson setup build --prefix=$HOME/local --buildtype=${{ matrix.buildtype }} -Dcpp_args="$CPPARGS" ${ARGS}
meson setup build --prefix=$HOME/local --buildtype=${{ matrix.buildtype }} -Dcpp_args="$CPPARGS" ${ARGS}
- name: Upload meson log if configure failed
uses: actions/upload-artifact@v3
if: failure()
with:
name: meson-log-${{ matrix.name }}
path: '/home/runner/work/BAli-Phy/BAli-Phy/build/meson-logs/meson-log.txt'
- name: Build
run: |
ccache -p
ccache -s
ninja -C build install -j4
ccache -s
- name: Get version
id: get_version
run: |
echo "version=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT
- name: Copy shared libs (Linux)
if: matrix.arch == 'linux64'
run: |
OUTPUT=$HOME/local
cp $(${CXX} -print-file-name=libstdc++.so.6) $OUTPUT/lib/bali-phy/libstdc++.so.6
for libname in $(ldd ${OUTPUT}/bin/bali-phy | grep libboost | sed s'/\s*lib\(boost.*\) =>.*/\1/') ; do
echo cp $($CXX --print-file-name lib${libname}) ${OUTPUT}/lib/bali-phy/
cp $($CXX --print-file-name lib${libname}) ${OUTPUT}/lib/bali-phy/
done
ldd ${OUTPUT}/bin/bali-phy
- name: Copy shared libs (Windows)
if: matrix.arch == 'win64'
run: |
OUTPUT=$HOME/local
CXX=x86_64-w64-mingw32-g++-posix
# Copy compiler DLLS
for libname in gcc_s_seh-1 stdc++-6 ssp-0 winpthread-1 ; do
cp $($CXX --print-file-name lib${libname}.dll) ${OUTPUT}/bin
done
cp /home/runner/win_root/mingw64/bin/libboost_*.dll ${OUTPUT}/bin
- name: Test
run: |
export seed=$RANDOM
if [ "${{ matrix.name }}" = "windows" ] ; then
export WINEPATH=$(winepath -w $HOME/local/bin)
BALIPHY="wine bali-phy"
else
export PATH=$HOME/local/bin:$PATH
BALIPHY=bali-phy
fi
echo "Running tests with seed=$seed"
echo ::group::Basic tests
${BALIPHY} help
cp $HOME/local/share/doc/bali-phy/examples/5S-rRNA/5d-muscle.fasta .
${BALIPHY} --seed=$seed 5d-muscle.fasta --test
${BALIPHY} --seed=$seed 5d-muscle.fasta --iter=20
# Skip the rest of the tests if this is a DEBUG_MACHINE test.
debugmachine=false
case "${{ matrix.name }}" in
*-DEBUG_MACHINE) debugmachine=true ;;
esac
if [ "$debugmachine" = "false" ] ; then
echo ::group::Test suite
cd tests
./run-tests.py ${BALIPHY} --seed=$seed
cd
echo ::endgroup::
fi
git clone https://gitlab.com/testiphy/testiphy.git
cd testiphy
git checkout no-root-knuckle
rm -rf tests/likelihood/one-sequence
echo ::group::testiphy variable A
./testiphy ${BALIPHY} --seed=$seed --fix=alignment --fix=tree
echo ::endgroup::
echo ::group::testiphy fixed A
./testiphy ${BALIPHY} --seed=$seed -Inone --fix=alignment --fix=tree
echo ::endgroup::
- name: Upload tests if they failed
uses: actions/upload-artifact@v3
if: failure()
with:
name: tests-${{ matrix.name }}
path: tests