-
Notifications
You must be signed in to change notification settings - Fork 6
/
.gitlab-ci.yml
152 lines (140 loc) · 4.52 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
variables:
ENERGYPLUS_DOWNLOAD_FILENAME: EnergyPlus-9.5.0-de239b2e5f-Linux-Ubuntu20.04-x86_64.sh
ENERGYPLUS_EXE: /usr/local/bin/EnergyPlus
ENERGYPLUS_VER: "9.5.0"
POETRY_VIRTUALENVS_IN_PROJECT: "True"
TZ: Europe/Zurich # needs to be set for silent install of tzdata package, used by texlive packages
DEBIAN_FRONTEND: noninteractive # needs to be set for silent install of tzdata package, used by texlive packages
# use ubuntu image instead of pyhton:3.x as E+ installation does not work on the python image
image: "ubuntu:20.04"
before_script:
- apt-get update -yq
- apt-get install -yq python3-pip python3-dev # get latest python 3 version, at time of configuring this is python 3.8.5
- apt-get install -yq x11-apps # we need those X11 libs in order that E+ will run
- pip3 install --upgrade pip
- chmod +x $ENERGYPLUS_DOWNLOAD_FILENAME
- echo "y\r" | ./$ENERGYPLUS_DOWNLOAD_FILENAME
- /usr/local/bin/EnergyPlus --version
- python3 --version
- which python3
- pip3 install poetry # poetry is the project management tool used
- poetry install # install cesar-p-core library (this project)
- pip install geopandas
stages:
- Test
- Deploy
static_tests:
stage: Test
allow_failure: false
script:
- poetry run flake8 src --output-file style-guide-check-flake8-report.txt
- poetry run mypy src --junit-xml typing-check-mypy-report.xml
artifacts:
paths:
- style-guide-check-flake8-report.txt
- typing-check-mypy-report.xml
expire_in: 1 week
when: always
timeout: 5 minutes
unit_test:
stage: Test
script:
- poetry run pytest --cov --html=unit_test_report.html --self-contained-html --capture=sys
- poetry run coverage html # for coverage settings and threshold see .coveragerc; note that tests for cesarp.sia2024 are not included in cesar-p-core because the data is cannot be shared as open source
artifacts:
paths:
- unit_test_report.html
- ./htmlcov
expire_in: 1 week
when: always
timeout: 20 minutes
pages-internal:
stage: Deploy
script:
- mkdir internal_docs
- cd docs/source/empa-internal
- poetry run sphinx-build . ../../../internal_docs
artifacts:
paths:
- internal_docs
only:
- production
- master
pdfdoc-internal:
stage: Deploy
script:
- apt-get -y install make
- apt-get install -y --no-install-recommends texlive-latex-recommended texlive-fonts-recommended
- apt-get install -y --no-install-recommends texlive-latex-extra texlive-fonts-extra texlive-lang-all
- apt-get install -y latexmk
- mkdir pdfdoc
- cd docs/source/empa-internal
- poetry run sphinx-build -b latex . _latex
- cd _latex
- make
- ls -al
- cp cesar-p-empa-internal.pdf ../../../../cesar-p-empa-internal.pdf
artifacts:
paths:
- cesar-p-empa-internal.pdf
only:
- production
- master
pages-public:
stage: Deploy
script:
- mkdir public
- cd docs/source/public
- poetry add sphinxcontrib-svg2pdfconverter
- poetry run sphinx-build . ../../../public
artifacts:
paths:
- public # if gitlab pages would be enabled in the gitlab.empa.ch installation that directory should be published automatically
pdfdoc-public:
stage: Deploy
script:
- apt-get -y install make
- apt-get install -y --no-install-recommends texlive-latex-recommended texlive-fonts-recommended
- apt-get install -y --no-install-recommends texlive-latex-extra texlive-fonts-extra texlive-lang-all
- apt-get install -y latexmk
- apt-get install librsvg2-2
- apt-get install librsvg2-bin
- poetry add sphinxcontrib-svg2pdfconverter
- mkdir pdfdoc
- cd docs/source/public
- poetry run sphinx-build -b latex . _latex
- cd _latex
- make
- ls -al
- cp cesar-p.pdf ../../../../cesar-p.pdf
artifacts:
paths:
- cesar-p.pdf
publish:
stage: Deploy
variables:
TWINE_USERNAME: gitlab-ci-token
TWINE_PASSWORD: ${CI_JOB_TOKEN} # CI_JOB_TOKEN is a pre-defined variable, see https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
script:
- poetry build
- pip3 install twine
- python3 -m twine upload --repository-url https://gitlab.empa.ch/api/v4/projects/805/packages/pypi dist/*
artifacts:
paths:
- dist/*
only:
- production
publish-pypi-public:
stage: Deploy
variables:
TWINE_USERNAME: ${PYPI_USER}
TWINE_PASSWORD: ${PYPI_PASSWORD}
script:
- poetry build
- pip3 install twine
- python3 -m twine upload dist/*
artifacts:
paths:
- dist/*
only:
- production-open-source