-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
123 lines (109 loc) · 2.77 KB
/
.gitlab-ci.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
stages:
- lint
- test
- build
- publish
image: continuumio/miniconda3:latest
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
CONDA_PKGS_DIRS: "$CI_PROJECT_DIR/.cache/conda"
# This will be used as a version constraint to install Python with conda in
# the setup step. Individual jobs can override this to install a different
# version of Python, if desired.
PYTHON_VERSION: "python~=3.8.0"
MAMBA_NO_BANNER: 1
FF_ENABLE_JOB_CLEANUP: 1
FF_SCRIPT_SECTIONS: 1
cache:
- key:
files:
- requirements.txt
- continuous-integration/environment.yaml
paths:
- .cache/pip
- .cache/conda
before_script:
# Install build tools for compiling packages
- apt-get update -qq && apt-get install -qqy build-essential
# Activate the conda environment - this step is skipped by default because of
# gitlab shenanigans
- source /opt/conda/etc/profile.d/conda.sh
# Install some compiled libraries from conda
- conda create --quiet --yes --name ci --no-default-packages
- conda activate ci
- conda config --env --stdin < "$CI_PROJECT_DIR/continuous-integration/condarc.yaml"
- conda install mamba "$PYTHON_VERSION"
- mamba install tox
- mamba env update --quiet -f "$CI_PROJECT_DIR/continuous-integration/environment.yaml"
# Debug information
- mamba info
- mamba list
- python3 -VV
test py38:
stage: test
needs: []
variables:
PYTHON_VERSION: "python~=3.8.0"
script:
- tox -e py38-pytest
artifacts:
when: always
reports:
junit: junit-py38-pytest.xml
cobertura: coverage-py38-pytest.xml
test py39:
stage: test
needs: []
variables:
PYTHON_VERSION: "python~=3.9.0"
script:
- tox -e py39-pytest
artifacts:
when: always
reports:
junit: junit-py39-pytest.xml
cobertura: coverage-py39-pytest.xml
lint all:
stage: lint
needs: []
script:
- tox -e isort,mypy,flake8
artifacts:
when: always
reports:
junit: report-mypy.xml
build package:
stage: build
script:
- pip3 install build
- python3 -m build
- conda install conda-build
- mkdir "./conda-packages"
- conda index ./conda-packages
- conda build --output-folder ./conda-packages conda-recipes/cemarray-core/
- conda build --output-folder ./conda-packages conda-recipes/cemarray/
- mkdir "packages"
- cp dist/cemarray-* conda-packages/noarch/cemarray*.tar.bz2 packages
artifacts:
name: "Packages"
paths:
- packages/*
build docs:
stage: build
script:
- tox -e docs
artifacts:
name: "Docs"
when: always
paths:
- docs/_build/html
expire_in: 1 week
publish docs:
stage: publish
script:
- mv docs/_build/html public
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH