Tests #916
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: | |
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: | |
include: | |
- os: ubuntu-latest | |
- os: macos-latest | |
env: | |
CONDA_ENV: 'test_env' | |
VERSION_PYTHON: ${{ matrix.version_python }} | |
BENCHOPT_BRANCH: benchopt:main | |
BENCHOPT_DEBUG: 1 | |
BENCHOPT_CONDA_CMD: mamba | |
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: Cache datasets | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-datasets-v2 | |
with: | |
path: | | |
data | |
~/tensorflow_datasets | |
key: build-${{ env.cache-name }} | |
restore-keys: | | |
build-${{ env.cache-name }} | |
- name: Setup Conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: ${{ env.CONDA_ENV }} | |
python-version: 3.8 | |
# Use miniforge to only get conda-forge as default channel. | |
miniforge-version: latest | |
- run: conda info | |
- name: Install benchopt and its dependencies | |
run: | | |
conda info | |
conda install -yq pip | |
# Get the correct branch of benchopt | |
user=${BENCHOPT_BRANCH%:*} | |
branch=${BENCHOPT_BRANCH##*:} | |
pip install -U git+https://github.com/$user/benchopt@$branch | |
conda install -c conda-forge mamba | |
- name: Test | |
run: | | |
benchopt test . --env-name bench_test_env -vl | |
benchopt test . --env-name bench_test_env -vl --skip-install | |
linter-flake8: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Lint with flake8 | |
run: | | |
pip install flake8 | |
flake8 . | |
benchmark-tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
- os: macos-latest | |
env: | |
CONDA_ENV: 'test_env' | |
VERSION_PYTHON: ${{ matrix.version_python }} | |
BENCHOPT_BRANCH: benchopt:main | |
BENCHOPT_DEBUG: 1 | |
BENCHOPT_CONDA_CMD: mamba | |
LD_LIBRARY_PATH: /usr/share/miniconda3/lib:/usr/share/miniconda3/envs/test_env/lib:$LD_LIBRARY_PATH | |
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: Cache datasets | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-datasets | |
with: | |
path: | | |
data | |
~/tensorflow_datasets | |
key: build-${{ env.cache-name }} | |
restore-keys: | | |
build-${{ env.cache-name }} | |
- name: Setup Conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: ${{ env.CONDA_ENV }} | |
python-version: 3.8 | |
# Use miniforge to only get conda-forge as default channel. | |
miniforge-version: latest | |
- run: conda info | |
- name: Install benchopt and its dependencies | |
run: | | |
conda info | |
conda install -yq pip | |
# Get the correct branch of benchopt | |
user=${BENCHOPT_BRANCH%:*} | |
branch=${BENCHOPT_BRANCH##*:} | |
pip install -U git+https://github.com/$user/benchopt@$branch | |
conda install -c conda-forge mamba | |
- name: install test dependencies | |
run: | | |
mamba install -c conda-forge --file=test_torch_requirements.txt | |
pip install -r test_tf_requirements.txt | |
- name: Test | |
run: | | |
pytest |