tests #1653
This file contains hidden or 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-latest | |
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 | |
# BCH 2/12/2025: Ubuntu 22.04 is being discontinued, shifting forward | |
- { os: ubuntu-22.04, gcc: 9, python: 3.9 } | |
- { os: ubuntu-24.04, gcc: 12, python: 3.12 } | |
# 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.12 } | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Setup Miniforge | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-version: latest | |
activate-environment: anaconda-client-env | |
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: conda 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 -DCMAKE_BUILD_TYPE=Debug .. && \ | |
make -j 2 && \ | |
# Show any output from the test program whenever the test fails | |
env CTEST_OUTPUT_ON_FAILURE=1 make test | |
- name: Build and test (Release) | |
run: | | |
mkdir Release && \ | |
cd Release && \ | |
cmake -DCMAKE_BUILD_TYPE=Release .. && \ | |
make -j 2 && \ | |
# Show any output from the test program whenever the test fails | |
env CTEST_OUTPUT_ON_FAILURE=1 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.9 } | |
- { sys: ucrt64, env: ucrt-x86_64, python: 3.9 } | |
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 Miniforge | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-version: latest | |
activate-environment: anaconda-client-env | |
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 | |
env: | |
# Increase this value to reset cache if treerec/tests/environment.yml has not changed | |
CACHE_NUMBER: 0 | |
with: | |
# Use faster GNU tar | |
enableCrossOsArchive: true | |
path: D:\conda_pkgs_dir | |
key: | |
conda-${{ runner.os }}--python-${{ matrix.python }}--${{ runner.arch }}--${{ | |
steps.get-date.outputs.today }}-${{ | |
hashFiles('treerec/tests/environment.yml') }}-${{ env.CACHE_NUMBER}} | |
id: cache | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
activate-environment: anaconda-client-env | |
environment-file: treerec/tests/environment.yml | |
pkgs-dirs: D:\conda_pkgs_dir | |
- name: Update environment | |
shell: bash -el {0} | |
run: conda 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 && \ | |
# Show any output from the test program whenever the test fails | |
env CTEST_OUTPUT_ON_FAILURE=1 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 && \ | |
# Show any output from the test program whenever the test fails | |
env CTEST_OUTPUT_ON_FAILURE=1 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: | |
# BCH 2/12/2025: Ubuntu 22.04 is being discontinued, shifting forward | |
# Ubuntu 22.04 with the oldest supported Qt5 and GCC. | |
- { os: ubuntu-22.04, qt: 5.9.5, gcc: 9 } | |
# Ubuntu 22.04 with last official LTS Qt5 and GCC. | |
- { os: ubuntu-22.04, qt: 5.15.2, gcc: 12 } | |
# Ubuntu 24.04 with the most recent Qt6 and GCC. | |
- { os: ubuntu-22.04, qt: 6.8.2, gcc: 12 } | |
# old macOS with oldest supported Qt5; macos-12 was removed by GitHub, | |
# so we can't CI with Qt 5.9.5 any more, oh well | |
#- {os: macos-12, qt: 5.9.5} | |
# old macOS with last official LTS Qt5 | |
- { os: macos-13, qt: 5.15.2 } | |
# new macOS with most recent Qt6 | |
- { os: macos-15, qt: 6.8.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 -DCMAKE_BUILD_TYPE=Release .. && \ | |
make -j 2 && \ | |
# Show any output from the test program whenever the test fails | |
env CTEST_OUTPUT_ON_FAILURE=1 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 && \ | |
# Show any output from the test program whenever the test fails | |
env CTEST_OUTPUT_ON_FAILURE=1 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 |