Skip to content

Build GSI

Build GSI #193

Workflow file for this run

name: Build GSI
on:
workflow_dispatch:
env:
DISABLE_RUNNER_CLEANUP: false # should ONLY be set to true if ABSOLUTELY necessary
ROM_NAME: VoltageOS
ROM_VERSION: 3.2
jobs:
build-gsi:
runs-on: [self-hosted]
steps:
- name: setup git config
run: |
git config --global user.email "androidbuild@localhost"
git config --global user.name "androidbuild"
- name: checkout basic repo
uses: actions/checkout@v4
- name: clone rom manifest
run: repo init -u https://github.com/VoltageOS/manifest.git -b 14 --depth=1
- name: copy manifest config
run: |
mkdir -p .repo/local_manifests
cp -v manifest.xml .repo/local_manifests/
- name: setup git-lfs hook
run: git lfs install
- name: perform full sources sync (with auto retry)
uses: nick-fields/retry@v3
with:
command: repo sync -c -j$(nproc --all) --force-sync --no-clone-bundle --no-tags
max_attempts: 3
retry_on: error
timeout_minutes: 20
- name: fetch all git-lfs objects
run: |
grep -l 'merge=lfs' $( find $PWD -name .gitattributes ) /dev/null | while IFS= read -r line; do
dir=$(dirname $line)
echo $dir
( cd $dir ; git lfs pull )
done
- name: apply patches
run: |
./patches/apply.sh . pre
./patches/apply.sh . trebledroid
./patches/apply.sh . personal
- name: generate base rom config
run: |
cp -v ../../../voltage.mk .
bash generate.sh voltage
working-directory: device/phh/treble
- name: build treble app
run: |
. build/envsetup.sh
cd treble_app/
bash build.sh release
cp -v TrebleApp.apk ../vendor/hardware_overlay/TrebleApp/app.apk
- name: create temporary output directory
run: mkdir -p tmp/
- name: build standard vanilla arm64 image
run: |
. build/envsetup.sh
lunch treble_arm64_bvN-userdebug
make systemimage -j"$(nproc --all)"
mv -v out/target/product/tdgsi_arm64_ab/system.img tmp/system_vanilla_arm64.img
- name: run vndk sepolicy tests (after first build)
run: |
. build/envsetup.sh
lunch treble_arm64_bvN-userdebug
make vndk-test-sepolicy -j"$(nproc --all)"
- name: build standard microg arm64 image
run: |
. build/envsetup.sh
lunch treble_arm64_bmN-userdebug
make systemimage -j"$(nproc --all)"
mv -v out/target/product/tdgsi_arm64_ab/system.img tmp/system_microg_arm64.img
- name: build standard gapps arm64 image
run: |
. build/envsetup.sh
lunch treble_arm64_bgN-userdebug
make systemimage -j"$(nproc --all)"
mv -v out/target/product/tdgsi_arm64_ab/system.img tmp/system_gapps_arm64.img
- name: build standard vanilla arm32_binder64 image
run: |
. build/envsetup.sh
lunch treble_a64_bvN-userdebug
make systemimage -j"$(nproc --all)"
mv -v out/target/product/tdgsi_a64_ab/system.img tmp/system_vanilla_arm32_binder64.img
- name: build standard microg arm32_binder64 image
run: |
. build/envsetup.sh
lunch treble_a64_bmN-userdebug
make systemimage -j"$(nproc --all)"
mv -v out/target/product/tdgsi_a64_ab/system.img tmp/system_microg_arm32_binder64.img
- name: build standard gapps arm32_binder64 image
run: |
. build/envsetup.sh
lunch treble_a64_bgN-userdebug
make systemimage -j"$(nproc --all)"
mv -v out/target/product/tdgsi_a64_ab/system.img tmp/system_gapps_arm32_binder64.img
- name: adapt vndklite vanilla arm64 image
run: |
cp -v ../tmp/system_vanilla_arm64.img standard_system_vanilla_arm64.img
sudo bash lite-adapter.sh 64 standard_system_vanilla_arm64.img
sudo mv s.img ../tmp/s_vanilla_arm64_vndklite.img
sudo chown $(whoami):$(id | awk -F'[()]' '{ print $2 }') ../tmp/s_vanilla_arm64_vndklite.img
working-directory: treble_adapter
- name: adapt vndklite microg arm64 image
run: |
cp -v ../tmp/system_microg_arm64.img standard_system_microg_arm64.img
sudo bash lite-adapter.sh 64 standard_system_microg_arm64.img
sudo mv s.img ../tmp/s_microg_arm64_vndklite.img
sudo chown $(whoami):$(id | awk -F'[()]' '{ print $2 }') ../tmp/s_microg_arm64_vndklite.img
working-directory: treble_adapter
- name: adapt vndklite gapps arm64 image
run: |
cp -v ../tmp/system_gapps_arm64.img standard_system_gapps_arm64.img
sudo bash lite-adapter.sh 64 standard_system_gapps_arm64.img
sudo mv s.img ../tmp/s_gapps_arm64_vndklite.img
sudo chown $(whoami):$(id | awk -F'[()]' '{ print $2 }') ../tmp/s_gapps_arm64_vndklite.img
working-directory: treble_adapter
- name: adapt vndklite vanilla arm32_binder64 image
run: |
cp -v ../tmp/system_vanilla_arm32_binder64.img standard_system_vanilla_arm32_binder64.img
sudo bash lite-adapter.sh 32 standard_system_vanilla_arm32_binder64.img
sudo mv s.img ../tmp/s_vanilla_arm32_binder64_vndklite.img
sudo chown $(whoami):$(id | awk -F'[()]' '{ print $2 }') ../tmp/s_vanilla_arm32_binder64_vndklite.img
working-directory: treble_adapter
- name: adapt microg vanilla arm32_binder64 image
run: |
cp -v ../tmp/system_microg_arm32_binder64.img standard_system_microg_arm32_binder64.img
sudo bash lite-adapter.sh 32 standard_system_microg_arm32_binder64.img
sudo mv s.img ../tmp/s_microg_arm32_binder64_vndklite.img
sudo chown $(whoami):$(id | awk -F'[()]' '{ print $2 }') ../tmp/s_microg_arm32_binder64_vndklite.img
working-directory: treble_adapter
- name: adapt vndklite gapps arm32_binder64 image
run: |
cp -v ../tmp/system_gapps_arm32_binder64.img standard_system_gapps_arm32_binder64.img
sudo bash lite-adapter.sh 32 standard_system_gapps_arm32_binder64.img
sudo mv s.img ../tmp/s_gapps_arm32_binder64_vndklite.img
sudo chown $(whoami):$(id | awk -F'[()]' '{ print $2 }') ../tmp/s_gapps_arm32_binder64_vndklite.img
working-directory: treble_adapter
- name: rename image files
run: |
buildDate=$(date +%Y%m%d)
echo "${buildDate}" > cachedBuildDate.txt
# arm64 - standard
mv -v system_vanilla_arm64.img "${ROM_NAME}"-vanilla-arm64-ab-"${ROM_VERSION}"-"${buildDate}"-UNOFFICIAL.img
mv -v system_microg_arm64.img "${ROM_NAME}"-microg-arm64-ab-"${ROM_VERSION}"-"${buildDate}"-UNOFFICIAL.img
mv -v system_gapps_arm64.img "${ROM_NAME}"-gapps-arm64-ab-"${ROM_VERSION}"-"${buildDate}"-UNOFFICIAL.img
# arm32_binder64 - standard
mv -v system_vanilla_arm32_binder64.img "${ROM_NAME}"-vanilla-arm32_binder64-ab-"${ROM_VERSION}"-"${buildDate}"-UNOFFICIAL.img
mv -v system_microg_arm32_binder64.img "${ROM_NAME}"-microg-arm32_binder64-ab-"${ROM_VERSION}"-"${buildDate}"-UNOFFICIAL.img
mv -v system_gapps_arm32_binder64.img "${ROM_NAME}"-gapps-arm32_binder64-ab-"${ROM_VERSION}"-"${buildDate}"-UNOFFICIAL.img
# arm64 - vndklite
mv -v s_vanilla_arm64_vndklite.img "${ROM_NAME}"-vanilla-arm64-ab-vndklite-"${ROM_VERSION}"-"${buildDate}"-UNOFFICIAL.img
mv -v s_microg_arm64_vndklite.img "${ROM_NAME}"-microg-arm64-ab-vndklite-"${ROM_VERSION}"-"${buildDate}"-UNOFFICIAL.img
mv -v s_gapps_arm64_vndklite.img "${ROM_NAME}"-gapps-arm64-ab-vndklite-"${ROM_VERSION}"-"${buildDate}"-UNOFFICIAL.img
# arm32_binder64 - vndklite
mv -v s_vanilla_arm32_binder64_vndklite.img "${ROM_NAME}"-vanilla-arm32_binder64-ab-vndklite-"${ROM_VERSION}"-"${buildDate}"-UNOFFICIAL.img
mv -v s_microg_arm32_binder64_vndklite.img "${ROM_NAME}"-microg-arm32_binder64-ab-vndklite-"${ROM_VERSION}"-"${buildDate}"-UNOFFICIAL.img
mv -v s_gapps_arm32_binder64_vndklite.img "${ROM_NAME}"-gapps-arm32_binder64-ab-vndklite-"${ROM_VERSION}"-"${buildDate}"-UNOFFICIAL.img
working-directory: tmp
- name: compress all images with xz
run: find . -maxdepth 1 -name '*.img' -exec xz -9 -T0 -v -z "{}" \;
working-directory: tmp
- name: copy all files to web directory
run: |
buildDate=$(cat cachedBuildDate.txt)
webDir="/var/www/html/${ROM_VERSION}-${buildDate}"
mkdir -p "${webDir}"
cp -fv *.img.xz "${webDir}/"
working-directory: tmp
- name: cleanup work directory
uses: eviden-actions/clean-self-hosted-runner@v1
if: ${{ always() }} # Run even if previous steps in the job fail or are canceled