-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
92 lines (81 loc) · 2.36 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}:18.04
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:'${PYVER}'"
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
before_script:
- apt-get update -qq && apt-get install -y -qq
python3-all-dev python-virtualenv libsqlite3-dev
script:
- make test
- make sdist
artifacts:
paths:
- dist/*.tar.gz
.release-stub:
only:
- /^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+-[[:digit:]]+$/
except:
- branches
deploy-checks:
extends: .release-stub
stage: prerelease
script:
- *check-versions
- *check-changelog
deploy:pypi:
extends: .release-stub
stage: release
before_script:
- apt-get update -qq && apt-get install -y -qq
python3-all-dev python-virtualenv
script:
- make pypi_build/bin/activate
- source pypi_build/bin/activate
- twine upload --non-interactive dist/*.tar.gz
conda:
extends:
- .deploy-conda
- .release-stub
before_script:
- export CONDA_PKG=${CI_PROJECT_NAME}
- VERSION=${CI_COMMIT_TAG/v/}
- export CONDA_PKG_VERSION=$(echo $VERSION | cut -f1 -d-)
- export CONDA_PKG_BUILD=$(echo $VERSION | cut -f2 -d-)
- cd conda
# amend the default github push
push-github-mod:
extends:
- push-github
- .release-stub