-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
276 lines (237 loc) · 10 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# use containers (so no sudo ?)
sudo: false
#os:
# - linux
# - osx
dist: xenial
#dist: trusty
language: python
# from https://docs.travis-ci.com/user/caching/
# Large files that are quick to install but slow to download do not benefit
# from caching, as they take as long to download from the cache as from the
# original source: do not cache Debian packages.
# pip and R packages can be cached.
#Sphinx and FreeCAD packages?
# This should be enabled if pip is used
#cache: pip
# trigger on pushes to master branch
branches:
only:
- master
#specify multiple parallel jobs
matrix:
include:
- name: "freecad - python 2"
python: 2.7
FC: "freecad"
env: BLD="fcP2"
# python 3 needs ubuntu 18.04 (Bionic Beaver)
#- name: "freecad - python 3"
# python: 3.6
# FC: "freecad"
# env: BLD="fcP3"
- name: "freecad-daily - python 2"
python: 2.7
FC: "freecad-daily"
env: BLD="fc-dP2"
#- name: "freecad-daily - python 3"
# python: 3.6
# FC: "freecad-daily"
# env: BLD="fc-dP3"
# Notes about methods for installing dependencies follow, then install.
# See also https://docs.travis-ci.com/user/installing-dependencies/
# Currently apt-get seems prefered. It is done in before_install: whereas
# some of the other options might be done in install:.
# It might be possible to use FreeCAD AppImage but then Sphinx needs to find
# the FreeCAD python libraries inside the AppImage, or sphinx needs to run
# inside the image.
#Draft attempt at using AppImage:
# run AppImage to run freecad. Updating the image is only useful if the old
# image is cached, and it is not clear there is any advantage when cache is
# loaded over the network.
# - wget https://github.com/AppImage/AppImageUpdate/releases/download/continuous/appimageupdatetool-x86_64.AppImage
# - chmod +x ./appimageupdatetool-x86_64.AppImage
# - wget https://github.com/FreeCAD/FreeCAD/releases/download/0.18.1/FreeCAD_0.18-16110-Linux-Conda_Py3Qt5_glibc2.12-x86_64.AppImage
# - chmod +x ./FreeCAD*.AppImage
# - ./appimageupdatetool.AppImage path/to/old/FreeCAD.AppImage ./path/to/updated/FreeCAD.AppImage
# It would be possible to use Condo, but that seems to generate library
# downloads almost as big as apt upgrade, so will be very slow. Draft attempt:
# # Install Anaconda
# - echo PYTHON_VERSION $PYTHON_VERSION
# - echo TRAVIS_PYTHON_VERSION $TRAVIS_PYTHON_VERSION
# - if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
# wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
# else
# wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
# fi
# - bash miniconda.sh -b -p $HOME/miniconda
# - export PATH="$HOME/miniconda/bin:$PATH"
# - hash -r
# - conda config --set always_yes yes --set changeps1 no
# - conda update -q conda
# - conda config --add channels conda-forge
# - conda update -q conda
# - conda create -n FC_test freecad
# - conda init bash # nodifies .bashrc
# - conda activate FC_test
# - bash
# - conda deactivate # removes modifications to .bashrc
# pip can be used? but put things in different directory apt-get,
# so, at least, PATH and PYTHONPATH need adjustment. Draft:
# - pip install -U sphinx
# - pip3 install -U sphinx
# # installs in /home/travis/virtualenv/python2.7.14/bin/sphinx-build
# - pip install -U pip freecad
# check here to see if the ppa is up-to-date
# https://launchpad.net/~freecad-maintainers/+archive/ubuntu/freecad-stable
# https://launchpad.net/~freecad-maintainers/+archive/ubuntu/freecad-daily
# May 2, 2019
# https://forum.freecadweb.org/viewtopic.php?f=4&t=35546&p=305447#p305444
#Trusty(14.04) is EOL, Xenial(16.04) is only PY2/QT4 (too old to support Python 3 builds)
#Even for 18.04+ Kurt had to port some stuff from Debian to Ubuntu
before_install:
- cat /etc/*-release
- echo TRAVIS_PYTHON_VERSION is $TRAVIS_PYTHON_VERSION
- echo BLD is $BLD
- if [[ "$BLD" == "fcP2" ]]; then
export FC="freecad" ;
export PYTHON=python2 ;
sudo add-apt-repository --yes ppa:freecad-maintainers/freecad-stable ;
sudo apt-get update -q ;
sudo apt-get install --yes freecad ;
sudo apt-get install --yes python-sphinx sphinx-common ;
export DISPKG=`dpkg -L python-sphinx | grep "dist-packages$"` ;
fi
- if [[ "$BLD" == "fc-dP2" ]]; then
export FC="freecad-daily" ;
export PYTHON=python2 ;
sudo add-apt-repository --yes ppa:freecad-maintainers/freecad-daily ;
sudo apt-get update -q ;
sudo apt-get install --yes freecad-daily ;
sudo apt-get install --yes python-sphinx sphinx-common ;
export DISPKG=`dpkg -L python-sphinx | grep "dist-packages$"` ;
fi
#- if [[ "$BLD" == "fcP3" ]]; then
# export FC="freecad" ;
# export PYTHON=python3 ;
# sudo add-apt-repository --yes ppa:freecad-maintainers/freecad-stable ;
# sudo apt-get update -q ;
# sudo apt-get install --yes freecad-python3 libfreecad-python3-0.18 ;
# sudo apt-get install --yes freecad freecad-common freecad-runtime ;
# sudo apt-get install --yes python3-sphinx sphinx-common ;
# export DISPKG=`dpkg -L python3-sphinx | grep "dist-packages$"` ;
# fi
#- if [[ "$BLD" == "fc-dP3" ]]; then
# export FC="freecad-daily" ;
# export PYTHON=python3 ;
# sudo add-apt-repository --yes ppa:freecad-maintainers/freecad-daily ;
# sudo apt-get update -q ;
# sudo apt-get install --yes freecad-python3 libfreecad-python3-0.18 ;
# sudo apt-get install --yes freecad-daily ;
# sudo apt-get install --yes python-sphinx sphinx-common ;
# export DISPKG=`dpkg -L python-sphinx | grep "dist-packages$"` ;
# fi
- sudo apt-cache policy freecad
- sudo apt-cache showpkg freecad
- sudo apt-cache policy freecad-common
- sudo apt-cache showpkg freecad-common
- sudo apt-cache policy freecad-runtime
- sudo apt-cache showpkg freecad-runtime
- sudo apt-cache policy freecad-daily
- sudo apt-cache showpkg freecad-daily
- sudo apt-cache policy freecad-python2
- sudo apt-cache showpkg freecad-python2
- sudo apt-cache policy freecad-python3
- sudo apt-cache showpkg freecad-python3
- sudo apt-cache policy libfreecad-python3-0.18
- sudo apt-cache showpkg libfreecad-python3-0.18
install:
- which sphinx-build
- sphinx-build --version
script:
- ./foldAndColour "echo this should be green | grep green" "fold_test_1"
# next test exits 1, so build fails
# - ./foldAndColour "echo this should be red | grep green" "fold_test_2"
- echo FC is ${FC}
# FREECAD_VERSION not currently used, may need in future for archiving
- FREECAD_VERSION=`./freecad--version ${FC}`
- echo FREECAD_VERSION is ${FREECAD_VERSION}
- echo PWD is ${PWD}
- sphinx-build --version
- echo TRAVIS_PYTHON_VERSION is $TRAVIS_PYTHON_VERSION
- echo PYTHON is ${PYTHON}
- ${PYTHON} --version
- export PYTHONPATH=${DISPKG}:${PWD}/lib:${PYTHONPATH}
- echo PYTHONPATH is ${PYTHONPATH}
- ${PYTHON} -c 'import os, sys ; print(str(sys.path))'
- ${PYTHON} -c 'import sphinx, sys ; print(str(sys.path))'
- ${PYTHON} -c 'import sphinx, sys ; print(sphinx.__file__)'
# gives/usr/lib/python2.7/dist-packages/sphinx/__init__.pyc
# Makefile now will do this construct of BUILD by default, so BUILDDIR does
# not need to be specified, but it is needed below for freecadPythonCheck
# and in after_success so probably better to specify it here
- export BUILD=build_${FC}/${PYTHON}
- echo Sphinx building with FREECAD=${FC} PYTHON=${PYTHON} BUILDDIR=${BUILD}
- ./foldAndColour "make FREECAD=${FC} PYTHON=${PYTHON} BUILDDIR=${BUILD} doctest " "run_doctest"
#- make FREECAD=${FC} PYTHON=${PYTHON} BUILDDIR=${BUILD} doctest
- ./foldAndColour "make FREECAD=${FC} PYTHON=${PYTHON} BUILDDIR=${BUILD} html " "generate_html"
#- make FREECAD=${FC} PYTHON=${PYTHON} BUILDDIR=${BUILD} html
# confirm this actually used the correct python
- ./freecadPythonCheck ${BUILD}
# Note that the build happens on master (or elsewhere)
# but the html and other output needs to go on branch gh-pages.
# Deploy looks after that but
# another problem is that results from freecad vs freecad-daily can clobber one
# another (build dir gets cleaned) and also clobber the top level files
# index.html and README.md.
# This did not work very well:
# - git symbolic-ref HEAD
#Beware: This creates a new branch called ${BUILD} on origin if it does not
#exist, and pushes to it without creating the branch locally.
# - git push origin HEAD:${BUILD}
#to cleanup
#git push origin --delete ${BUILD}
#See https://git-scm.com/docs/git-push#NOTE ABOUT FAST-FORWARDS
# Since Travis matrix of jobs are
# building in different directories could use --rebase in place of merge.
# - git remote set-url origin #https://${GITHUB_TOKEN}@github.com/pdgilbert/EgFreeCAD.git
# - git fetch
# - git pull --rebase
# use tightly scoped key
after_success: # can be used for customized deploy or to unsupported Providers
#BUILD=build_${FC}/${PYTHON}
- echo ${PWD}
- echo ${BUILD}
- echo ${FC}
- echo ${PYTHON}
- ls
- mkdir -p NewBuild
- mv ${BUILD}/* NewBuild
- git clone https://${GITHUB_TOKEN}@github.com/pdgilbert/EgFreeCAD.git
- cd EgFreeCAD
- ls ${BUILD}
- git checkout gh-pages
- git status
- mkdir -p ${BUILD}
- cp -r ../NewBuild/* ${BUILD}
- echo $PWD
- ls ${BUILD}
- git add ${BUILD}
- git status
- git commit -am "commiting new build."
- git status
- git push
- git status
- echo pushed ${BUILD} on gh-pages branch
# see https://docs.travis-ci.com/user/deployment/pages/
# https://docs.travis-ci.com/user/deployment/#Conditional-Releases-with-on%3A
#deploy:
# verbose: true
# provider: pages
# skip_cleanup: true #otherwise files created during the build are deleted
# github_token: "${GITHUB_TOKEN}" # Set in the settings page of repository
# keep_history: true # maybe false for this??
# # on: provides conditions on which to deploy
# on:
# branch: master
# target_branch: gh-pages