aboutsummarylogtreecommitdiffstats
path: root/.travis.yml
blob: 5020d5bf0717513ed9f6be81dae102acf9bfaca9 (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
92
93
94
sudo: required
language: c

branches:
  only:
  - /.*/

cache:
  directories:
  - ~/.ccache
  - ~/.pkg-cache
  - ~/.cache/yay
  - gimp

services:
- docker

archlinux:
  mount:
  - ~/.ccache:~/.ccache
  - ~/.cache/yay:~/.cache/yay
  - ~/.pkg-cache:/var/cache/pacman/pkg
  - ~/.ssh:~/.ssh
  repos:
# - bartus=https://github.com/bartoszek/AUR-repo/raw/master
  packages:
  - ccache
  - moreutils
  - openssh
  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
# Build
  - ccache -s
  - yay -S --noconfirm babl-git
  - unset CC CXX
  - yay -S --noconfirm gegl-git
  - unset CC CXX
  - timeout 40m makepkg -s --noconfirm > >(ts -s '[%.T]'); _makepkg_return=$?
# Update PKGBUILD and push changes to AUR
  - ./update.PKGBUILD
  - |
     deps_update=$(git diff .SRCINFO|grep -oP "^\+\tdepends = \K.*") && [[ "$TRAVIS_EVENT_TYPE" =~ push|cron ]] && \
     ( . PKGBUILD
       git checkout master
       git config user.name "Travis"
       git config user.email "travis@example.org"
       git remote add aur ssh://aur@aur.archlinux.org/${pkgname}-git
       git remote add github git@github.com:bartoszek/AUR-${pkgname}.git
       echo "\$ git config"
       git config -l
       git commit PKGBUILD .SRCINFO -m "Update denepdencies" -m "$deps_update" -m "[skip ci]"
       echo "\$ stat ~/.ssh/*"
       stat ~/.ssh/*
       echo "\$ git push"
       git push aur
       git push github
     ) || true
# Clean
  - sudo pacman -Sc --noconfirm
  - ccache -s
  - exit $_makepkg_return
script:
# decrypt aur and github ssh key
- openssl aes-256-cbc -K $encrypted_1a5ecd398a03_key -iv $encrypted_1a5ecd398a03_iv -in aur4travis.enc -out ~/.ssh/aur4travis -d
- openssl aes-256-cbc -K $encrypted_9b4b6471bd69_key -iv $encrypted_9b4b6471bd69_iv -in github4travis.enc -out ~/.ssh/github4travis -d
# add ssh keys to ssh_config(5) (ssh key and ssh_config has to have specific/restrictive permissions)
- echo -e "Host aur.archlinux.org\n\tUser aur\n\tIdentityFile    ~/.ssh/aur4travis\n" >> ~/.ssh/config
- echo -e "Host github.com       \n\tUser git\n\tIdentityFile ~/.ssh/github4travis\n" >> ~/.ssh/config
- chmod 600 ~/.ssh/*
# scripts containing ':' has to come in double quotes.
- "curl -s https://raw.githubusercontent.com/bartoszek/arch-travis/master/arch-travis.sh| 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