-
Notifications
You must be signed in to change notification settings - Fork 17
/
.travis.yml
116 lines (101 loc) · 4.25 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
####
# This travis configuration file is used to manage the FreeCAD osx ports cache.
#
# 1. The enviornment is initialized by creating a GitHub repo context that is used
# by the travis-helpers functions.
# 2. If a cache exists for the current FreeCAD release, it is downloaded and deployed
# 3. If the local cache state is current (i.e. not outdated/stale), then the build exits
# at this point.
# 4. However if the local cache state is outdated or stale, then a new ports dependency cache
# is built using homebrew under the default previx of /usr/local
# 5. Once the cache is built, a compressed tar file of the ports is uploaded to GitHub for
# use during Travis-CI builds.
#
# NOTES: a) If you fork this repo and would like to deploy a ports cache, be sure to define
# a Travis-CI encrypted environment variable GH_TOKEN that contains the GitHub
# OAUTH token needed to deploy a release asset to your forked repo.
# b) If you want to force a cache rebuild, you can set the the environment variable
# FORCE_CACHE_REBUILD=1 conveniently via the Travis CI Repo Settings UI
#
##
env:
global:
- FREECAD_RELEASE="0.18"
- PORTS_CACHE="${TRAVIS_REPO_SLUG}"
os: osx
language: cpp
osx_image: xcode9.2
cache:
directories:
- $HOME/Library/Caches/Homebrew
before_install:
##
# Initialize the ports cache state (steps 1 & 2)
# If any of the ports in the cache are outdated,
# the cache will be rebuilt and deployed during
# the install and script phases respectively
#
- brew update >/dev/null && brew install jq
- source ${TRAVIS_BUILD_DIR}/travis-helpers.sh
- cacheContext=$(create_helper_context repo=${PORTS_CACHE} auth_token=${GH_TOKEN} release=${FREECAD_RELEASE})
- |
if ! prime_local_ports_cache $cacheContext \
|| local_ports_cache_is_stale \
|| (( ${#TRAVIS_TAG} )) \
|| (( ${#FORCE_CACHE_REBUILD} )) ;
then
shouldRebuildCache=1;
else
shouldRebuildCache=0;
fi
install:
##
# Build the FreeCAD ports dependencies using homebrew
#
- |
if [ $shouldRebuildCache = 1 ]; then
## Rebuild ports cache
init_local_ports_cache
## Catalog environment under which cache was built
sw_vers
xcodebuild -version -sdk
brew --config
## Install the FreeCAD dependencies
brew tap FreeCAD/freecad
brew deps freecad
brew install --verbose --only-dependencies freecad
#Install the 3DConnexion frameworks
if [ ! -d /Library/Frameworks/3DconnexionClient.framework ]; then
curl -o /tmp/3dFW.dmg -L 'http://www.3dconnexion.com/index.php?eID=sdl&ext=tx_iccsoftware&oid=a273bdbc-c289-e10d-816b-567043331c9e&filename=3DxWareMac_v10-4-1_r2428.dmg'
hdiutil attach -readonly /tmp/3dFW.dmg
sudo installer -package /Volumes/3Dconnexion\ Software/Install\ 3Dconnexion\ software.pkg -target /
fi
#Install utilities needed for cache management and disk image creation/packaging
brew install jq
brew install node && npm install -g appdmg
fi
script:
##
# Create a ports archive (compressed tar file) and deploy to GitHub
#
- |
if [ $shouldRebuildCache = 1 -a "$TRAVIS_PULL_REQUEST" == "false" ]; then
archivePrefix=$(generate_ports_cache_descriptor)
if [ "${TRAVIS_TAG}" != "" ]; then
# Deploy non-date referential builds for tagged builds
# Used by non-authenticated cache requests
archiveFilename=${archivePrefix}
else
# Deploy date-referential builds for standard integration builds
# Available authenticated (OAUTH) cache clients
archiveFilename=${archivePrefix}-$(date '+%Y.%m.%d')
fi
portsArchive=$(create_ports_cache_archive $(brew --prefix) ${TRAVIS_BUILD_DIR}/${archiveFilename}.tgz)
gitHub_deploy_asset_to_release_named $cacheContext $portsArchive ${FREECAD_RELEASE} replace
gitHub_prune_assets_for_release_named $cacheContext ${archivePrefix} 3 ${FREECAD_RELEASE}
fi
before_cache:
# Purge cruft from Homebrew cache directory before travis cache's it
- brew cleanup -s
- brew cask cleanup
- rm -f ~/Library/Caches/Homebrew/linkage.db ~/.cache/Homebrew/linkage.db