Skip to content

Commit

Permalink
Build Seedvault with AOSP in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
stevesoltys committed Oct 15, 2023
1 parent 75fc00d commit 9672f37
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
task:
name: seedvault-aosp
timeout_in: 120m
container:
image: ubuntu:23.04
cpu: 8
memory: 32G
build_script:
- ./.github/scripts/build_aosp.sh
always:
seedvault_artifacts:
path: "out/target/product/generic_arm64/system/priv-app/Seedvault/Seedvault.apk"
81 changes: 81 additions & 0 deletions .github/scripts/build_aosp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/usr/bin/env bash

export DEBIAN_FRONTEND=noninteractive

apt-get update
apt-get install -y git-core gnupg flex bison build-essential zip curl zlib1g-dev \
libc6-dev-i386 libncurses5 x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev \
libxml2-utils xsltproc unzip fontconfig python3 npm pip e2fsprogs python3-protobuf \
fonts-dejavu diffutils rsync ccache

npm install --global yarn

mkdir -p ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
ln -s /usr/bin/python3 /usr/bin/python
export PATH=~/bin:$PATH

set -e

retry() {
set +e
local max_attempts=${ATTEMPTS-5}
local timeout=${TIMEOUT-1}
local attempt=0
local exitCode=0

while [[ $attempt < $max_attempts ]]
do
"$@"
exitCode=$?

if [[ $exitCode == 0 ]]
then
break
fi

echo "Failure! Retrying ($*) in $timeout.."
sleep "${timeout}"
attempt=$(( attempt + 1 ))
timeout=$(( timeout * 2 ))
done

if [[ $exitCode != 0 ]]
then
echo "Failed too many times! ($*)"
fi

set -e

return $exitCode
}

DEVICE=$1
TARGET=$2
export DISABLE_ROBO_RUN_TESTS=true

# set git identity
git config --global user.email "[email protected]"
git config --global user.name "Seedvault"

retry curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

# create custom manifest with Seedvault included
git clone https://android.googlesource.com/platform/manifest.git
mv manifest /aosp-manifest
cd /aosp-manifest
insert_text="<remote name=\"seedvault\" fetch=\"https://github.com/$CIRRUS_REPO_OWNER/\" revision=\"refs/heads/$CIRRUS_BRANCH\" />\n <project path=\"external/seedvault\" name=\"$CIRRUS_REPO_NAME\" remote=\"seedvault\" />"
sed -i "/<manifest>/a ${insert_text}" "default.xml"

mkdir -p /aosp
cd /aosp
retry yes | repo init -u /aosp-manifest -b 14 --depth=1
retry repo sync -c -j8 --fail-fast --force-sync

# Cirrus CI seems to (possibly) reschedule tasks that aren't sending out logs for a while?
while true; do echo "Still building..."; sleep 30; done &

source build/envsetup.sh
m -j8 Seedvault

0 comments on commit 9672f37

Please sign in to comment.