tests #1303
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: tests | |
on: | |
# Run tests on every push to the main branch, | |
# on every pull request, and once a week (every monday at 05:00) | |
push: | |
pull_request: | |
schedule: | |
- cron: '0 5 * * 1' | |
jobs: | |
canceller: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Cancel previous runs | |
uses: styfle/[email protected] | |
tests-Unix-CLI: | |
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository == 'messerlab/slim') | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# Ubuntu with the oldest supported GCC | |
# (used to be 4.8, but with 20.04 it is 7, sadly). | |
- {os: ubuntu-20.04, gcc: 7, python: 3.8} | |
- {os: ubuntu-20.04, gcc: 11, python: 3.9} | |
# macOS, oldest supported version | |
# (macos-10.15, macos-11, and macos-12 were removed by GitHub) | |
- {os: macos-13, python: 3.9} | |
# macOS, newest supported version | |
- {os: macos-15, python: 3.9} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Setup Mambaforge | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
activate-environment: anaconda-client-env | |
use-mamba: true | |
python-version: ${{ matrix.python }} | |
- name: Get Date | |
id: get-date | |
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache Conda env | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.CONDA }}/envs | |
key: | |
conda-${{ runner.os }}--python-${{ matrix.python }}--${{ runner.arch }}--${{ | |
steps.get-date.outputs.today }}-${{ | |
hashFiles('treerec/tests/environment.yml') }}-${{ env.CACHE_NUMBER}} | |
env: | |
# Increase this value to reset cache if | |
# treerec/tests/environment.yml has not changed | |
CACHE_NUMBER: 0 | |
id: cache | |
- name: Update environment | |
run: | |
mamba env update -n anaconda-client-env -f treerec/tests/environment.yml | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Workaround for gcc-11 | |
if: startsWith(matrix.os, 'ubuntu') && matrix.gcc == 11 | |
run: | | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ | |
sudo apt-get update -y | |
- name: Set up default GCC (in Ubuntu) | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo apt-get install gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }} && \ | |
sudo update-alternatives \ | |
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc }} 100 \ | |
--slave /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.gcc }} | |
- name: Build and test (Debug) | |
run: | | |
mkdir Debug && \ | |
cd Debug && \ | |
cmake -D CMAKE_BUILD_TYPE=Debug .. && \ | |
make -j 2 && make test | |
- name: Build and test (Release) | |
run: | | |
mkdir Release && \ | |
cd Release && \ | |
cmake -D CMAKE_BUILD_TYPE=Release .. && \ | |
make -j 2 && make test | |
- name: Treesequence tests | |
shell: bash -el {0} | |
run: | | |
conda activate anaconda-client-env && \ | |
export PATH=$PATH:$PWD/Release && \ | |
echo $PATH && \ | |
cd treerec/tests && python -m pytest -xv | |
tests-Windows-CLI: | |
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository == 'messerlab/slim') | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {sys: mingw64, env: x86_64, python: 3.8} | |
- {sys: ucrt64, env: ucrt-x86_64, python: 3.8} | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Setup MSYS2 ${{matrix.sys}} | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{matrix.sys}} | |
update: true | |
install: >- | |
git | |
base-devel | |
msys2-devel | |
mingw-w64-${{matrix.env}}-toolchain | |
mingw-w64-${{matrix.env}}-cmake | |
- name: Setup Mambaforge | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
activate-environment: anaconda-client-env | |
use-mamba: true | |
auto-update-conda: true | |
python-version: ${{ matrix.python }} | |
- name: Get Date | |
id: get-date | |
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache Conda env | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.CONDA }}/envs | |
key: | |
conda-${{ runner.os }}--python-${{ matrix.python }}--${{ runner.arch }}--${{ | |
steps.get-date.outputs.today }}-${{ | |
hashFiles('treerec/tests/environment.yml') }}-${{ env.CACHE_NUMBER}} | |
env: | |
# Increase this value to reset cache if | |
# treerec/tests/environment.yml has not changed | |
CACHE_NUMBER: 0 | |
id: cache | |
- name: Update environment | |
shell: bash -el {0} | |
run: | |
mamba env update -n anaconda-client-env -f treerec/tests/environment.yml | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Build and test (Debug) | |
run: | | |
cd windows_compat/gnulib && \ | |
touch --date="`date`" aclocal.m4 Makefile.am configure configure.ac config.h.in Makefile.in && \ | |
cd ../.. && \ | |
mkdir Debug && \ | |
cd Debug && \ | |
cmake -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug .. && \ | |
make -j 2 && make test | |
- name: Build and test (Release) | |
run: | | |
cd windows_compat/gnulib && \ | |
touch --date="`date`" aclocal.m4 Makefile.am configure configure.ac config.h.in Makefile.in && \ | |
cd ../.. && \ | |
mkdir Release && \ | |
cd Release && \ | |
cmake -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release .. && \ | |
make -j 2 && make test | |
- name: Treesequence tests | |
shell: bash -el {0} | |
run: | | |
conda activate anaconda-client-env && \ | |
export PATH=$PATH:$PWD/Release && \ | |
echo $PATH && \ | |
cd treerec/tests && python -m pytest -xv | |
tests-Unix-GUI: | |
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository == 'messerlab/slim') | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# Ubuntu 20.04 with the oldest supported Qt5 and GCC. | |
- {os: ubuntu-20.04, qt: 5.9.5, gcc: 7} | |
# Ubuntu 20.04 with the most recent Qt5 and GCC. | |
- {os: ubuntu-20.04, qt: 5.15.2, gcc: 11} | |
# Ubuntu 22.04 with the most recent Qt5 and GCC. | |
- {os: ubuntu-22.04, qt: 5.15.2, gcc: 12} | |
# Ubuntu 22.04 with the most recent Qt6 and GCC; this is the min for Qt6 | |
- {os: ubuntu-22.04, qt: 6.7.2, gcc: 12} | |
# old macOS with oldest supported Qt5 | |
- {os: macos-12, qt: 5.9.5} | |
# new macOS with most recent Qt5 | |
- {os: macos-13, qt: 5.15.2} | |
# new macOS with most recent Qt6 | |
- {os: macos-13, qt: 6.7.2} | |
runs-on: ${{ matrix.os }} | |
env: | |
CXXFLAGS: -D NO_QT_VERSION_ERROR | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Workaround for gcc-11 | |
if: startsWith(matrix.os, 'ubuntu') && matrix.gcc == 11 | |
run: | | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ | |
sudo apt-get update -y | |
- name: Set up default GCC (in Ubuntu) | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo apt-get install gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }} && \ | |
sudo update-alternatives \ | |
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc }} 100 \ | |
--slave /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.gcc }} | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: ${{ matrix.qt }} | |
- name: Release build with SLiMGUI | |
run: | | |
mkdir Release && \ | |
cd Release && \ | |
cmake -D BUILD_SLIMGUI=ON -D CMAKE_BUILD_TYPE=Release .. && \ | |
make -j 2 && make test | |
tests-Windows-GUI: | |
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository == 'messerlab/slim') | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {sys: mingw64, env: x86_64} | |
- {sys: ucrt64, env: ucrt-x86_64} | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Setup MSYS2 ${{matrix.sys}} | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{matrix.sys}} | |
update: true | |
install: >- | |
git | |
base-devel | |
msys2-devel | |
mingw-w64-${{matrix.env}}-toolchain | |
mingw-w64-${{matrix.env}}-cmake | |
mingw-w64-${{matrix.env}}-qt5-base | |
- name: Release build | |
run: | | |
cd . && \ | |
cd windows_compat/gnulib && \ | |
touch --date="`date`" aclocal.m4 Makefile.am configure configure.ac config.h.in Makefile.in && \ | |
cd ../.. && \ | |
mkdir Release && \ | |
cd Release && \ | |
cmake -G"MSYS Makefiles" -DBUILD_SLIMGUI=ON -DCMAKE_BUILD_TYPE=Release .. && \ | |
make -j 2 && make test | |
tests-windows-latest-pacman: | |
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository == 'messerlab/slim') | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {sys: mingw64, env: x86_64} | |
- {sys: ucrt64, env: ucrt-x86_64} | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Setup MSYS2 ${{matrix.sys}} | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{matrix.sys}} | |
update: true | |
install: >- | |
mingw-w64-${{matrix.env}}-slim-simulator | |
- name: Test | |
run: | | |
eidos -testEidos | |
slim -testEidos | |
slim -testSLiM |