-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
91 lines (79 loc) · 2.39 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
include:
- project: "epi2melabs/ci-templates"
file: "push-github.yaml"
- project: "epi2melabs/ci-templates"
file: "push-conda.yaml"
image: ${UBUNTUIMAGE}:20.04
.prep-image: &prep-image |
export DEBIAN_FRONTEND=noninteractive
apt update -qq
apt install -y --no-install-recommends make wget python3-all-dev python3-venv
stages:
- test
- build
- prerelease
- release
- postrelease
# Insist that the version in __init__.py matches the git tag
.check-versions: &check-versions |
PYVER="v"$(grep "__version__ = " ${CI_PROJECT_NAME}/__init__.py | awk '{gsub("\"","",$3); print $3}')
TAGVER=${CI_COMMIT_TAG}
if [[ "${PYVER}" != "${TAGVER}" ]]; then
echo "Mismatching TAG and PACKAGE versions:"
echo " - TAG:'$TAGVER'"
echo " - PACKAGE:'$TAGVER'"
exit 1
else
echo "TAG and PACKAGE versions agree: '${PYVER}'"
fi
# Insist a CHANGELOG entry has been made for tags
.check-changelog: &check-changelog |
TAGVER=${CI_COMMIT_TAG}
MATCHES=$(grep -c "## \[${TAGVER}\]" CHANGELOG.md || exit 0)
if [[ "${MATCHES}" != "1" ]]; then
echo "Expected one match to '${CI_COMMIT_TAG}' in CHANGELOG, found ${MATCHES}"
exit 1
else
echo "Found CHANGELOG.md entry for tag"
fi
test:
stage: test
script:
- *prep-image
- make test
- make docs
- make sdist
artifacts:
paths:
- aplanat_demo_report.html
- dist/*.tar.gz
deploy-checks:
stage: prerelease
script:
- *check-versions
- *check-changelog
rules:
- if: '$CI_COMMIT_TAG =~ /^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$/'
deploy:pypi:
stage: release
script:
- *prep-image
- make pypi_build/bin/activate
- source pypi_build/bin/activate
- twine upload --non-interactive dist/*.tar.gz
rules:
- if: '$CI_COMMIT_TAG =~ /^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$/'
conda:
extends:
- .deploy-conda
before_script:
- *prep-image
- export CONDA_PKG=${CI_PROJECT_NAME}
- export CONDA_PKG_VERSION=${CI_COMMIT_TAG/v/}
- cd conda
# Don't need a mac conda package since the project is pure python
deploy:trigger:
stage: postrelease
trigger: epi2melabs/nanolabs
rules:
- if: '$CI_COMMIT_TAG =~ /^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$/'