-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
107 lines (94 loc) · 2.27 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
# common configuration for python gitlab-ci jobs
stages:
- test
- build
- lint
- deploy
# in some cases we only want these items for debugging so factor them out
.common-before-script: &common-before-script
- set -x
- date
- whoami
- pwd
# common rules to only run jobs on MRs, normal branches, or tags
.common-rules: &common-rules
rules:
- if: $CI_MERGE_REQUEST_ID
- if: '$CI_COMMIT_BRANCH == "main"'
- if: $CI_COMMIT_TAG
# `tox` jobs are selected using the TOXENV variable or,
# if that is not defined, the job name environment variable
.common-run-tox: &common-run-tox
- tox -e ${TOXENV:-$CI_JOB_NAME}
default:
tags:
- livljobs
before_script:
- *common-before-script
- conda activate apds-pusher-tox
setup:
stage: .pre
before_script:
- *common-before-script
script:
- conda env update --prune --name apds-pusher-tox --file environment-tox.yml
rules:
- changes:
- environment-tox.yml
- when: manual
allow_failure: true
# hidden base job for running `tox` command jobs
.tox-job:
script:
- *common-run-tox
<<: *common-rules
lint:
extends: .tox-job
stage: lint
py38:
extends: .tox-job
stage: test
coverage: '/TOTAL.*\s+(\d+%)$/'
artifacts:
reports:
junit: junit.xml
cobertura: coverage.xml
build:
extends: .tox-job
stage: build
docs:
extends: .tox-job
stage: build
# TODO: not optimal as we rebuild the docs
pages:
extends: docs
stage: deploy
variables:
TOXENV: "docs"
DOCSPATH: "docs/build/html"
script:
- *common-run-tox
- mkdir public
- cp -a "${DOCSPATH}/." public
artifacts:
paths:
- public
rules:
# only run on release tags
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/'
# TODO: not optimal as we rebuild the package
pypi:
extends: build
stage: deploy
variables:
TOXENV: "build"
BUILDPATH: "dist"
script:
- *common-run-tox
- twine upload --repository-url "$PYPI_REPO" -u "$PYPI_USER" -p "$PYPI_PASSWORD" "$BUILDPATH/*"
rules:
# push to pypi for any alpha, beta, release candidate, or release
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+a\d+$/'
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+b\d+$/'
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+rc\d+$/'
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d$/'