From dc8a2f25d9be944f305552de11dd3705956cdfb5 Mon Sep 17 00:00:00 2001 From: = mlm-games <= gerrit.r6a6a@passinbox.com> Date: Tue, 3 Sep 2024 07:37:04 +0530 Subject: [PATCH] try --- action.yml | 129 +++++--------------------------------------------- entrypoint.sh | 65 +++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 117 deletions(-) create mode 100755 entrypoint.sh diff --git a/action.yml b/action.yml index 3661fe1..4a9c79c 100644 --- a/action.yml +++ b/action.yml @@ -15,20 +15,24 @@ inputs: description: 'Custom Recovery Tree' required: true default: 'https://github.com//' + type: string DEVICE_TREE_BRANCH: description: 'Custom Recovery Tree Branch (use master if default)' required: true default: 'your_branch_name' + type: string DEVICE_NAME: - description: 'Specify your Device Codename' # As is, just like your PRODUCT_DEVICE in your device tree. + description: 'Specify your Device Codename' required: true default: '7304X' + type: string DEVICE_PATH: - description: 'Specify your Device Path (Check the DEVICE_PATH in BoardConfig.mk)' # As is, just like your DEVICE_PATH in your BoardConfig.mk + description: 'Specify your Device Path (Check the DEVICE_PATH in BoardConfig.mk)' required: true default: 'device/device`s_company/Codename' + type: string BUILD_TARGET: - description: 'Specify your Build Target' # The image suffix will be added later in build step. + description: 'Specify your Build Target' required: true default: 'recovery' type: choice @@ -42,124 +46,15 @@ inputs: default: 'false' type: boolean LDCHECKPATH: - description: 'Path of blobs to check' # Use it know what kind of dependencies your missing for decryption blobs. + description: 'Path of blobs to check' required: true default: 'system/bin/qseecomd' - + type: string runs: - using: "composite" - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Clean-up - uses: rokibhasansagar/slimhub_actions@main - - - name: Swap Space - uses: pierotofy/set-swap-space@master - with: - swap-size-gb: 12 - - - name: Build Environment - run: | - sudo apt install aria2 -y - git clone https://gitlab.com/OrangeFox/misc/scripts.git - cd scripts - sudo bash setup/android_build_env.sh - - - name: Setup ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - max-size: "10G" - - - name: Set-up Manifest - run: | - MANIFEST_DIR="${{ github.workspace }}/OrangeFox" - ORANGEFOX_ROOT="${MANIFEST_DIR}/fox_${{ inputs.MANIFEST_BRANCH }}" - OUTPUT_DIR="${ORANGEFOX_ROOT}/out/target/product/${{ inputs.DEVICE_NAME }}" - echo "ORANGEFOX_ROOT=${ORANGEFOX_ROOT}" >> $GITHUB_ENV - echo "OUTPUT_DIR=${OUTPUT_DIR}" >> $GITHUB_ENV - mkdir -p "${MANIFEST_DIR}" - cd "${MANIFEST_DIR}" - git config --global user.name "${{ github.actor }}" - git config --global user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" - git clone https://gitlab.com/OrangeFox/sync.git -b master - cd sync - ./orangefox_sync.sh --branch ${{ inputs.MANIFEST_BRANCH }} --path "${ORANGEFOX_ROOT}" - - - name: Clone Device Tree - run: | - cd ${{ env.ORANGEFOX_ROOT }} - git clone ${{ inputs.DEVICE_TREE }} -b ${{ inputs.DEVICE_TREE_BRANCH }} ./${{ inputs.DEVICE_PATH }} - cd ${{ inputs.DEVICE_PATH }} - echo "COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV - - - name: Building OrangeFox - run: | - pushd ${{ env.ORANGEFOX_ROOT }} - set +e - export USE_CCACHE=1 - export CCACHE_EXEC=/usr/bin/ccache - sed -i 's/return sandboxConfig\.working/return false/g' build/soong/ui/build/sandbox_linux.go - source build/envsetup.sh - export ALLOW_MISSING_DEPENDENCIES=true - set -e - lunch twrp_${{ inputs.DEVICE_NAME }}-eng && make clean && mka adbd ${{ inputs.BUILD_TARGET }}image - popd - - - name: Set Build Date # Build date in UTC - run: | - echo "BUILD_DATE=$(TZ=UTC date +%Y%m%d)" >> $GITHUB_ENV - - - name: Check if the recovery exists # It makes the recovery.img and renames it to Orangefox*.img but the OG should also work - if: always() - run: | - img_file=$(find "${{ env.OUTPUT_DIR }}" -name "${{ inputs.BUILD_TARGET }}*.img" -print -quit) - zip_file=$(find "${{ env.OUTPUT_DIR }}" -name "OrangeFox*.zip" -print -quit) - if [ -f "$img_file" ]; then - echo "CHECK_IMG_IS_OK=true" >> $GITHUB_ENV - echo "MD5_IMG=$(md5sum "$img_file" | cut -d ' ' -f 1)" >> $GITHUB_ENV - else - echo "Recovery out directory is empty." - fi - if [ -f "$zip_file" ]; then - echo "CHECK_ZIP_IS_OK=true" >> $GITHUB_ENV - echo "MD5_ZIP=$(md5sum "$zip_file" | cut -d ' ' -f 1)" >> $GITHUB_ENV - else - echo "::warning::The zip file isn't present but make sure the image is from only after 100% completion in build stage" - fi - - - name: Upload to Release - if: env.CHECK_IMG_IS_OK == 'true' - uses: softprops/action-gh-release@master - with: - files: | - ${{ env.OUTPUT_DIR }}/OrangeFox*.img - ${{ env.OUTPUT_DIR }}/OrangeFox*.tar - ${{ env.OUTPUT_DIR }}/OrangeFox*.zip - ${{ env.OUTPUT_DIR }}/ramdisk-recovery.* - name: Unofficial OrangeFox for ${{ inputs.DEVICE_NAME }} // ${{ env.BUILD_DATE }} - tag_name: ${{ github.run_id }} - body: | - 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 }} - prerelease: true - - - name: Run LDCheck - if: inputs.LDCHECK == 'true' - run: | - cd tools - mv -n libneeds ${GITHUB_WORKSPACE}/${{ env.OUTPUT_DIR }}/${{ inputs.DEVICE_NAME }}/recovery/root/ - mv -n ldcheck ${GITHUB_WORKSPACE}/${{ env.OUTPUT_DIR }}/${{ inputs.DEVICE_NAME }}/recovery/root/ - cd ${GITHUB_WORKSPACE}/${{ env.OUTPUT_DIR }}/${{ inputs.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 + using: 'docker' + image: 'Dockerfile' branding: icon: "terminal" - color: "gray-dark" + color: "gray-dark" \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..471f767 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,65 @@ +#!/bin/bash +set -e + +# Install necessary packages +sudo apt-get update +sudo apt-get install -y aria2 git + +# Clone OrangeFox scripts +git clone https://gitlab.com/OrangeFox/misc/scripts.git +cd scripts +sudo bash setup/android_build_env.sh + +# Set up the build environment +MANIFEST_DIR="${GITHUB_WORKSPACE}/OrangeFox" +ORANGEFOX_ROOT="${MANIFEST_DIR}/fox_${INPUT_MANIFEST_BRANCH}" +OUTPUT_DIR="${ORANGEFOX_ROOT}/out/target/product/${INPUT_DEVICE_NAME}" + +mkdir -p "${MANIFEST_DIR}" +cd "${MANIFEST_DIR}" + +# Configure git +git config --global user.name "${GITHUB_ACTOR}" +git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com" + +# Clone OrangeFox sync repository +git clone https://gitlab.com/OrangeFox/sync.git -b master +cd sync +./orangefox_sync.sh --branch "${INPUT_MANIFEST_BRANCH}" --path "${ORANGEFOX_ROOT}" + +# Clone device tree +cd "${ORANGEFOX_ROOT}" +git clone "${INPUT_DEVICE_TREE}" -b "${INPUT_DEVICE_TREE_BRANCH}" "./${INPUT_DEVICE_PATH}" + +# Build OrangeFox +cd "${ORANGEFOX_ROOT}" +export USE_CCACHE=1 +export CCACHE_EXEC=/usr/bin/ccache +sed -i 's/return sandboxConfig\.working/return false/g' build/soong/ui/build/sandbox_linux.go +source build/envsetup.sh +export ALLOW_MISSING_DEPENDENCIES=true +lunch "twrp_${INPUT_DEVICE_NAME}-eng" && make clean && mka adbd "${INPUT_BUILD_TARGET}image" + +# Check if the recovery image exists +img_file=$(find "${OUTPUT_DIR}" -name "${INPUT_BUILD_TARGET}*.img" -print -quit) +zip_file=$(find "${OUTPUT_DIR}" -name "OrangeFox*.zip" -print -quit) + +if [ -f "$img_file" ]; then + echo "CHECK_IMG_IS_OK=true" >> $GITHUB_ENV + echo "MD5_IMG=$(md5sum "$img_file" | cut -d ' ' -f 1)" >> $GITHUB_ENV +else + echo "Recovery out directory is empty." +fi + +if [ -f "$zip_file" ]; then + echo "CHECK_ZIP_IS_OK=true" >> $GITHUB_ENV + echo "MD5_ZIP=$(md5sum "$zip_file" | cut -d ' ' -f 1)" >> $GITHUB_ENV +else + echo "::warning::The zip file isn't present but make sure the image is from only after 100% completion in build stage" +fi + +# Run LDCheck if enabled +if [ "${INPUT_LDCHECK}" = "true" ]; then + + echo "Done checking missing dependencies. Review, and reconfigure your tree." +fi \ No newline at end of file