.gitlab-ci.yml 5.42 KB
Newer Older
1
2
stages:
  - build
3
  - package
4
  - test
5
6
  - docs
  - deploy
7
8
9

# -- build ------------------

Leo P. Singer's avatar
Leo P. Singer committed
10
build:sdist:
11
  stage: build
12
  image: python
13
14
15
16
17
18
  script:
    - python setup.py sdist -d .
  artifacts:
    paths:
      - '*.tar.gz'

Leo P. Singer's avatar
Leo P. Singer committed
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
build:wheel:manylinux1:
  stage: build
  image: quay.io/pypa/manylinux1_x86_64
  script:
    - set -ex;
      for PYTHON in /opt/python/*/bin/python; do
        $PYTHON setup.py bdist_wheel;
      done
    - set -ex;
      for WHEEL in dist/*; do
        auditwheel repair -w . ${WHEEL};
      done
  artifacts:
    paths:
      - '*.whl'

build:wheel:macos:
  stage: build
  tags:
    - macos
  script:
    - set -ex;
      for VIRTUALENV in /opt/local/bin/virtualenv-?.?; do
        rm -rf env;
        $VIRTUALENV --system-site-packages env;
        source env/bin/activate;
        python setup.py bdist_wheel;
      done
    - pip install delocate
    - delocate-wheel -w . dist/*
  artifacts:
    paths:
      - '*.whl'

53
# -- package ----------------
Leo P. Singer's avatar
Leo P. Singer committed
54

55
56
.package:debian: &package-debian
  stage: package
57
58
  dependencies:
    - build:sdist
59
60
61
  variables:
    GIT_STRATEGY: none
  before_script:
Leo P. Singer's avatar
Leo P. Singer committed
62
    - apt-get update
63
    - apt-get -y install dpkg-dev devscripts lintian
64
  script:
65
66
67
68
69
70
71
72
73
    # unpack tarball
    - mkdir -p src
    - tar -C ./src --strip-components 1 -xf *.tar.*
    - cd src
    # install build dependencies
    - mk-build-deps --tool "apt-get -y" --install --remove
    # build debian packages
    - dpkg-buildpackage -us -uc -b
    # lint
Leo P. Singer's avatar
Leo P. Singer committed
74
    - lintian --pedantic ../*.{deb,changes}
75
76
77
78
79
  artifacts:
    paths:
      - '*.deb'
      - '*.changes'

80
81
package:stretch:
  <<: *package-debian
82
83
  image: ligo/base:stretch

84
85
.package:el7: &package-el
  stage: package
86
87
  dependencies:
    - build:sdist
88
89
90
  variables:
    GIT_STRATEGY: none
  before_script:
Duncan Macleod's avatar
Duncan Macleod committed
91
    - yum install -y yum-utils rpm-build rpmlint epel-rpm-macros
92
  script:
93
    # prep
94
95
96
    - mkdir -p ~/rpmbuild/{SOURCES,SPECS}
    - tar -C ~/rpmbuild/SPECS -xf *.tar.* --strip-components 2 '*/etc/glue.spec'
    - mv *.tar.* ~/rpmbuild/SOURCES
97
    # install build dependencies
98
    - yum-builddep -y ~/rpmbuild/SPECS/*.spec
99
    # build binary rpms
100
101
    - rpmbuild -ba ~/rpmbuild/SPECS/*.spec
    - mv $(find ~/rpmbuild/{RPMS,SPECS,SRPMS} -type f) .
102
    # lint
103
104
    - echo "from Config import *; addFilter(\"python-bytecode-wrong-magic-value\")" >> rpmlintrc
    - rpmlint -f rpmlintrc *.{rpm,spec}
105
106
107
108
  artifacts:
    paths:
      - '*.rpm'
      - '*.spec'
109

110
111
package:el7:
  <<: *package-el
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
  image: ligo/base:el7

# -- test -------------------

.test: &test
  stage: test
  image: python
  dependencies:
    - build:sdist
  before_script:
    - python -m pip install *.tar.*
    - python -m pip install lalsuite
  script:
    - make -C test

test:python2.7:
  <<: *test
  image: python:2.7

test:python3.4:
  <<: *test
  image: python:3.4

test:python3.5:
  <<: *test
  image: python:3.5

test:python3.6:
  <<: *test
  image: python:3.6

test:python3.7:
  <<: *test
  image: python:3.7

test:el7:
  stage: test
  image: ligo/lalsuite-dev:el7
  dependencies:
151
    - package:el7
152
153
154
155
156
157
158
159
160
161
162
163
164
165
    - build:sdist
  variables:
    GIT_STRATEGY: none
  script:
    # install glue
    - yum -y -q --nogpgcheck localinstall glue*.el7.x86_64.rpm
    # extract and run the tests
    - tar -xf *.tar.* --strip-components 1 lscsoft-glue*/test
    - make -C test PYTHON=python

test:stretch:python2:
  stage: test
  image: ligo/lalsuite-dev:stretch
  dependencies:
166
    - package:stretch
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
    - build:sdist
  variables:
    GIT_STRATEGY: none
  before_script:
    - apt-get update
    - apt-get install -y python-lal python-lalburst
  script:
    - dpkg --install python-*.deb || { apt-get -y -f install; dpkg --install python-*.deb; }
    # extract and run the tests
    - tar -xf *.tar.* --strip-components 1 --wildcards lscsoft-glue*/test
    - make -C test PYTHON=python

test:stretch:python3:
  stage: test
  image: ligo/lalsuite-dev:stretch
  dependencies:
183
    - package:stretch
184
185
186
187
188
189
190
191
192
193
194
    - build:sdist
  variables:
    GIT_STRATEGY: none
  before_script:
    - apt-get update
    - apt-get install -y python3-lal python3-lalburst
  script:
    - dpkg --install python3-*.deb || { apt-get -y -f install; dpkg --install python3-*.deb; }
    # extract and run the tests
    - tar -xf *.tar.* --strip-components 1 --wildcards lscsoft-glue*/test
    - make -C test PYTHON=python3
195
196
197

docs:
  stage: docs
Duncan Macleod's avatar
Duncan Macleod committed
198
  image: python:3.7
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
  variables:
    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
  before_script:
    # install docs requirements
    - python -m pip install sphinx sphinx_rtd_theme
    # install glue and lalsuite (everything else is in setup.py)
    - python -m pip install . lalsuite
  script:
    - glue_version=$(python setup.py --version)
    - mkdir -v docs
    - cd docs
    # generate docs skeleton
    - python -m sphinx.ext.apidoc
          --module-first
          --separate
          --full
          --ext-autodoc
          --ext-intersphinx
          --doc-project "lscsoft-glue"
          --doc-author "The LIGO Scientific Collaboration and The Virgo Collaboration"
          --doc-version "${glue_version}"
          --output-dir .
          ../glue
    # use module page as index
    - mv -v glue.rst index.rst
    # use sphinx_rtd_theme
    - sed -i 's/alabaster/sphinx_rtd_theme/g' conf.py
    # run sphinx to generate docs
    - python -m sphinx -M html . build
  artifacts:
    paths:
      - docs/build
  cache:
    paths:
      - .cache/pip

pages:
  stage: deploy
  dependencies:
    - docs
  only:
    - tags
  script:
    - mv docs/build/html public
  artifacts:
    paths:
      - public