Skip to content

Change tests

Change tests #747

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: build
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
pull_request:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019, macos-latest]
python-version: ["3.8", "3.10", "3.11"]
include:
- os: windows-2019
triplet: x64-windows
env:
CONDA_ENV_NAME: gadma_env
steps:
- name: Cancel previous runs.
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout.
uses: actions/checkout@v2
- name: find conda
id: find-conda
run: |
echo "CONDA=$CONDA" >> $GITHUB_OUTPUT
- name: fix conda permissions
if: runner.os == 'macOS'
run: |
# Fix incorrect conda permissions on mac that prevent cache restore.
sudo chown -R $USER:staff ${{ steps.find-conda.outputs.CONDA }}
- name: cache conda
id: cache
uses: actions/cache@v3
env:
# Increase this to reset the cache if the key hasn't changed.
CACHE_NUM: 9
with:
path: |
${{ steps.find-conda.outputs.CONDA }}/envs/${{ env.CONDA_ENV_NAME }}
~/.bash_profile
key: ${{ runner.os }}-${{ matrix.python }}-conda-${{ hashFiles('requirements/CI/*') }}-${{ env.CACHE_NUM }}
- name: install conda
uses: conda-incubator/setup-miniconda@v2
if: steps.cache.outputs.cache-hit != 'true'
with:
activate-environment: ${{ env.CONDA_ENV_NAME }}
python-version: ${{ matrix.python }}
channels: conda-forge, bioconda
channel-priority: strict
auto-update-conda: true
use-only-tar-bz2: true
- name: move profile
if: steps.cache.outputs.cache-hit != 'true' && runner.os != 'Windows'
run: |
# The setup-miniconda action leaves different shell init files for
# different OSes. Bash gives priority to ~/.bash_profile, so here we
# ensure that's used for all platforms.
mv ~/.profile ~/.bash_profile
- name: install dadi and scikit-allel using conda.
if: steps.cache.outputs.cache-hit != 'true'
run: |
conda install dadi
conda install scikit-allel
- name: Install GADMA and its dependencies.
run: |
bash install
# pip3 install Cython==0.29.18 # otherwise ConfigsSpace cause error for macOS
# TypeError: Expected float, got numpy.float64 when using Float
pip3 install -r requirements/bayes_opt.txt
pip3 install -r requirements/bayes_opt_addit.txt
pip3 install .
- name: Uninstall SMAC (Windows).
if: runner.os == 'Windows'
shell: bash -l {0}
run: |
pip3 uninstall -y smac
- name: Uninstall SMAC (MacOS py3.6)
if: runner.os == 'MacOS' && matrix.python-version == '3.6'
run: pip3 uninstall -y smac
- name: Check installations of packages.
run: |
python3 -c "import numpy"
python3 -c "import scipy"
python3 -c "import dadi"
python3 -c "import moments"
python3 -c "import gadma"
- name: Show versions of all installed packages.
run: python3 -m pip freeze
- name: Show available engines and optimizations in gadma.
run: |
python3 -c "import gadma;print(gadma.engines.engine._registered_engines.keys())"
python3 -c "import gadma;print(gadma.optimizers.global_optimizer._registered_global_optimizers.keys())"
- name: Install dependencies for tests.
run: |
pip3 install -r requirements/tests.txt
- name: Run tests and codecov.
run: |
pytest --timeout=600 --cov=gadma --cov-report=xml -v tests --disable-warnings
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
if: runner.os == 'Linux' && matrix.python-version == '3.6'