forked from Martinsos/edlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
156 lines (134 loc) · 5.41 KB
/
.travis.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
# This ensures only commits on master, PRs towards master, and all tags are built.
# Otherwise, build does not start.
if: branch = master OR tag IS present
language: cpp
os: linux
dist: focal
stages:
- ccpp
- python
env:
global:
- TWINE_USERNAME=Martinsos
# Encrypted TWINE_PASSWORD:
- secure: "VfgRi/hcUMLDYzATLS8JOuZo+wg0VNCmEojIJ3gpy89LAXgPN1Qx/2n3c52PPgFWgWFdDgns2SdxhQ1/810qb+65choy2fOgTULnyFcH3ZFTM5nINVHlGB5dLDUesKjrqqfIKHnwB6LAskHqHHPm/qv7WxUjQbcpR6mICsKB7h3NI7yUSc3tRPmd8tVBc/mTUXpMRVznTxGFCo/rC4f2y57GI9odjDxS4VqGS8T9Igvgyteg+ougXYbl84FIi3Bij6TQITa1rP9cFw/lfXMTM2m1czTonzAbgGPC6q7798MCGhLpEdxr+Zu9NPCS8aWFYdxMUYmsisjffDtTdIagZFh/14YrnQb2RxqnLTqSi20E+xXx16GcHhnMOxw/sSOh6HUEaXcbLNtx/mqMEa7mQEcIFBdXHWs/czTHz8xEoGnHIVHI5zqItoK3nUD0W/X6XUex8GP8obvjSKVw2k8X/0bZUaqSyNVbTfYcLmOk53Kx8vfXd82BbTOWiJVZmvuugqrshIEaLOyRhSaoC4Bj5KjfijM/gKPa+n8wVEQ/4hF4HpJKr/33cAm1URDGsDnfvHfxfeEwizTq8gCIxnbpOzSsd1M6+3MQLr48DE8uYM+wkG2F+KsCKe3OexLiaqHG7rVZh1R99nOykoqfjhxek3H1KGfx7qFbdK80AaVBiQo="
.ccpp: &ccpp
stage: ccpp # Builds C/CPP code.
before_install:
- sudo -H pip3 install -U pip # Needed for Meson.
- sudo -H pip3 install -U setuptools # Needed for Meson.
- eval "${MATRIX_EVAL}"
install:
- sudo -H pip3 install meson ninja # We use Ninja both with Meson and CMake.
script:
# Build library and binaries using Meson and test them.
# Static library.
- make CXXFLAGS="-Werror" LIBRARY_TYPE=static BUILD_DIR=meson-build-static
# Shared library.
- make CXXFLAGS="-Werror" LIBRARY_TYPE=shared BUILD_DIR=meson-build-shared
# Check for memory leaks.
# I run this only on linux because osx returns errors from
# system libraries, which I would have to supress.
- |
if [ $TRAVIS_OS_NAME == "linux" ]; then
make check-memory-leaks BUILD_DIR=meson-build-static
fi
# Build library and binaries with CMake and test them.
- mkdir -p build && cd build
- CXXFLAGS="-Werror" cmake -GNinja ..
- ninja -v
- bin/runTests
- cd ..
.python: &python
stage: python # Builds python binding.
install:
- wget -qO- https://bootstrap.pypa.io/get-pip.py | python3
- python3 -m pip install cibuildwheel==2.10.2
before_script:
- cd bindings/python
script:
# Build the wheels, put them into './wheelhouse'.
# cibuildwheel needs to be run from python directory.
# The python directory is mounted in the docker build containers,
# so we need to copy the edlib source before running cibuild wheel.
- make edlib # Copies edlib source to python dir.
- |
CIBW_SKIP="cp27-* pp* *-manylinux_i686" \
CIBW_BEFORE_BUILD="make sdist" \
CIBW_TEST_COMMAND="python3 {project}/test.py" \
python3 -m cibuildwheel --output-dir wheelhouse
- if [ $DEPLOY_SDIST_TO_PYPI ]; then make sdist; fi
# Deploy wheel(s) and source (sdist) to PYPI (if commit is tagged).
# NOTE: We are doing this in script section, and not in after_success,
# because we want build to fail if deploying fails, which does not
# happen if deployment is done inside after_success (that is how
# travis works).
# NOTE: We check TRAVIS_TEST_RESULT because we don't want to deploy
# if building failed.
- |
if [ $TRAVIS_TEST_RESULT -eq 0 ]; then
if [ $TRAVIS_TAG ]; then
# upgrade and upgrade-strategy-eager are here because of https://travis-ci.community/t/cant-deploy-to-pypi-anymore-pkg-resources-contextualversionconflict-importlib-metadata-0-18/10494/14 .
python3 -m pip install --upgrade --upgrade-strategy eager twine
python3 -m twine upload wheelhouse/*.whl
if [ $DEPLOY_SDIST_TO_PYPI ]; then
python3 -m twine upload dist/edlib-*.tar.gz
fi
else
echo "Skipping twine upload because not a tag, files built:"
ls -l wheelhouse
ls -l dist
fi
fi
jobs:
include:
# In order to catch as many weird edge cases in the code with -Werror as
# possible, we want to test a large range of old and new compilers on both
# Linux and macOS. This gives us the best possible coverage while maintaining
# compatibility with a large number of compilers.
- name: "C/CPP (Linux; GCC 10)"
os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test # For g++-10
packages:
- g++-10
- valgrind
- python3
- python3-pip
env:
- MATRIX_EVAL="export CC=gcc-10 && export CXX=g++-10"
<<: *ccpp
- name: "C/CPP (Linux; Clang 10.0)"
os: linux
addons:
apt:
packages:
- clang-10
- valgrind
- python3
- python3-pip
env:
- MATRIX_EVAL="export CC=clang-10 && export CXX=clang++-10"
<<: *ccpp
- name: "C/CPP (OSX; XCode 11; Clang)"
os: osx
osx_image: xcode11
<<: *ccpp
- name: "Python wheel (Linux)"
os: linux
language: python
python:
- "3.6"
services: docker
env:
# We need to upload sdist only once, since it is same for all jobs,
# so with this flag we specify which job will take care of that (this one).
- DEPLOY_SDIST_TO_PYPI="true"
<<: *python
- name: "Python wheel (OSX)"
os: osx
language: shell
<<: *python
# TODO: Add windows x64 and linux aarch64 python wheel builds? Edlib users said they need them.