-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.gitlab-ci.yml
119 lines (103 loc) · 2.86 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
image: dtuwindenergy/wetb
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
- when: always
test:
image: continuumio/anaconda3:latest
stage:
test
# except:
# - test_pypi
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
#- git submodule sync --recursive
#- git submodule update --init --recursive
- python -m pip install .[all]
script:
- python3 -m pytest --cov-report term-missing:skip-covered --cov-report xml:coverage.xml --cov=wetb
tags:
- docker, linux, shared
coverage: /(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
# ===== build documentation =====
pages: # "pages" is a job specifically for GitLab pages [1]
stage: # build, test, deploy defined by default [2]
deploy
image: registry.windenergy.dtu.dk/hawc2/hawc2-binary/dockerimages/ubuntu_conda
script: # use sphinx to build docs, move to public page
- pip install --upgrade pip
- pip install sphinx --upgrade
- pip install sphinx sphinx_rtd_theme
- pip install nbsphinx==0.3.5
- pip install git+https://github.com/vidartf/nbsphinx-link.git
- pip install -e .
- cd docs; make html
- cd ../; mv docs/build/html public/
artifacts: # required for GitLab pages [1]
paths:
- public
only: # only run for these branches
- master
- /^test_doc.*/
tags: # only runners with this tag can do the job [3]
- python
allow_failure: true
# Deploy package to local repository
upload_package_local:
image: continuumio/anaconda3:latest
tags:
- docker, linux, shared
stage: deploy
needs:
- job: build_wheel
artifacts: true
- job: test
artifacts: false
script:
- pip install twine
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --verbose --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
rules:
- if: $CI_COMMIT_TAG != null
when: always
- if: $CI_COMMIT_BRANCH == "master"
when: always
- if: $CI_COMMIT_BRANCH != "master"
when: manual
allow_failure: true
# ===== BUILD WHEELS AND UPLOAD TO PYPI =====
upload_package_pypi:
image: continuumio/anaconda3:latest
tags:
- docker, linux, shared
stage: deploy
needs:
- job: build_wheel
artifacts: true
- job: test
artifacts: false
script:
- pip install twine
- twine upload dist/* -u $TWINE_USERNAME -p $TWINE_PASSWORD
only:
- tags
- test_pypi
build_wheel:
stage: build
tags:
- linux, docker, shared
image: registry.windenergy.dtu.dk/hawc2/hawc2-binary/dockerimages/ubuntu_conda
before_script:
- git config --global --add safe.directory ${CI_PROJECT_DIR}
script:
- pip wheel . --wheel-dir=dist
artifacts:
paths:
- dist/wetb*.whl
expire_in: "1d"