forked from DTUWindEnergy/PyWake
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
169 lines (149 loc) · 4.45 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# image: continuumio/anaconda3
image: continuumio/anaconda3:2023.03-1 # until tensorflow is available for python 3.11 on windows
stages:
- test
- test_plugins
- build
- deploy
# ===== TEST PyWake debian=====
test_PyWake: # name the job what we like
stage: # build, test, deploy defined by default [2]
test
script:
- pip install --upgrade pip
- pip install -e .[test] --timeout 100 #, fails anyway if Tensorflow does not install in <10min
- pytest
tags: # only runners with this tag can do the job [3]
- ci-ubuntu
rules:
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
# ===== Check code style =====
check_code_style: # name the job what we like
stage: # build, test, deploy defined by default [2]
test
script:
- pip install -e . --user
- pycodestyle --ignore=E501,W504,E741 py_wake
tags: # only runners with this tag can do the job [3]
- ci-ubuntu
rules:
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
# ===== TEST PyWake on Windows =====
test_PyWake_windows: # name the job what we like
stage: # build, test, deploy defined by default [2]
test
script: # runs on windows machine due to tag below
- conda init powershell
- "if (test-path $PROFILE.CurrentUserAllHosts) { & $PROFILE.CurrentUserAllHosts}"
- conda activate py38
- pip install -e .[test] --no-deps
- pytest --cov-report term-missing:skip-covered --cov-report xml:coverage.xml --cov=py_wake --cov-config .coveragerc
tags: # tag for shared runner on windows machine
- ANMH_old
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
rules:
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
# ===== Trigger PyWakePark pipeline =====
trigger_pywake_park_test:
stage: test_plugins
variables:
TRIGGER_BRANCH: $CI_COMMIT_REF_NAME
trigger:
project: TOPFARM/cuttingedge/pywake/pywake_park
strategy: depend
only:
- schedules
# ===== Trigger PyWakeEllipSys pipeline =====
trigger_pywake_ellipsys_test:
stage: test_plugins
variables:
TRIGGER_BRANCH: $CI_COMMIT_REF_NAME
trigger:
project: TOPFARM/cuttingedge/pywake/pywake_ellipsys
strategy: depend
only:
- schedules
# ===== Trigger TriggerHub pipeline =====
trigger_hub_test:
stage: test
variables:
TRIGGER_BRANCH: $CI_COMMIT_REF_NAME
trigger:
project: TOPFARMPrivate/triggerhub/pywaketriggers
strategy: depend
only:
- master
# ===== build documentation =====
build_pages: # "pages" is a job specifically for GitLab pages [1]
stage: # build, test, deploy defined by default [2]
test
script: # use sphinx to build docs, move to public page
- apt-get update
- apt-get -y install make pandoc graphviz
- pip install --upgrade pip
- pip install -e .[test,docs]
- cd docs/validation_report
- python generate_validation_figures.py
- cd report
- apt-get install -y texlive-latex-extra
- pdflatex validation_report.tex
- bibtex validation_report.aux
- pdflatex validation_report.tex
- pdflatex validation_report.tex
- cd ../../
- pwd
- make html
#- make latexpdf
- cd ../
artifacts: # required for GitLab pages [1]
paths:
- docs/build/html
rules:
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual
allow_failure: true
tags: # only runners with this tag can do the job [3]
- ci-ubuntu
# ===== publish documentation =====
pages: # "pages" is a job specifically for GitLab pages [1]
stage: # build, test, deploy defined by default [2]
deploy
dependencies:
- build_pages
script: # use sphinx to build docs, move to public page
- mv docs/build/html public/
artifacts: # required for GitLab pages [1]
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual
allow_failure: true
tags: # only runners with this tag can do the job [3]
- ci-ubuntu
pypi_linux:
stage:
deploy
only:
- tags
- test_pypi
script:
- apt-get update
- pip install --upgrade pip
- pip install -e . --upgrade
- pip install --upgrade build
- pip install --upgrade twine
- python3 -m build
- twine upload dist/* -u $TWINE_USERNAME -p $TWINE_PASSWORD
tags:
- ci-ubuntu