forked from ikus060/cbcpy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
112 lines (99 loc) · 2.5 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
image: quay.io/pypa/manylinux2010_x86_64
stages:
- prebuild
- build
- publish
variables:
CBC_VERSION: 2.10.3
CBC_FILE: Cbc-$CBC_VERSION.tgz
#
# Build Stages
#
.buildlinux: &buildlinux
stage: build
dependencies:
- build_cbc_x86_64_linux
before_script:
# Install SWIG
- yum install -y wget pcre-devel
- wget https://sourceforge.net/projects/swig/files/swig/swig-4.0.0/swig-4.0.0.tar.gz
- tar -zxvf swig-4.0.0.tar.gz
- cd swig-4.0.0
- ./configure && make && make install
- cd .. && pwd
script:
# Compile python module
- $PYTHON_ENV/bin/python setup.py build_ext --swig="${SWIG:-swig-4.0.0/swig}"
# Build package
- $PYTHON_ENV/bin/python setup.py bdist_wheel
# Convert to manylinux if required
- mkdir wheelhouse
- if [[ "$CI_JOB_NAME" == *linux* ]]; then auditwheel repair dist/*.whl; else mv dist/*.whl wheelhouse/; fi
# Test the packages
- $PYTHON_ENV/bin/pip install wheelhouse/*.whl
- $PYTHON_ENV/bin/python -m cbcpy
artifacts:
paths:
- wheelhouse
#
# Build CBC & SWIG
#
build_cbc_x86_64_linux:
stage: prebuild
image: quay.io/pypa/manylinux2010_x86_64
script:
- yum install -y wget
- mkdir Cbc && cd Cbc
- wget https://www.coin-or.org/download/source/Cbc/$CBC_FILE
- tar -zxvf $CBC_FILE --strip 1
- ./configure --disable-shared -with-pic
- make
- make install
artifacts:
paths:
- Cbc/lib
- Cbc/include
#
# Build python
#
build_cp27-cp27m_x86_64_linux:
<<: *buildlinux
variables:
PYTHON_ENV: /opt/python/cp27-cp27m
build_cp27-cp27mu_x86_64_linux:
<<: *buildlinux
variables:
PYTHON_ENV: /opt/python/cp27-cp27mu
build_cp35-cp35m_x86_64_linux:
<<: *buildlinux
variables:
PYTHON_ENV: /opt/python/cp35-cp35m
build_cp36-cp36m_x86_64_linux:
<<: *buildlinux
variables:
PYTHON_ENV: /opt/python/cp36-cp36m
build_cp37-cp37m_x86_64_linux:
<<: *buildlinux
variables:
PYTHON_ENV: /opt/python/cp37-cp37m
#
# Publish manylinux packages
#
publish_nexus:
stage: publish
image: python:3
script:
- pip install twine --upgrade
- python setup.py sdist
- twine check wheelhouse/*
- twine upload wheelhouse/* -u $NEXUS_USR -p $NEXUS_PWD --repository-url $NEXUS_PYPI_URL
publish_pypi:
stage: publish
image: python:3
only:
- tags
script:
- pip3 install twine --upgrade
- python setup.py sdist
- twine check wheelhouse/*
- twine upload wheelhouse/* -u $PYPI_USR -p $PYPI_PWD