aboutsummarylogtreecommitdiffstats
path: root/.travis.yml
blob: 26eb55c6e1ab5baa75fd05c80359e17efae791d9 (plain)
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
language: c

branches:
  only:
  - /.*/

cache:
  directories:
  - ~/.ccache
  - ~/.pkg-cache
  - ~/.cache/yay
  - blender-addons-contrib.git
  - blender-addons.git
  - blender-dev-tools.git
  - blender-translations.git
  - blender

services:
- docker

archlinux:
  mount:
  - ~/.ccache:~/.ccache
  - ~/.pkg-cache:/var/cache/pacman/pkg
  - ~/.cache/yay:~/.cache/yay
  repos:
# - bartus=https://github.com/bartoszek/AUR-repo/raw/master
  packages:
  - ccache
  - ccache-ext
# cuda need to be installed before `makepkg` invocation in order to allow nvcc-ccache logic to work.
  - cuda
  - moreutils
  before_install:
# 1.Override `package-cleanup.hook` to preserve cache for travis.
# 2.Enable ccache
# 3.Multithreaded build and compress
# 4.Suppress all gcc warnings
  - |
     sudo mkdir /etc/pacman.d/hooks/
     sudo ln -s /dev/null /etc/pacman.d/hooks/package-cleanup.hook
     sudo sed -i '/^BUILDENV/s/\!ccache/ccache/' /etc/makepkg.conf
     sudo sed -i '/#MAKEFLAGS=/c MAKEFLAGS="-j2"' /etc/makepkg.conf
     sudo sed -i '/^COMPRESSXZ/s/\xz/xz -T 2/' /etc/makepkg.conf
     sudo sed -i '$a   CFLAGS="$CFLAGS -w"'   /etc/makepkg.conf
     sudo sed -i '$a CXXFLAGS="$CXXFLAGS -w"' /etc/makepkg.conf
  script:
# Normalize TRAVIS variable
  - |
     [ "$TRAVIS" == "true" ] && TRAVIS=1 || TRAVIS=0
# Install optix
  - 'sudo pacman -U --noconfirm /var/cache/pacman/pkg/optix*.pkg.tar.xz'
# Build
  - "arch_uptime=$(cut -d' ' -f1 /proc/uptime|cut -d'.' -f1)"
  - 'build_time=$((50*60-arch_uptime-cache_out_time-60))'
  - 'echo "Travis initialization time:      $(date --date=@${travis_uptime} -u +%M:%S)"'
  - 'echo "Arch-Travis initialization time: $(date --date=@$((arch_uptime-travis_uptime)) -u +%M:%S)"'
  - 'echo "Current Run time:                $(date --date=@${arch_uptime} -u +%M:%S)"'
  - 'echo "Assumed Build time:              $(date --date=@${build_time} -u +%M:%S)"'
  - 'echo "Travis Cache Out time:           $(date --date=@${cache_out_time} -u +%M:%S)"'
  - ccache -s
  - ccache -z
# set timeout to 50m minus current uptime, minus travis cache in time, minus 60 second buffer for arch-travis cleanup.
  - timeout ${build_time} makepkg -s --noconfirm > >(ts -s '%.T'); _makepkg_return=$?
  - sudo pacman -Sc --noconfirm
  - ccache -s
  - ccache -z
  - exit $_makepkg_return
script:
# copy optix.pkg from private github repo
- 'git clone https://$GITHUB_ACCESS_TOKEN@github.com/bartoszek/optix-pkg'
- 'cp optix-pkg/optix*.pkg.tar.xz ~/.pkg-cache/'
- "export travis_uptime=$(cut -d' ' -f1 /proc/uptime|cut -d'.' -f1)"
- 'echo "Travis initialization time: $travis_uptime seconds"'
# assume caching out will take the same amount of time as caching in those making build time equal to 50 minutes minus two time current uptime.
# detect no cache in and assume 5min cache out time.
- "[ $travis_uptime -le 200 ] && cache_out_time=450 || cache_out_time=$travis_uptime"
- 'build_time=$((50*60-travis_uptime-cache_out_time))'
- 'echo "Current Run time:   $(date --date=@${travis_uptime} -u +%M:%S)"'
- 'echo "Assumed Build time: $(date --date=@${build_time} -u +%M:%S)"'
- 'echo "Cache Out time:     $(date --date=@${cache_out_time} -u +%M:%S)"'
- "export cache_out_time"
- "curl -s https://raw.githubusercontent.com/bartoszek/arch-travis/master/arch-travis.sh| timeout ${build_time} bash"
- "echo pacman pkg cache size: $(du -h ~/.pkg-cache|cut -f1) in $(ls ~/.pkg-cache|wc -l) files"

#deploy:
#  on:
#    branch: master
#  skip_cleanup: true
#  provider: script
#  script: bash .travis_deploy.sh