chiark / gitweb /
Merge branch 'ossjfrog' into 'master'
[fdroidserver.git] / jenkins-build-makebuildserver
1 #!/bin/bash
2
3 if [ `dirname $0` != "." ]; then
4     echo "only run this script like ./`basename $0`"
5     exit
6 fi
7
8 if [ -z $WORKSPACE ]; then
9     WORKSPACE=`pwd`
10 fi
11
12 # make sure that no VirtualBox processes are left running
13 cleanup_all() {
14     set +e
15     echo "$(date -u) - cleanup in progress..."
16     ps auxww | grep -e VBox -e qemu
17     cd $WORKSPACE/buildserver
18     vagrant halt
19     sleep 5
20     killall VBoxHeadless
21     sleep 5
22     killall -9 VBoxHeadless
23     echo "$(date -u) - cleanup done."
24 }
25 trap cleanup_all INT TERM EXIT
26
27 set -e
28 set -x
29
30 # make sure we have the vagrant box image cached
31 test -e ~/.cache/fdroidserver || mkdir -p ~/.cache/fdroidserver
32 cd ~/.cache/fdroidserver
33 wget --tries=1 --timeout=5 --continue https://f-droid.org/jessie64.box || true
34 echo "de3e3c4a9c13e8c015e30edeea0f583b195d1ee8ff9ad4814e933bbfb560200f  jessie64.box" > jessie64.box.sha256
35 sha256sum -c jessie64.box.sha256
36
37 # redirect homes to be in the git repo, so they'll get cleaned and reset
38 export XDG_CONFIG_HOME=$WORKSPACE
39 export VBOX_USER_HOME=$WORKSPACE/VirtualBox
40 mkdir $VBOX_USER_HOME
41 if which VBoxManage; then
42     VBoxManage setproperty machinefolder $WORKSPACE/virtualbox.d
43     VBoxManage setproperty logginglevel debug
44 fi
45 export VAGRANT_HOME=$WORKSPACE/vagrant.d
46 mkdir $VAGRANT_HOME
47
48 cd $WORKSPACE
49 echo "debian_mirror = 'http://ftp.uk.debian.org/debian/'" > $WORKSPACE/makebuildserver.config.py
50 echo "boot_timeout = 1200" >> $WORKSPACE/makebuildserver.config.py
51 echo "apt_package_cache = True" >> $WORKSPACE/makebuildserver.config.py
52 ./makebuildserver --verbose --clean
53
54 # this can be handled in the jenkins job, or here:
55 if [ -e fdroiddata ]; then
56     cd fdroiddata
57     git remote update -p
58     git checkout master
59     git reset --hard origin/master
60     cd ..
61 else
62     git clone --depth 1 https://gitlab.com/fdroid/fdroiddata.git fdroiddata
63 fi
64
65 cd fdroiddata
66
67 if [ -z $ANDROID_HOME ]; then
68     if [ -e ~/.android/bashrc ]; then
69         . ~/.android/bashrc
70     else
71         echo "ANDROID_HOME must be set!"
72         exit
73     fi
74 fi
75
76 ../fdroid init --verbose
77 export GNUPGHOME=$WORKSPACE/tests/gnupghome
78 echo "gpghome = '$GNUPGHOME'" >> config.py
79 echo "gpgkey = 'CE71F7FB'" >> config.py
80 echo "build_server_always = True" >> config.py
81
82 # if it can't build fdroid, then its really broken
83 ../fdroid build --verbose --stop --latest org.fdroid.fdroid
84 # Gradle, JNI, preassemble
85 ../fdroid build --verbose --stop org.adaway:55
86 # Uses verification
87 ../fdroid build --verbose --stop info.guardianproject.checkey:101
88 # building old versions should still work
89 ../fdroid build --verbose --stop org.fdroid.fdroid:96150
90 # test OTA update ZIP build and publish
91 ../fdroid build --verbose --stop --latest org.fdroid.fdroid.privileged.ota
92
93 # publish process when building and signing are on separate machines
94 test -d repo || mkdir repo
95 test -d archive || mkdir archive
96 ../fdroid publish --verbose
97 ../fdroid gpgsign --verbose
98 ../fdroid update --verbose --nosign
99 ../fdroid signindex --verbose