-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
162 lines (151 loc) · 3.46 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
stages:
- lint
- test
- publish
- deploy
default:
image: python:3.8
tags:
- docker_dio
.setup-poetry:
before_script:
- python --version
- pip install --upgrade pip
- pip install poetry
- poetry --version
- poetry config virtualenvs.in-project true --local
.install-fortran:
before_script:
- apt-get update
- apt-get install -y gfortran ncurses-dev
lint-job:
stage: lint
needs: []
before_script:
- !reference [.setup-poetry, before_script]
# install pre-commit
- poetry run pip install pre-commit
script:
# run pre-commit
- poetry run pre-commit run -a
only:
- develop
- master
- tags
- merge_requests
- web
type-check-job:
stage: lint
needs: []
before_script:
- !reference [.setup-poetry, before_script]
- !reference [.install-fortran, before_script]
# install maser and dependencies (including mypy)
- poetry install
script:
# run mypy
- poetry run mypy src/maser_data #
only:
- develop
- master
- tags
- merge_requests
- web
test-job:
stage: test
needs: []
variables:
CDF_URL: 'https://spdf.gsfc.nasa.gov/pub/software/cdf/dist/cdf38_1/cdf38_1-dist-all.tar.gz'
before_script:
- !reference [.setup-poetry, before_script]
# install cdf and spacepy.pycdf
- !reference [.install-fortran, before_script]
- wget $CDF_URL
- tar -xf cdf38_1-dist-all.tar.gz && cd ./cdf38_1-dist
- make OS=linux ENV=gnu CURSES=yes FORTRAN=no UCOPTIONS=-O2 SHARED=yes all
- make install
# install maser
- cd .. && poetry install
script:
# source the CDF lib and run the test
- . ./cdf38_1-dist/bin/definitions.B
- poetry run pytest tests/ --cov=maser.data --junitxml=report.xml -m "not test_data_required"
- poetry run coverage xml
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
artifacts:
when: always
reports:
junit: report.xml
coverage_report:
path: coverage.xml
coverage_format: cobertura
only:
- develop
- master
- tags
- merge_requests
- web
# publish python package on gitlab registry
publish-maser_data:
stage: publish
trigger:
include: .ci/publish_package.yml
strategy: depend
variables:
PACKAGE_DIR: 'src/maser_data'
PYPI_TOKEN: $MASER_DATA_PYPI_TOKEN
only:
- tags
- web
publish-maser_plot:
stage: publish
trigger:
include: .ci/publish_package.yml
strategy: depend
variables:
PACKAGE_DIR: 'src/maser_plot'
PYPI_TOKEN: $MASER_PLOT_PYPI_TOKEN
only:
- tags
- web
# publish python package on gitlab registry
publish-maser_tools:
stage: publish
trigger:
include: .ci/publish_package.yml
strategy: depend
variables:
PACKAGE_DIR: 'src/user_guide.rst'
PYPI_TOKEN: $MASER_TOOLS_PYPI_TOKEN
only:
- tags
- web
publish-maser4py:
stage: publish
trigger:
include: .ci/publish_package.yml
strategy: depend
variables:
PACKAGE_DIR: '.'
PYPI_TOKEN: $MASER4PY_PYPI_TOKEN
# TODO: This ID comes from the sandbox server.
# You will have to change it with one generated from the production server
ZENODO_DEPOSIT_ID: 1096032
only:
- tags
- web
# deploy doc pages
pages:
stage: publish
before_script:
- !reference [.setup-poetry, before_script]
- !reference [.install-fortran, before_script]
script:
- poetry install
- poetry run sphinx-build -b html docs/source public
artifacts:
paths:
- public
only:
- tags
- web