Build GSI #312
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build GSI | |
on: | |
workflow_dispatch: | |
env: | |
DISABLE_RUNNER_CLEANUP: false # should ONLY be set to true for debugging | |
ROM_NAME: VoltageOS | |
ROM_VERSION: 3.4 | |
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: | | |
mkdir -p src/ | |
pushd src/ | |
repo init -u https://github.com/VoltageOS/manifest.git -b 14 --depth=1 --git-lfs | |
popd | |
- name: copy manifest config | |
run: | | |
mkdir -p .repo/local_manifests | |
cp -v ../configs/*.xml .repo/local_manifests/ | |
working-directory: src | |
- name: perform full sources sync (with auto retry) | |
uses: nick-fields/retry@v3 | |
with: | |
command: | | |
pushd src/ | |
repo sync -c -j$(nproc --all) --force-sync --no-clone-bundle --no-tags | |
popd | |
max_attempts: 3 | |
retry_on: error | |
timeout_minutes: 40 | |
- name: apply patches | |
run: | | |
# apply pre-patches | |
../patches/apply.sh . pre | |
# apply trebledroid patches | |
../patches/apply.sh . trebledroid | |
# apply personal patches | |
../patches/apply.sh . personal | |
working-directory: src | |
- name: setup tmp directory and stash gapps variants | |
run: | | |
# create tmp directory | |
mkdir -p tmp/ | |
# generate build timestamp and use for entire build | |
echo "$(date +%Y%m%d)" > tmp/cachedBuildDate.txt | |
# move gapps variants post-patching to tmp dir to avoid build cross-contamination | |
mv -v src/vendor/gapps tmp/ | |
mv -v src/vendor/partner_gms tmp/ | |
- name: generate base rom config | |
run: | | |
cp -v ../../../../configs/voltage.mk . | |
bash generate.sh voltage | |
working-directory: src/device/phh/treble | |
- name: build treble app | |
run: | | |
. build/envsetup.sh | |
pushd treble_app/ | |
bash build.sh release | |
cp -v TrebleApp.apk ../vendor/hardware_overlay/TrebleApp/app.apk | |
popd | |
working-directory: src | |
- name: build standard vanilla arm64 image | |
run: | | |
. build/envsetup.sh | |
lunch treble_arm64_bvN-ap1a-userdebug | |
make systemimage -j"$(nproc --all)" | |
mv -v out/target/product/tdgsi_arm64_ab/system.img ../tmp/system_vanilla_arm64.img | |
working-directory: src | |
- name: run vndk sepolicy tests (after first build) | |
run: | | |
. build/envsetup.sh | |
lunch treble_arm64_bvN-ap1a-userdebug | |
make vndk-test-sepolicy -j"$(nproc --all)" | |
working-directory: src | |
- name: build standard microg arm64 image | |
run: | | |
# copy microg to correct folder for build | |
cp -Rfv ../tmp/partner_gms vendor/ | |
. build/envsetup.sh | |
lunch treble_arm64_bmN-ap1a-userdebug | |
make systemimage -j"$(nproc --all)" | |
mv -v out/target/product/tdgsi_arm64_ab/system.img ../tmp/system_microg_arm64.img | |
# remove microg folder to avoid contaminating next build | |
rm -Rfv vendor/partner_gms | |
working-directory: src | |
- name: build standard gapps arm64 image | |
run: | | |
# copy gapps to correct folder for build | |
cp -Rfv ../tmp/gapps vendor/ | |
. build/envsetup.sh | |
lunch treble_arm64_bgN-ap1a-userdebug | |
make systemimage -j"$(nproc --all)" | |
mv -v out/target/product/tdgsi_arm64_ab/system.img ../tmp/system_gapps_arm64.img | |
# remove gapps folder to avoid contaminating next build | |
rm -Rfv vendor/gapps | |
working-directory: src | |
- name: build standard vanilla arm32_binder64 image | |
run: | | |
. build/envsetup.sh | |
lunch treble_a64_bvN-ap1a-userdebug | |
make systemimage -j"$(nproc --all)" | |
mv -v out/target/product/tdgsi_a64_ab/system.img ../tmp/system_vanilla_arm32_binder64.img | |
working-directory: src | |
- name: build standard microg arm32_binder64 image | |
run: | | |
# copy microg to correct folder for build | |
cp -Rfv ../tmp/partner_gms vendor/ | |
. build/envsetup.sh | |
lunch treble_a64_bmN-ap1a-userdebug | |
make systemimage -j"$(nproc --all)" | |
mv -v out/target/product/tdgsi_a64_ab/system.img ../tmp/system_microg_arm32_binder64.img | |
# remove microg folder to avoid contaminating next build | |
rm -Rfv vendor/partner_gms | |
working-directory: src | |
- name: build standard gapps arm32_binder64 image | |
run: | | |
# copy gapps to correct folder for build | |
cp -Rfv ../tmp/gapps vendor/ | |
. build/envsetup.sh | |
lunch treble_a64_bgN-ap1a-userdebug | |
make systemimage -j"$(nproc --all)" | |
mv -v out/target/product/tdgsi_a64_ab/system.img ../tmp/system_gapps_arm32_binder64.img | |
# remove gapps folder to avoid contaminating next build | |
rm -Rfv vendor/gapps | |
working-directory: src | |
- 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: src/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: src/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: src/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: src/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: src/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: src/treble_adapter | |
- name: rename image files | |
run: | | |
buildDate=$(cat 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_NAME}-${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 |