Skip to content

Tests

Tests #122

name: Tests
on:
push:
branches:
- main
create:
tags:
- '**'
pull_request:
branches:
- main
schedule:
# Run every day at 7:42am UTC.
- cron: '42 7 * * *'
jobs:
test-benchmark:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest']
exclude:
# Only run OSX test on version==git, not on the release ones.
- os: ${{ inputs.benchopt_version == 'git' || 'macos-latest' }}
env:
CONDA_ENV: 'test_env'
BENCHOPT_BRANCH: benchopt@main
BENCHOPT_VERSION: git
BENCHOPT_DEBUG: 1
BENCHOPT_CONDA_CMD: mamba
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True
PYTEST_EXTRA_ARGS: ""
defaults:
run:
# Need to use this shell to get conda working properly.
# See https://github.com/marketplace/actions/setup-miniconda#important
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniforge-variant: Mambaforge
use-mamba: true
channels: conda-forge
python-version: 3.9
activate-environment: ${{ env.CONDA_ENV }}
- run: conda info
- name: Install benchopt and its dependencies
run: |
conda info
mamba install -yq pip
# Get the correct branch of benchopt
if [[ "$BENCHOPT_VERSION" == "git" ]]
then
user=${BENCHOPT_BRANCH%@*}
branch=${BENCHOPT_BRANCH##*@}
pip install -U git+https://github.com/$user/benchopt@$branch
elif [[ "$BENCHOPT_VERSION" == "latest" ]]
then
pip install -U benchopt
else
pip install -U benchopt==$BENCHOPT_VERSION
fi
- name: FLamby
run: |
git clone https://github.com/owkin/FLamby.git
cd FLamby
python -m pip install --upgrade pip
pip install pytest
pip install -e ."[all_extra]"
python ./flamby/datasets/fed_synthetic/dataset_creation_scripts/download.py --output-folder ./synthetic --classification
- name: Tests
run: |
benchopt test . --env-name test_env -vl $PYTEST_EXTRA_ARGS
# Avoid having too large cache between two runs
benchopt clean .
benchopt test . --env-name test_env -vl --skip-install $PYTEST_EXTRA_ARGS