Merge pull request #586 from seedvault-app/feature/aosp-build
Build Seedvault with AOSP in CI
This commit is contained in:
commit
09bc8f0356
2 changed files with 104 additions and 0 deletions
13
.cirrus.yml
Normal file
13
.cirrus.yml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
task:
|
||||||
|
name: Build with AOSP
|
||||||
|
only_if: $CIRRUS_PR_LABELS =~ ".*aosp-build.*"
|
||||||
|
timeout_in: 120m
|
||||||
|
container:
|
||||||
|
image: ubuntu:23.04
|
||||||
|
cpu: 8
|
||||||
|
memory: 32G
|
||||||
|
build_script:
|
||||||
|
- ./.github/scripts/build_aosp.sh aosp_arm64 userdebug android-14.0.0_r1
|
||||||
|
always:
|
||||||
|
seedvault_artifacts:
|
||||||
|
path: $CIRRUS_WORKING_DIR/Seedvault.apk
|
91
.github/scripts/build_aosp.sh
vendored
Executable file
91
.github/scripts/build_aosp.sh
vendored
Executable file
|
@ -0,0 +1,91 @@
|
||||||
|
#!/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
|
||||||
|
BRANCH=$3
|
||||||
|
|
||||||
|
git config --global user.email "seedvault@example.com"
|
||||||
|
git config --global user.name "Seedvault CI"
|
||||||
|
|
||||||
|
retry curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
|
||||||
|
chmod a+x ~/bin/repo
|
||||||
|
|
||||||
|
mkdir -p /aosp
|
||||||
|
cd /aosp
|
||||||
|
retry yes | repo init -u https://android.googlesource.com/platform/manifest -b "$BRANCH" --depth=1
|
||||||
|
|
||||||
|
mkdir -p .repo/local_manifests
|
||||||
|
cat << EOF > .repo/local_manifests/seedvault.xml
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<manifest>
|
||||||
|
|
||||||
|
<remote name="seedvault"
|
||||||
|
fetch="https://github.com/$CIRRUS_REPO_OWNER" />
|
||||||
|
|
||||||
|
<project name="seedvault" path="external/seedvault"
|
||||||
|
revision="$CIRRUS_CHANGE_IN_REPO" remote="$CIRRUS_REPO_NAME" />
|
||||||
|
|
||||||
|
</manifest>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
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
|
||||||
|
lunch $DEVICE-$TARGET
|
||||||
|
m -j6 Seedvault
|
||||||
|
|
||||||
|
mv /aosp/out/target/product/generic_arm64/system/system_ext/priv-app/Seedvault/Seedvault.apk "$CIRRUS_WORKING_DIR"
|
Loading…
Reference in a new issue