forked from hibtc/cpymad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
135 lines (123 loc) · 4.32 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
language: python
dist: xenial
python:
- "2.7"
# - "3.3" no manylinux support
- "3.4"
- "3.5"
- "3.6"
- "3.7"
env:
global:
# GITHUB_TOKEN:
- secure: "fdvPaSzbpf47Qb/2zDg/eHAS0bBFaAkWFxyxmhHQOkD0PlVxwi1Fh0Sq3dUZVwQgmmYj+hF6cFpqkFQJQe3zFqw9k14Ccr4dk69yjPNbQA1+yg0ARFntyqtM2DUN86brMcZG3ZM6V2HFuzKn9cQUvtjCQSKS26HybEnCG4vXz24="
- ART_REPO=https://[email protected]/hibtc/cpymad-artifacts
- ART_BRANCH=_$TRAVIS_BUILD_NUMBER-$TRAVIS_COMMIT
before_install:
- lsb_release -a
- if [[ -z $TRAVIS_TAG ]]; then
echo -e "\n[egg_info]\ntag-build = dev$TRAVIS_BUILD_NUMBER" >> setup.cfg ;
export TWINE_REPOSITORY_URL=https://test.pypi.org/legacy/ ;
fi
- env | sort
install:
- pip install wheel
- PY_ABI_TAG=$(python -c
'from wheel.pep425tags import get_abi_tag; print(get_abi_tag())')
# download wheels generated during build stage:
- git clone $ART_REPO dist -b $ART_BRANCH --depth 1
- pip install dist/*-$PY_ABI_TAG-*_x86_64.whl
- pip install flake8 coverage coveralls
script:
- flake8
- coverage run --source=cpymad -p test/test_util.py -v
- coverage run --source=cpymad -p test/test_madx.py -v
after_success:
- coverage combine
- coveralls
cache:
pip: true
directories:
- /home/travis/io
stages:
- build
- test
- deploy
jobs:
include:
- stage: build
name: Build manylinux wheels
python: "3.6"
services:
- docker
install:
- pip install docker-compose twine
script:
- git rev-parse HEAD:utils/manylinux > /tmp/cache_key
- if ! cmp /home/travis/io/cache_key /tmp/cache_key; then
echo "Clearing MAD-X build cache due to updated build scripts" ;
sudo rm -rf /home/travis/io ;
fi
- mkdir -p /home/travis/io
- chmod -R 777 /home/travis/io
- sudo mv /tmp/cache_key /home/travis/io/
- docker build -t wheelbuilder32 utils/manylinux -f utils/manylinux/Dockerfile_x86
- docker build -t wheelbuilder64 utils/manylinux -f utils/manylinux/Dockerfile_x64
# at the time of writing, mounting /io/cpymad as readonly volume
# (the `:ro` option) causes container init error when executed on
# travis (not on my local machine though), so we use `:rw` instead:
- docker run --init --name artifacts32
-v /home/travis/io/32:/io:rw
-v `pwd`:/io/cpymad:rw
-v /io/dist
--cap-drop=all
wheelbuilder32
- docker run --init --name artifacts64
-v /home/travis/io/64:/io:rw
-v `pwd`:/io/cpymad:rw
-v /io/dist
--cap-drop=all
wheelbuilder64
- docker cp artifacts32:/io/dist .
- docker cp artifacts64:/io/dist .
- twine check dist/*
after_success:
# Upload artifacts to github:
- cd dist
- git init
- git add -f *.whl *.tar.gz
- git commit -m "Build $TRAVIS_JOB_NUMBER" -m "$TRAVIS_BUILD_WEB_URL"
# Upload to a unique branch for deterministic fetches during the later
# stages, and to master for the user's convenience. The unique branch
# can be removed after the run has finished.
- git push -f $ART_REPO master:master master:$ART_BRANCH
after_script:
- cd $TRAVIS_BUILD_DIR
- ./utils/cleanup_artifacts.py $ART_REPO $TRAVIS_BUILD_NUMBER 5
- stage: deploy
name: Upload release to PyPI
python: "3.6"
if: branch = test-release OR tag IS present
install:
- pip install twine
- git clone $ART_REPO dist -b $ART_BRANCH --depth 1
script: twine upload dist/*.tar.gz dist/*.whl
after_success: skip
env:
- TWINE_USERNAME=hibtc-deploy
# TWINE_PASSWORD:
- secure: "A2y/CUVGmBDemj+JCsupqexE7YiYcdIg6nOKPmBNjTCaum9CrvhebTmLDqtSfn1qFA3CbbFwyHIo/nlGioIMZfLhSYw/l3JlLTCMx57ESVqYRR7ou882mb1zizc5DrAfT1Sk8rHuBMI/iqpQOwsQPTOvBMW4ttnEsFWK/WrYKNM="
- stage: deploy
name: Update Documentation
python: "3.6"
script:
- pip install sphinx sphinx_rtd_theme
- make -C doc html
after_success: true # don't "skip"! it makes travis skip "deploy:" too!
deploy:
provider: pages
local-dir: doc/_build/html
skip-cleanup: true
github-token: $GITHUB_TOKEN
on:
branch: master