sudo: required language: c branches: only: - /.*/ cache: directories: - ~/.ccache - ~/.pkg-cache - LuxCore.git services: - docker archlinux: mount: - ~/.ccache:~/.ccache - ~/.pkg-cache:/var/cache/pacman/pkg repos: # - bartus=https://github.com/bartoszek/AUR-repo/raw/master packages: - ccache - moreutils - bc - qt5-declarative 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: # check interval update - | update_interval=5 update_offset=$(. PKGBUILD; sha1sum <<< "$pkgname"|sed -e "s/[a-z -]//g" -e "s/^0*//"|echo `cat`%$update_interval|bc) next_update=$(((365-`date +%-j`+update_offset)%update_interval)) # check (opt|)depends update - | build_deps=$(. PKGBUILD; IFS=$'\n'; echo -e "${depends[*]}\n${makedepends[*]}"; ) build_deps=$(for pkg in $build_deps; do pacman -S --print-format '%n' $pkg|tail -1; done|sort -u;) new_deps_ver=$(for pkg in $build_deps; do pacman -S --print-format '%n %v' $pkg|tail -1; done;) build_info=$(curl -sL $(. PKGBUILD; pacman -S --print $pkgname|tail -n1)|bsdtar xJOf - .BUILDINFO|grep -Po '^installed = \K.*'|rev|while IFS=$'-' read arch pkgrel pkgver pkgname; do echo $pkgrel-$pkgver $pkgname; done|rev) old_deps_ver=$(echo "$build_info"|grep -f <(echo "$build_deps" )) printf "%-50s %50s\n" "BUILDINFO dependency versions" "PACMAN dependency versions" dep_update=$(diff -y -W 100 --tabsize=4 <(echo "$old_deps_ver"|sort) <(echo "$new_deps_ver"|sort) >&2; echo $?;) # check version - | makepkg -od --skipinteg new_pkgver=$(. PKGBUILD; [[ -v epoch ]] && echo -n $epoch:; echo $pkgver-$pkgrel) old_pkgver=$(. PKGBUILD; pacman -S --print-format %v $pkgname|tail -n1) # skipp build if: # 1. cron build # 2. no new version # 3. no dependency update - | [[ "$TRAVIS_EVENT_TYPE" == "cron" && "$new_pkgver" == "$old_pkgver" && $next_update != 0 && $dep_update != 0 ]] && { echo -e "Current version is up to date!\nNext force update in $next_update days!"; exit 0; } || true # Normalize TRAVIS variable - | [ "$TRAVIS" == "true" ] && TRAVIS=1 || TRAVIS=0 # Build - 'echo "Travis initialization time: $travis_uptime seconds"' - "arch_uptime=$(cut -d' ' -f1 /proc/uptime|cut -d'.' -f1)" - 'echo "Arch-Travis initialization time: $((arch_uptime-travis_uptime)) seconds"' - 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 $((50*60-arch_uptime-travis_uptime-60)) makepkg -s --noconfirm > >(ts -s '%.T'); _makepkg_return=$? - sudo pacman -Sc --noconfirm - ccache -s - ccache -z - exit $_makepkg_return script: - "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. - "curl -s https://raw.githubusercontent.com/bartoszek/arch-travis/master/arch-travis.sh| timeout $((50*60-2*travis_uptime)) 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