-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpython-tester-conda.yml
67 lines (67 loc) · 2.66 KB
/
python-tester-conda.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
version: ~> 1.0
# Run conda tests on all versions from NEP 29
jobs:
include:
- &testpythonconda
stage: test
name: "Python 3.8"
env:
- PYTHON_VERSION: "3.8"
- QT_QPA_PLATFORM: offscreen
workspaces:
use: conda
install: skip
before_script:
# Download micromamba
- curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba
# Set up the shell for micromamba: adds some wrapper bash functions to the env
- eval "$(./bin/micromamba shell hook --shell=bash)"
# Create the directory where our environments are stored, equivalent to miniconda's ~/miniconda3
- mkdir ~/micromamba
# Activate our empty env and set up channel config
- micromamba activate
- micromamba config set always_yes yes
- micromamba config set changeps1 no
- micromamba config set channel_priority strict
- micromamba config remove channels defaults
- micromamba config prepend channels pcds-tag
- micromamba config prepend channels conda-forge
- micromamba config prepend channels "file://`pwd`/bld-dir"
# Useful for debugging
- micromamba info
- micromamba config list
- echo "Conda Environment Name':' ${CONDA_ENV_NAME:=testenv}"
- echo "Conda Requirements':' ${CONDA_REQUIREMENTS:=dev-requirements.txt}"
- echo "Conda packages installed for CI':' ${CONDA_CI_PACKAGES:=pytest-cov}"
# Manage conda environment
- micromamba create -n ${CONDA_ENV_NAME} python=$PYTHON_VERSION ${CONDA_PACKAGE} ${CONDA_EXTRAS} ${CONDA_CI_PACKAGES} --file ${CONDA_REQUIREMENTS}
- micromamba activate ${CONDA_ENV_NAME}
# Useful for debugging
- micromamba list
script:
- |
PYTEST_ARGS=(-v)
PYTEST_ARGS+=(--cov=.)
PYTEST_ARGS+=(--log-file="${AFTER_FAILURE_LOGFILE:-logs/run_tests_log.txt}")
PYTEST_ARGS+=(--log-format='%(asctime)s.%(msecs)03d %(module)-15s %(levelname)-8s %(threadName)-10s %(message)s')
PYTEST_ARGS+=(--log-file-date-format='%H:%M:%S')
PYTEST_ARGS+=(--log-level=DEBUG)
- pytest "${PYTEST_ARGS[@]}"
after_failure:
- LOGFILE="${AFTER_FAILURE_LOGFILE:-logs/run_tests_log.txt}"
- |
if [ -f "${LOGFILE}" ]; then
cat "${LOGFILE}"
else
echo "Logfile ${LOGFILE} not found"
fi
- <<: *testpythonconda
name: "Python 3.9"
env:
- PYTHON_VERSION: "3.9"
- <<: *testpythonconda
name: "Python 3.10"
env:
- PYTHON_VERSION: "3.10"
allow_failures:
- name: "Python 3.10"