Skip to content

Parameterize CTMCOnTree by the alignment type. #1417

Parameterize CTMCOnTree by the alignment type.

Parameterize CTMCOnTree by the alignment type. #1417

Workflow file for this run

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