Skip to content

Commit

Permalink
Merge pull request #12 from cd-Crypton/main
Browse files Browse the repository at this point in the history
Update workflows; rework.
  • Loading branch information
carlodandan authored Aug 9, 2023
2 parents f0f6b9d + dfe8781 commit 779974f
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 44 deletions.
39 changes: 24 additions & 15 deletions .github/workflows/Recovery-Builder-PBRP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ jobs:
run: |
cd android-recovery
if [ -f ${{ github.event.inputs.DEVICE_PATH }}/twrp.dependencies ]; then
echo "DEPENDENCIES=twrp" >> $GITHUB_ENV
elif [ -f ${{ github.event.inputs.DEVICE_PATH }}/twrp.dependencies ]; then
echo "DEPENDENCIES=omni" >> $GITHUB_ENV
echo "DEPENDENCIES=twrp.dependencies" >> $GITHUB_ENV
elif [ -f ${{ github.event.inputs.DEVICE_PATH }}/omni.dependencies ]; then
echo "DEPENDENCIES=omni.dependencies" >> $GITHUB_ENV
else
echo "No dependencies file found!"
exit 1
Expand All @@ -143,30 +143,40 @@ jobs:

- name: Sync Dependencies
run: |
bash ${GITHUB_WORKSPACE}/scripts/convert.sh ${{ github.event.inputs.DEVICE_PATH }}/${{ env.DEPENDENCIES }}.dependencies
bash ${GITHUB_WORKSPACE}/scripts/convert.sh ${{ github.event.inputs.DEVICE_PATH }}/${{ env.DEPENDENCIES }}
repo sync -j$(nproc --all)
continue-on-error: true

- name: Building Recovery
- name: Building Image
run: |
cd android-recovery
source build/envsetup.sh
export ALLOW_MISSING_DEPENDENCIES=true
lunch ${{ env.DEVICE_MAKEFILE }}-eng && make clean && make ${{ github.event.inputs.BUILD_TARGET }}image -j$(nproc --all)
- name: Renaming Recovery # Output will be use in final name of recovery.
- name: Set Build Date # Output will be use in Release
run: |
echo "BUILD_DATE=$(date +%Y%m%d)" >> $GITHUB_ENV
cd android-recovery/out/target/product/${{ github.event.inputs.DEVICE_NAME }}
mv ${{ github.event.inputs.BUILD_TARGET }}.img ${{ github.event.inputs.MANIFEST_BRANCH }}-${{ github.event.inputs.DEVICE_NAME }}-${{ env.BUILD_DATE }}.img
echo "Done renaming into ${{ github.event.inputs.MANIFEST_BRANCH }}-${{ github.event.inputs.DEVICE_NAME }}-${{ env.BUILD_DATE }}.img"
- name: Upload to Release
- name: Upload to Release (boot and becovery)
if: github.event.inputs.BUILD_TARGET == 'boot' || github.event.inputs.BUILD_TARGET == 'recovery'
uses: softprops/action-gh-release@v1
with:
files: |
android-recovery/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/${{ github.event.inputs.MANIFEST_BRANCH }}*.img
name: Unofficial PBRP for ${{ github.event.inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
android-recovery/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/${{ github.event.inputs.BUILD_TARGET }}.img
name: Unofficial TWRP for ${{ github.event.inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
tag_name: ${{ github.run_id }}
body: |
Build: ${{ github.event.inputs.MANIFEST_BRANCH }}
Device: ${{ github.event.inputs.DEVICE_TREE }}/tree/${{ github.event.inputs.DEVICE_TREE_BRANCH }}
- name: Upload to Release (if vendor_boot)
if: github.event.inputs.BUILD_TARGET == 'vendorboot'
uses: softprops/action-gh-release@v1
with:
files: |
android-recovery/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/vendor_boot.img
name: Unofficial TWRP for ${{ github.event.inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
tag_name: ${{ github.run_id }}
body: |
Build: ${{ github.event.inputs.MANIFEST_BRANCH }}
Expand Down Expand Up @@ -200,15 +210,14 @@ jobs:
echo "No teei_daemon file found!"
exit 1
fi
echo "File to check is ${{ env.FILE_TO_CHECK }}."
continue-on-error: true

- name: Run LDCheck (Only if LDCHECK was set to check.)
if: github.event.inputs.LDCHECK == 'check'
run: |
cd tools
mv -n libneeds ${GITHUB_WORKSPACE}/workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/
mv -n ldcheck ${GITHUB_WORKSPACE}/workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/
mv -n libneeds ${GITHUB_WORKSPACE}/android-recovery/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/
mv -n ldcheck ${GITHUB_WORKSPACE}/android-recovery/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/
cd ../android-recovery/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root
python3 ldcheck -p system/lib64:vendor/lib64:system/lib:vendor/lib -d ${{ env.FILE_TO_CHECK }}
echo "Done checking missing dependencies. Review, and reconfigure your tree."
Expand Down
72 changes: 47 additions & 25 deletions .github/workflows/Recovery-Builder-TWRP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ on:
description: 'Specify your Device Codename' # As is, just like your PRODUCT_DEVICE in your device tree.
required: true
default: 'macedonia'
MAKEFILE_NAME:
description: 'Specify your Makefile Name' # Look for twrp_ or omni_codename.mk, just remove the .mk
required: true
default: 'twrp_macedonia'
BUILD_TARGET:
description: 'Specify your Build Target' # Pick among boot, recovery and vendor_boot
required: true
Expand Down Expand Up @@ -61,7 +57,7 @@ jobs:
contents: write
steps:
- name: Check Out
uses: actions/checkout@v2.5.0
uses: actions/checkout@v3

- name: Display Inputs
run: |
Expand All @@ -71,7 +67,6 @@ jobs:
echo "Device Branch: ${{ github.event.inputs.DEVICE_TREE_BRANCH }}"
echo "Device Path: ${{ github.event.inputs.DEVICE_PATH }}"
echo "Device Name: ${{ github.event.inputs.DEVICE_NAME }}"
echo "Makefile Name: ${{ github.event.inputs.MAKEFILE_NAME }}"
echo "Build Target: ${{ github.event.inputs.BUILD_TARGET }}image"
- name: Cleanup
Expand Down Expand Up @@ -127,40 +122,68 @@ jobs:
cd android-recovery
git clone ${{ github.event.inputs.DEVICE_TREE }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.DEVICE_PATH }}
- name: Check Build Tree
uses: haya14busa/action-cond@v1
id: buildtree
with:
cond: ${{ github.event.inputs.MANIFEST_BRANCH == 'twrp-11' || github.event.inputs.MANIFEST_BRANCH == 'twrp-12.1' }}
if_true: twrp
if_false: omni
- name: Check Build Makefile
run: |
cd android-recovery
if [ -f ${{ github.event.inputs.DEVICE_PATH }}/twrp_${{ github.event.inputs.DEVICE_NAME}}.mk ]; then
echo "DEVICE_MAKEFILE=twrp_${{ github.event.inputs.DEVICE_NAME }}" >> $GITHUB_ENV
elif [ -f ${{ github.event.inputs.DEVICE_PATH }}/omni_${{ github.event.inputs.DEVICE_NAME}}.mk ]; then
echo "DEVICE_MAKEFILE=omni_${{ github.event.inputs.DEVICE_NAME }}" >> $GITHUB_ENV
else
echo "No recovery makefile file found!"
exit 1
fi
continue-on-error: true

- name: Check Dependencies
run: |
cd android-recovery
if [ -f ${{ github.event.inputs.DEVICE_PATH }}/twrp.dependencies ]; then
echo "DEPENDENCIES=twrp.dependencies" >> $GITHUB_ENV
elif [ -f ${{ github.event.inputs.DEVICE_PATH }}/omni.dependencies ]; then
echo "DEPENDENCIES=omni.dependencies" >> $GITHUB_ENV
else
echo "No dependencies file found!"
exit 1
fi
continue-on-error: true

- name: Sync Dependencies
run: |
bash ${GITHUB_WORKSPACE}/scripts/convert.sh ${{ github.event.inputs.DEVICE_PATH }}/${{ steps.buildtree.outputs.value }}.dependencies
bash ${GITHUB_WORKSPACE}/scripts/convert.sh ${{ github.event.inputs.DEVICE_PATH }}/${{ env.DEPENDENCIES }}
repo sync -j$(nproc --all)
continue-on-error: true

- name: Building Recovery
- name: Building Image
run: |
cd android-recovery
source build/envsetup.sh
export ALLOW_MISSING_DEPENDENCIES=true
lunch ${{ github.event.inputs.MAKEFILE_NAME }}-eng && make clean && make ${{ github.event.inputs.BUILD_TARGET }}image -j$(nproc --all)
lunch ${{ env.DEVICE_MAKEFILE }}-eng && make clean && make ${{ github.event.inputs.BUILD_TARGET }}image -j$(nproc --all)
echo "Done building your ${{ github.event.inputs.BUILD_TARGET }}.img"
- name: Renaming Recovery # Output will be use in final name of recovery.
- name: Set Build Date # Output will be use in Release
run: |
echo "BUILD_DATE=$(date +%Y%m%d)" >> $GITHUB_ENV
cd android-recovery/out/target/product/${{ github.event.inputs.DEVICE_NAME }}
mv ${{ github.event.inputs.BUILD_TARGET }}.img ${{ github.event.inputs.MANIFEST_BRANCH }}-${{ github.event.inputs.DEVICE_NAME }}-${{ env.BUILD_DATE }}.img
echo "Done renaming into ${{ github.event.inputs.MANIFEST_BRANCH }}-${{ github.event.inputs.DEVICE_NAME }}-${{ env.BUILD_DATE }}.img"
- name: Upload to Release
- name: Upload to Release (boot and becovery)
if: github.event.inputs.BUILD_TARGET == 'boot' || github.event.inputs.BUILD_TARGET == 'recovery'
uses: softprops/action-gh-release@v1
with:
files: |
android-recovery/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/${{ github.event.inputs.BUILD_TARGET }}.img
name: Unofficial TWRP for ${{ github.event.inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
tag_name: ${{ github.run_id }}
body: |
Build: ${{ github.event.inputs.MANIFEST_BRANCH }}
Device: ${{ github.event.inputs.DEVICE_TREE }}/tree/${{ github.event.inputs.DEVICE_TREE_BRANCH }}
- name: Upload to Release (if vendor_boot)
if: github.event.inputs.BUILD_TARGET == 'vendorboot'
uses: softprops/action-gh-release@v1
with:
files: |
android-recovery/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/${{ github.event.inputs.MANIFEST_BRANCH }}*.img
android-recovery/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/vendor_boot.img
name: Unofficial TWRP for ${{ github.event.inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
tag_name: ${{ github.run_id }}
body: |
Expand Down Expand Up @@ -195,15 +218,14 @@ jobs:
echo "No teei_daemon file found!"
exit 1
fi
echo "File to check is ${{ env.FILE_TO_CHECK }}."
continue-on-error: true

- name: Run LDCheck (Only if LDCHECK was set to check.)
if: github.event.inputs.LDCHECK == 'check'
run: |
cd tools
mv -n libneeds ${GITHUB_WORKSPACE}/workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/
mv -n ldcheck ${GITHUB_WORKSPACE}/workspace/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/
mv -n libneeds ${GITHUB_WORKSPACE}/android-recovery/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/
mv -n ldcheck ${GITHUB_WORKSPACE}/android-recovery/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/
cd ../android-recovery/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root
python3 ldcheck -p system/lib64:vendor/lib64:system/lib:vendor/lib -d ${{ env.FILE_TO_CHECK }}
echo "Done checking missing dependencies. Review, and reconfigure your tree."
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@ Compile your first custom recovery via Github Actions - with ldcheck setup. This
1. Fork this repository.

2. Go to `Action` tab > `All workflows` > Pick which Build you need (`TWRP or PBRP`) > `Run workflow`, then pick required information from each drop-down list:
* Manifest Branch (12.1, 11.0, etc.)
* Manifest Branch (*12.1, *11.0, etc.)
* Device Tree (Your device tree repository link)
* Device Tree Branch (Your device tree repository branch)
* Device Name (Your device codename)
* Device Path (device/brand/codename)
* Build Target (boot, reecovery, vendorboot)
* LDCHECK (Yes or No)

- If you are building manually/locally and you want to use ldcheck for checking dependencies, visit [THIS](https://github.com/TeamWin/android_device_qcom_twrp-common/tree/android-11#using-ldcheck-to-find-dependencies) this for guide.
* LDCHECK (check or ignore)
- LDCHECK is for checking file or binary dependencies with other files, to detect whether your tree has missing files, especially for decryption problem. This workflow were set to target qseecomd (for QCom) and teei_daemon/mcDriverDaemon (for MTK). You have to manually change ldcheck setup in yml config to target other files.
- If you are building manually/locally and you want to use ldcheck for checking dependencies, visit [THIS](https://github.com/TeamWin/android_device_qcom_twrp-common/tree/android-11#using-ldcheck-to-find-dependencies) this for guide.

## Notes
- Initially, this workflow only supports up to 4 branches for manifest 9.0 to 12.1, if you build below 9.0, add it yourself.

## Credits
- https://github.com/that1
- https://github.com/TeamWin
- https://github.com/PitchBlackRecoveryProject
- https://github.com/azwhikaru
- And to all Contributors in every repositories and scripts I used.

0 comments on commit 779974f

Please sign in to comment.