From 688ab9210f4a30fea43ddccfe39b8f22b0687493 Mon Sep 17 00:00:00 2001 From: Hasibur Rahman Mohammed Date: Wed, 25 Feb 2026 14:02:09 +0530 Subject: [PATCH] Adds pre_build script to download & run SDK script This commit adds a pre_build script that will be responsible for downloading the sdk script from the AWS S3 bucket and run it. This process was done as a part of CI github actions workflow but is now added as a script so that builds can be performed standalone also. Signed-off-by: Hasibur Rahman Mohammed --- .github/workflows/pre_merge_build.yml | 2 +- ci/build.sh | 9 +++++++ ci/pre_build.sh | 38 +++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 ci/pre_build.sh diff --git a/.github/workflows/pre_merge_build.yml b/.github/workflows/pre_merge_build.yml index bbcb8a7d..2d6d1507 100644 --- a/.github/workflows/pre_merge_build.yml +++ b/.github/workflows/pre_merge_build.yml @@ -1,6 +1,6 @@ --- name: pre_merge_build -run-name: Pre Merge Build (PR:${{ github.event.pull_request.number }}) +run-name: ${{ github.event.pull_request.number && 'Pre Merge Build PR:' || 'Pre Merge Build:' }}${{ github.event.pull_request.number || github.run_number }} on: workflow_dispatch: diff --git a/ci/build.sh b/ci/build.sh index 105bbfa2..ad2b4f54 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -3,6 +3,15 @@ # # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. set -ex +PREBUILD_SCRIPT_PATH="${PREBUILD_SCRIPT:-$(dirname "${BASH_SOURCE[0]}")/pre_build.sh}" +source "$PREBUILD_SCRIPT_PATH" + +# load build args from file if environment variable is not set +if [ -z "${BUILD_ARGS}" ]; then + BUILD_OPTIONS_FILE="${GITHUB_WORKSPACE}/ci/build_options.txt" + BUILD_ARGS="$(sed -E 's/#.*$//' "$BUILD_OPTIONS_FILE" | sed '/^[[:space:]]*$/d' | tr '\n' ' ')" +fi + echo "Running build script..." # Build/Compile audioreach-graphservices source ${GITHUB_WORKSPACE}/install/environment-setup-armv8-2a-qcom-linux diff --git a/ci/pre_build.sh b/ci/pre_build.sh new file mode 100644 index 00000000..d801b69b --- /dev/null +++ b/ci/pre_build.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +set -ex +echo "Running pre-build script..." +# Download .sh from aws s3 bucket and install the sdk +if [ ! -d "${GITHUB_WORKSPACE}/install" ]; then + if [ -z "${SDK_NAME}" ]; then + echo "SDK_NAME environment variable is not set. Fetching from JSON." + curl -o target_image.json \ + https://raw.githubusercontent.com/AudioReach/audioreach-workflows/master/.github/actions/loading/target_image.json + SDK=$(jq -r 'to_entries[0].value.SDK_name' target_image.json) + export SDK_NAME="${SDK}" + echo "SDK_NAME set to ${SDK_NAME}" + fi + if aws s3 cp s3://qli-prd-audior-gh-artifacts/AudioReach/meta-audioreach/post_merge_build/${SDK_NAME} "${GITHUB_WORKSPACE}"; then + echo "SDK downloaded successfully." + chmod 777 "${GITHUB_WORKSPACE}/${SDK_NAME}" + else + echo "Failed to download SDK from S3. Exiting." + exit 1 + fi + # Setup directory for sdk installation + mkdir -p "${GITHUB_WORKSPACE}/install" + cd "${GITHUB_WORKSPACE}" + # Install the sdk + echo "Running SDK script..." + if echo "./install" | ./"${SDK_NAME}" ; then + echo "SDK Script ran successfully." + else + echo "Error running SDK script. Exiting." + exit 1 + fi + cd - +else + echo "SDK already installed. Skipping download and installation." +fi