chiark / gitweb /
update: make icon extraction less dependent on aapt
[fdroidserver.git] / jenkins-build-all
1 #!/bin/bash
2 #
3 # this is the script run by the Jenkins server to run the build tests.  Be
4 # sure to always run it in its dir, i.e. ./jenkins-build, otherwise it might
5 # remove things that you don't want it to.
6 #
7 # runs here:
8 # https://jenkins.debian.net/job/reproducible_fdroid_build_apps
9
10
11 if [ `dirname $0` != "." ]; then
12     echo "only run this script like ./`basename $0`"
13     exit
14 fi
15
16 # jenkins.debian.net slaves do not export WORKSPACE
17 if [ -z $WORKSPACE ]; then
18     export WORKSPACE=`pwd`
19 fi
20
21 set -e
22 set -x
23
24 # report info about virtualization
25 (dmesg | grep -i -e hypervisor -e qemu -e kvm) || true
26 (lspci | grep -i -e virtio -e virtualbox -e qemu -e kvm) || true
27 lsmod
28 if systemd-detect-virt -q ; then
29         echo "Virtualization is used:" `systemd-detect-virt`
30 else
31         echo "No virtualization is used."
32 fi
33 sudo /bin/chmod -R a+rX /var/lib/libvirt/images
34 echo 'maximum allowed number of open file descriptors: ' `ulimit -n`
35 ls -ld /var/lib/libvirt/images
36 ls -l /var/lib/libvirt/images || echo no access
37 ls -lR ~/.vagrant.d/ || echo no access
38 virsh --connect qemu:///system list --all || echo cannot virsh list
39 cat /etc/issue
40
41 /sbin/ifconfig || true
42 hostname || true
43
44 # point to the Vagrant/VirtualBox configs created by reproducible_setup_fdroid_build_environment.sh
45 # these variables are actually set in fdroidserver/jenkins-build-makebuildserver
46 export SETUP_WORKSPACE=$(dirname $WORKSPACE)/reproducible_setup_fdroid_build_environment
47 export XDG_CONFIG_HOME=$SETUP_WORKSPACE
48 export VBOX_USER_HOME=$SETUP_WORKSPACE/VirtualBox
49 export VAGRANT_HOME=$SETUP_WORKSPACE/vagrant.d
50
51 # make sure we have the right buildserver paths and its ready for use
52 vagrant global-status \
53     | grep -F -e reproducible_setup_fdroid_build_environment -o -e fdroiddata/builder
54
55 # the way we handle jenkins slaves doesn't copy the workspace to the slaves
56 # so we need to "manually" clone the git repo hereā€¦
57 cd $WORKSPACE
58
59 # set up Android SDK to use the Debian packages in stretch
60 export ANDROID_HOME=/usr/lib/android-sdk
61
62 # now build the whole archive
63 cd $WORKSPACE
64
65 # this can be handled in the jenkins job, or here:
66 if [ -e fdroiddata ]; then
67     cd fdroiddata
68     while ! git fetch origin --tags --prune; do sleep 10; done
69     git checkout master
70     git reset --hard origin/master
71     # keep all the cloned source repos
72     git clean -fdx --exclude build --exclude repo --exclude unsigned
73 else
74     git clone https://gitlab.com/fdroid/fdroiddata.git fdroiddata
75     cd fdroiddata
76 fi
77
78 echo "build_server_always = True" > config.py
79 # if the local mediawiki is available, then use it
80 if nc -z -w1 localhost 32445; then
81     wikiflag="--wiki"
82     echo "wiki_protocol = 'http'" >> config.py
83     echo "wiki_server = 'localhost:32445'" >> config.py
84     echo "wiki_path = '/mediawiki/'" >> config.py
85     echo "wiki_user = 'fdroid'" >> config.py
86     echo "wiki_password = 'update.TestCase'" >> config.py
87 else
88     sed -i '/^wiki_/d' config.py
89 fi
90
91 $WORKSPACE/fdroid build --verbose --latest --no-tarball --all $wikiflag
92
93 vagrant global-status
94 if [ -d builder ]; then
95     cd builder
96     vagrant status
97 fi