ci: refactor conda tests, from 11 to 6 (~20 min saved)

pull/1188/head
Erik Sundell 2022-10-09 13:28:40 +02:00
rodzic 2c0b14c7da
commit f69d65feb9
41 zmienionych plików z 76 dodań i 97 usunięć

Wyświetl plik

@ -1,2 +0,0 @@
FROM doesntmatter
# this file should be ignored because there's a binder dir

Wyświetl plik

@ -1,3 +0,0 @@
dependencies:
- thiswontwork
invalid

Wyświetl plik

@ -1,5 +0,0 @@
#!/bin/bash
# install pytest with conda in the default env (should be $KERNEL_PYTHON_PREFIX)
conda install -yq pytest
# install there with pip (should be the same)
pip install there

Wyświetl plik

@ -1,13 +0,0 @@
#!/usr/bin/env python
import os
import sys
def test_sys_prefix():
# verify that pytest was installed in the notebook env
assert sys.prefix == os.environ["KERNEL_PYTHON_PREFIX"]
def test_there():
# verify that there was installed in the notebook env
import there

Wyświetl plik

@ -0,0 +1,6 @@
Default Python, and an postBuild file
-------------------------------------
We test the default Python version set by repo2docker as used when an
environment.yml file is provided without a ``python`` dependency, and the use of
a ``postBuild`` file.

Wyświetl plik

@ -0,0 +1,2 @@
#!/bin/bash
pip install there

Wyświetl plik

@ -11,6 +11,10 @@ def test_numpy():
import numpy
def test_there():
import there
def test_conda_activated():
assert os.environ.get("CONDA_PREFIX") == os.environ["NB_PYTHON_PREFIX"], dict(
os.environ

Wyświetl plik

@ -0,0 +1,4 @@
Python 2
--------
Test setup of a Python 2 environment.

Wyświetl plik

@ -0,0 +1,17 @@
Python 3.10 (latest), and an ignored requirements file
------------------------------------------------------
The reasons for testing 3.10 specifically is that it is the latest version of
Python 3 supported by repo2docker's conda buildpack. See
``repo2docker/buildpacks/conda`` for details.
An ``environment.yml`` file takes precedence over ``requirements.txt``.
To install Python packages into a conda environment with pip, use the
``pip`` key in ``environment.yml``:
.. sourcecode:: yaml
dependencies:
- numpy
- pip:
- tornado

Wyświetl plik

@ -1,4 +1,5 @@
dependencies:
- python=3.10
- numpy
- pip:
- simplejson

Wyświetl plik

@ -1,7 +1,7 @@
#!/usr/bin/env python
import sys
assert sys.version_info[:2] == (3, 7), sys.version
assert sys.version_info[:2] == (3, 10), sys.version
import numpy

Wyświetl plik

@ -1,2 +0,0 @@
dependencies:
- python=3.10

Wyświetl plik

@ -1,4 +0,0 @@
#!/usr/bin/env python
import sys
assert sys.version_info[:2] == (3, 10), sys.version

Wyświetl plik

@ -0,0 +1,2 @@
# This file should be ignored because there's a dedicated binder folder
FROM doesntmatter

Wyświetl plik

@ -0,0 +1,9 @@
Python 3.5, and a dedicated binder folder
-----------------------------------------
Test setup of Python 3.5 and the use of a dedicated binder folder that should
make files in the root directory be ignored.
The reasons for testing 3.5 specifically is that it is the oldest version of
Python 3 supported by repo2docker's conda buildpack. See
``repo2docker/buildpacks/conda`` for details.

Wyświetl plik

@ -0,0 +1,4 @@
# This file should be ignored as we have a dedicated binder folder.
dependencies:
- thiswontwork
invalid

Wyświetl plik

@ -1,2 +0,0 @@
dependencies:
- python=3.7

Wyświetl plik

@ -1,4 +0,0 @@
#!/usr/bin/env python
import sys
assert sys.version_info[:2] == (3, 7), sys.version

Wyświetl plik

@ -0,0 +1,5 @@
Default R
---------
We test the default R version set by repo2docker as used when r-base is
specified without a version in an environment.yml file.

Wyświetl plik

@ -1,3 +1,3 @@
dependencies:
- r-base
- r-ggplot2
- r-digest

Wyświetl plik

@ -2,6 +2,9 @@
jupyter serverextension list 2>&1 | grep jupyter_server_proxy
jupyter nbextension list 2>&1 | grep jupyter_server_proxy
R -e "library('ggplot2')"
# Fail if version is not at least 4.1
R -e 'if (!(version$major == "4" && as.double(version$minor) >= 1)) quit("yes", 1)'
R -e "library('digest')"
# Fail if version is not at least 4.2
R --version
R -e 'if (!(version$major == "4" && as.double(version$minor) >= 2)) quit("yes", 1)'

Wyświetl plik

@ -0,0 +1,7 @@
R 3.6, and an extra-args.yaml file
----------------------------------
We want to support custom paths where repositories can be copied to, instead of
${HOME}. The `extra-args.yaml` file in each dir can contain a list of arguments
that are passed to repo2docker during the test. We copy this repo to /srv/repo
instead of ${HOME}

Wyświetl plik

@ -1,3 +1,3 @@
dependencies:
- r-base=3.6
- r-testthat
- r-digest

Wyświetl plik

@ -2,6 +2,11 @@
jupyter serverextension list 2>&1 | grep jupyter_server_proxy
jupyter nbextension list 2>&1 | grep jupyter_server_proxy
R -e "library('testthat')"
R -e "library('digest')"
# Fail if version is not 3.6
R --version
R -e 'if (!(version$major == "3" && as.double(version$minor) >= 6 && as.double(version$minor) < 7)) quit("yes", 1)'
./verify.py

Wyświetl plik

@ -15,6 +15,3 @@ assert os.path.abspath(__file__) == "/srv/repo/verify"
# Repo should be writable
assert os.access("/srv/repo", os.W_OK)
# We should be able to import the package in environment.yml
import numpy

Wyświetl plik

@ -1,3 +0,0 @@
dependencies:
- r-base=4.2
- r-ggplot2

Wyświetl plik

@ -1,7 +0,0 @@
#!/bin/sh
jupyter serverextension list 2>&1 | grep jupyter_server_proxy
jupyter nbextension list 2>&1 | grep jupyter_server_proxy
R -e "library('ggplot2')"
# Fail if version is not 4.2
R -e 'if (!(version$major == "4" && as.double(version$minor) >= 2 && as.double(version$minor) < 3)) quit("yes", 1)'

Wyświetl plik

@ -1,8 +0,0 @@
Python - Custom Repository Location
-----------------------------------
We want to support custom paths where repositories can be
copied to, instead of ${HOME}. The `extra-args.yaml` file in
each dir can contain a list of arguments that are passed
to repo2docker during the test. We copy this repo to
/srv/repo instead of ${HOME}

Wyświetl plik

@ -1,2 +0,0 @@
dependencies:
- numpy

Wyświetl plik

@ -1,13 +0,0 @@
Conda - Mixed Requirements
--------------------------
An ``environment.yml`` file takes precedence over ``requirements.txt``.
To install Python packages into a conda environment with pip, use the
``pip`` key in ``environment.yml``:
.. sourcecode:: yaml
dependencies:
- numpy
- pip:
- tornado

Wyświetl plik

@ -1,10 +0,0 @@
Conda Environment and Python 2
------------------------------
``environment.yml`` is the standard method for defining environments with the
Anaconda (conda) distribution. Conda environment files may allow for more
complex builds and dependencies than are possible with a single
``requirements.txt`` file.
This example shows how to define a Python 2 environment with Anaconda. You can
define any version of Python that Anaconda supports.

Wyświetl plik

@ -1,7 +0,0 @@
Conda Environment
-----------------
``environment.yml`` is the standard method for defining environments with the
Anaconda (conda) distribution. Conda environment files may allow for more
complex builds and dependencies than are possible with a single
``requirements.txt`` file.

Wyświetl plik

@ -1,2 +0,0 @@
#!/bin/sh
pytest -v ./verify.py