Skip to content

Commit

Permalink
Merge branch 'lazycodebuilder:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
KawaiiSparkle authored Aug 7, 2024
2 parents 3db0e13 + 2f5fe75 commit f442fba
Show file tree
Hide file tree
Showing 5 changed files with 230 additions and 188 deletions.
112 changes: 66 additions & 46 deletions .github/workflows/OrangeFox-OFRP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ on:
description: 'Custom Recovery Tree Branch'
required: true
default: 'android-14_ofrp'
DEVICE_PATH:
description: 'Specify your device path.'
required: true
default: 'device/realme/RMX1851'
DEVICE_NAME:
description: 'Specify your Device Codename.'
required: true
default: 'RMX1851'
BUILD_TARGET:
description: 'Specify your Build Target'
required: true
Expand Down Expand Up @@ -67,12 +59,10 @@ jobs:
- name: Display Inputs
run: |
echo "Displaying variables/inputs."
echo "Manifest Branch: ${{ github.event.inputs.MANIFEST_BRANCH }}"
echo "Device Tree: ${{ github.event.inputs.DEVICE_TREE }}"
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 "Build Target: ${{ github.event.inputs.BUILD_TARGET }}image"
echo "Manifest Branch: ${{ inputs.MANIFEST_BRANCH }}"
echo "Device Tree: ${{ inputs.DEVICE_TREE }}"
echo "Device Branch: ${{ inputs.DEVICE_TREE_BRANCH }}"
echo "Build Target: ${{ inputs.BUILD_TARGET }}image"
- name: Clean-up
uses: rokibhasansagar/slimhub_actions@main
Expand All @@ -96,41 +86,73 @@ jobs:
git config --global user.name "lazycodebuilder"
git config --global user.email "[email protected]"
git clone https://gitlab.com/OrangeFox/sync.git
if [ ${{ github.event.inputs.MANIFEST_BRANCH }} == '11.0' ] || [ ${{ github.event.inputs.MANIFEST_BRANCH }} == '12.1' ]; then
echo "Sync fox_${{ github.event.inputs.MANIFEST_BRANCH }} branch"
if [ ${{ inputs.MANIFEST_BRANCH }} == '11.0' ] || [ ${{ inputs.MANIFEST_BRANCH }} == '12.1' ]; then
echo "Sync fox_${{ inputs.MANIFEST_BRANCH }} branch"
echo "CHECK_LEGACY_BRANCH=false" >> $GITHUB_ENV
cd sync
./orangefox_sync.sh --branch ${{ github.event.inputs.MANIFEST_BRANCH }} --path ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
./orangefox_sync.sh --branch ${{ inputs.MANIFEST_BRANCH }} --path ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}
else
echo "Sync legacy fox_${{ github.event.inputs.MANIFEST_BRANCH }} branch"
echo "Sync legacy fox_${{ inputs.MANIFEST_BRANCH }} branch"
echo "CHECK_LEGACY_BRANCH=true" >> $GITHUB_ENV
cd sync/legacy
./orangefox_sync_legacy.sh --branch ${{ github.event.inputs.MANIFEST_BRANCH }} --path ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
./orangefox_sync_legacy.sh --branch ${{ inputs.MANIFEST_BRANCH }} --path ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}
fi
- name: Clone Device Tree
run: |
cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
git clone ${{ github.event.inputs.DEVICE_TREE }} -b ${{ github.event.inputs.DEVICE_TREE_BRANCH }} ./${{ github.event.inputs.DEVICE_PATH }}
cd ${{ github.event.inputs.DEVICE_PATH }}
cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}
git clone ${{ inputs.DEVICE_TREE }} -b ${{ inputs.DEVICE_TREE_BRANCH }} ./device_tree
cd device_tree
echo "COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Extracting variables from .mk file
run: |
cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}/device_tree
# Initialize variables
DEVICE_MAKEFILE=""
DEVICE_DIRECTORY=""
DEVICE_NAME=""
# Loop through each .mk file in the current directory
for file in *.mk; do
# Extract variables using sed
makefile=$(sed -n 's/^[[:space:]]*PRODUCT_NAME[[:space:]]*:=\s*\(.*\)/\1/p' "$file")
brand=$(sed -n 's/^[[:space:]]*PRODUCT_BRAND[[:space:]]*:=\s*\(.*\)/\1/p' "$file")
codename=$(sed -n 's/^[[:space:]]*PRODUCT_DEVICE[[:space:]]*:=\s*\(.*\)/\1/p' "$file")
if [[ -n "$makefile" && -n "$brand" && -n "$codename" ]]; then
DEVICE_MAKEFILE="$makefile"
DEVICE_DIRECTORY="device/$brand"
DEVICE_NAME="$codename"
echo "DEVICE_MAKEFILE=${DEVICE_MAKEFILE}" >> $GITHUB_ENV
echo "DEVICE_NAME=${DEVICE_NAME}" >> $GITHUB_ENV
echo "DEVICE_DIRECTORY=${DEVICE_DIRECTORY}" >> $GITHUB_ENV
break
fi
done
# Navigate to the parent directory
cd ../
# Create the necessary directories
echo "Creating directory: $DEVICE_DIRECTORY"
mkdir -p "$DEVICE_DIRECTORY"
# Move device_tree folder to device_directory and rename it to $DEVICE_NAME
echo "Moving device_tree to $DEVICE_DIRECTORY/$DEVICE_NAME"
mv device_tree "$DEVICE_DIRECTORY"/"$DEVICE_NAME"
- name: Installing python2 for legacy builds
if: env.CHECK_LEGACY_BRANCH == 'true'
run: |
sudo apt-get install python2 python-is-python2
- name: Building OrangeFox
run: |
cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}
set +e
source build/envsetup.sh
export ALLOW_MISSING_DEPENDENCIES=true
set -e
if [ ${{ github.event.inputs.MANIFEST_BRANCH }} == '11.0' ] || [ ${{ github.event.inputs.MANIFEST_BRANCH }} == '12.1' ]; then
lunch twrp_${{ github.event.inputs.DEVICE_NAME }}-eng && make clean && mka adbd ${{ github.event.inputs.BUILD_TARGET }}image
if [ ${{ inputs.MANIFEST_BRANCH }} == '11.0' ] || [ ${{ inputs.MANIFEST_BRANCH }} == '12.1' ]; then
lunch twrp_${{ env.DEVICE_NAME }}-eng && make clean && mka adbd ${{ inputs.BUILD_TARGET }}image
else
lunch omni_${{ github.event.inputs.DEVICE_NAME }}-eng && make clean && mka ${{ github.event.inputs.BUILD_TARGET }}image
lunch omni_${{ env.DEVICE_NAME }}-eng && make clean && mka ${{ inputs.BUILD_TARGET }}image
fi
- name: Set Build Date # For Build Date Info, currently using Asia/Manila
Expand All @@ -139,16 +161,16 @@ jobs:
- name: Check if Recovery Exist
run: |
cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}
if [ -f out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img ]; then
cd ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}
if [ -f out/target/product/${{ env.DEVICE_NAME }}/OrangeFox*.img ]; then
echo "CHECK_IMG_IS_OK=true" >> $GITHUB_ENV
echo "MD5_IMG=$(md5sum out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img | cut -d ' ' -f 1)" >> $GITHUB_ENV
echo "MD5_IMG=$(md5sum out/target/product/${{ env.DEVICE_NAME }}/OrangeFox*.img | cut -d ' ' -f 1)" >> $GITHUB_ENV
else
echo "Recovery out directory is empty."
fi
if [ -f out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.zip ]; then
if [ -f out/target/product/${{ env.DEVICE_NAME }}/OrangeFox*.zip ]; then
echo "CHECK_ZIP_IS_OK=true" >> $GITHUB_ENV
echo "MD5_ZIP=$(md5sum out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.zip | cut -d ' ' -f 1)" >> $GITHUB_ENV
echo "MD5_ZIP=$(md5sum out/target/product/${{ env.DEVICE_NAME }}/OrangeFox*.zip | cut -d ' ' -f 1)" >> $GITHUB_ENV
else
echo "Recovery out directory is empty."
fi
Expand All @@ -158,28 +180,26 @@ jobs:
uses: softprops/action-gh-release@master
with:
files: |
OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img
OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.img.tar
OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/OrangeFox*.zip
OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/ramdisk*.img
OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/*.gz
OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/*.lz4
name: Unofficial OrangeFox for ${{ github.event.inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}/out/target/product/${{ env.DEVICE_NAME }}/OrangeFox*.img
OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}/out/target/product/${{ env.DEVICE_NAME }}/OrangeFox*.img.tar
OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}/out/target/product/${{ env.DEVICE_NAME }}/OrangeFox*.zip
OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}/out/target/product/${{ env.DEVICE_NAME }}/ramdisk-recovery.*
name: Unofficial OrangeFox for ${{ env.DEVICE_NAME }} // ${{ env.BUILD_DATE }}
tag_name: ${{ github.run_id }}
body: |
Build: ${{ github.event.inputs.MANIFEST_BRANCH }}
Device: [Device Tree/Branch](${{ github.event.inputs.DEVICE_TREE }}/tree/${{ github.event.inputs.DEVICE_TREE_BRANCH }})
Commit: Most recent [commit](${{ github.event.inputs.DEVICE_TREE }}/commit/${{ env.COMMIT_ID }}) during building.
Build: ${{ inputs.MANIFEST_BRANCH }}
Device: [Device Tree/Branch](${{ inputs.DEVICE_TREE }}/tree/${{ inputs.DEVICE_TREE_BRANCH }})
Commit: Most recent [commit](${{ inputs.DEVICE_TREE }}/commit/${{ env.COMMIT_ID }}) during building.
MD5 (img): ${{ env.MD5_IMG }}
MD5 (zip): ${{ env.MD5_ZIP }}
- name: Run LDCheck
if: github.event.inputs.LDCHECK == 'true'
if: inputs.LDCHECK == 'true'
run: |
cd tools
mv -n libneeds ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/
mv -n ldcheck ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root/
cd ../OrangeFox/fox_${{ github.event.inputs.MANIFEST_BRANCH }}/out/target/product/${{ github.event.inputs.DEVICE_NAME }}/recovery/root
python3 ldcheck -p system/lib64:vendor/lib64:system/lib:vendor/lib -d ${{ github.event.inputs.LDCHECKPATH }}
mv -n libneeds ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}/out/target/product/${{ env.DEVICE_NAME }}/recovery/root/
mv -n ldcheck ${GITHUB_WORKSPACE}/OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}/out/target/product/${{ env.DEVICE_NAME }}/recovery/root/
cd ../OrangeFox/fox_${{ inputs.MANIFEST_BRANCH }}/out/target/product/${{ env.DEVICE_NAME }}/recovery/root
python3 ldcheck -p system/lib64:vendor/lib64:system/lib:vendor/lib -d ${{ inputs.LDCHECKPATH }}
echo "Done checking missing dependencies. Review, and reconfigure your tree."
continue-on-error: true
Loading

0 comments on commit f442fba

Please sign in to comment.