Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions .github/workflows/auto_pr_creation_rpi_manifests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Update Manifests on Meta Repo Merge

on:
workflow_call:
secrets:
RDKCM_RDKE:
required: true

jobs:
auto_pr_creation_manifest:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Checkout build_tools_workflows code
uses: actions/checkout@v4
with:
repository: rdkcentral/build_tools_workflows
path: 'tools'
ref: develop
token: ${{ secrets.RDKCM_RDKE }}

- name: Checkout vendor layer Manifest Repository
uses: actions/checkout@v4
with:
repository: 'rdkcentral/vendor-manifest-raspberrypi'
path: 'vendor_manifest_repo'
token: ${{ secrets.RDKCM_RDKE }}

- name: Update Git Config
env:
BOT_EMAIL: ${{ vars.RDKM_BOT_EMAIL }}
run: |
cd vendor_manifest_repo
git config user.name "bot"
git config user.email "$BOT_EMAIL"
cd ..

- name: Checkout middleware layer Manifest Repository
uses: actions/checkout@v4
with:
repository: 'rdkcentral/middleware-manifest-rdke'
path: 'middleware_manifest_repo'
token: ${{ secrets.RDKCM_RDKE }}

- name: Update Git Config
env:
BOT_EMAIL: ${{ vars.RDKM_BOT_EMAIL }}
run: |
cd middleware_manifest_repo
git config user.name "bot"
git config user.email "$BOT_EMAIL"
cd ..

- name: Checkout image assembler layer Manifest Repository
uses: actions/checkout@v4
with:
repository: 'rdkcentral/image-assembler-manifest-rdke'
path: 'image_assembler_manifest_repo'
token: ${{ secrets.RDKCM_RDKE }}

- name: Update Git Config
env:
BOT_EMAIL: ${{ vars.RDKM_BOT_EMAIL }}
run: |
cd image_assembler_manifest_repo
git config user.name "bot"
git config user.email "$BOT_EMAIL"
cd ..

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install Python dependencies
run: |
python3 -m pip install --upgrade pip
pip install requests PyGithub GitPython

- name: Run the update script for vendor layer
env:
GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }}
GITHUB_ORG: 'rdkcentral'
MANIFEST_REPO_PATH: ${{ github.workspace }}/vendor_manifest_repo
MANIFEST_REPO_NAME: 'rdkcentral/vendor-manifest-raspberrypi'
PR_NUMBER: ${{ github.event.pull_request.number }}
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
run: |
cd vendor_manifest_repo
python3 ../tools/build_health_check_workflow_scripts/auto_pr_generation_manifest.py
cd ..

- name: Run the update script for middleware layer
env:
GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }}
GITHUB_ORG: 'rdkcentral'
MANIFEST_REPO_PATH: ${{ github.workspace }}/middleware_manifest_repo
MANIFEST_REPO_NAME: 'rdkcentral/middleware-manifest-rdke'
PR_NUMBER: ${{ github.event.pull_request.number }}
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
run: |
cd middleware_manifest_repo
python3 ../tools/build_health_check_workflow_scripts/auto_pr_generation_manifest.py
cd ..

- name: Run the update script for image assembler layer
env:
GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }}
GITHUB_ORG: 'rdkcentral'
MANIFEST_REPO_PATH: ${{ github.workspace }}/image_assembler_manifest_repo
MANIFEST_REPO_NAME: 'rdkcentral/image-assembler-manifest-rdke'
PR_NUMBER: ${{ github.event.pull_request.number }}
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
run: |
cd image_assembler_manifest_repo
python3 ../tools/build_health_check_workflow_scripts/auto_pr_generation_manifest.py
cd ..
38 changes: 20 additions & 18 deletions .github/workflows/fossid_integration_stateless_diffscan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,37 @@ on:
required: true

jobs:
run-fossid-cicd:
run-diffscan:
name: Fossid Annotate PR
runs-on: ubuntu-latest
container:
image: quay.io/fossid/fossid-toolbox:latest
image: quay.io/fossid/fossid-toolbox:1.5.29
credentials:
username: ${{ secrets.FOSSID_CONTAINER_USERNAME }}
username: ${{ secrets.FOSSID_CONTAINER_USERNAME }}
password: ${{ secrets.FOSSID_CONTAINER_PASSWORD }}
steps:
- name: Checkout code
- name: Checkout Code
uses: actions/checkout@v4

- name: Checkout ignore projects file
uses: actions/checkout@v4
with:
repository: rdkcentral/build_tools_workflows
sparse-checkout: |
ignore_projects_fossid
ref: develop
path: tools
token: ${{ secrets.RDKCM_RDKE }}
- name: Run fossid-cicd
repository: rdkcentral/build_tools_workflows
sparse-checkout: |
ignore_projects_fossid
ref: develop
path: tools

- name: Run fossid-toolbox
env:
FOSSID_HOST_USERNAME: ${{ secrets.FOSSID_HOST_USERNAME }}
FOSSID_HOST_TOKEN: ${{ secrets.FOSSID_HOST_TOKEN }}
run: |
fossid-cicd \
diff-scan \
--fossid-host $FOSSID_HOST_USERNAME \
--fossid-token $FOSSID_HOST_TOKEN \
--github-workflow-errors \
--fail \
--ignore-projects tools/ignore_projects_fossid
fossid \
diffscan \
--fossid-host $FOSSID_HOST_USERNAME \
--fossid-token $FOSSID_HOST_TOKEN \
--format github \
--fail \
--ignore-projects tools/ignore_projects_fossid

Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,17 @@ def create_or_checkout_branch(repo, branch_name, base_branch):
print("Error checking out branch: {}".format(str(e)))
sys.exit(1)

# Delete the unused branch in the remote manifest repository
def delete_branch(repo, branch_name):
print("Delete unused branch: {}".format(branch_name))
print(':{}'.format(branch_name))
try:
remote = repo.remote(name='origin')
remote.push(refspec=(':{}'.format(branch_name)))
except GitCommandError as e:
print("Error delete branch: {}".format(str(e)))
sys.exit(1)

def main():
github_token = os.getenv('GITHUB_TOKEN')
manifest_repo_path = os.getenv('MANIFEST_REPO_PATH')
Expand Down Expand Up @@ -290,8 +301,12 @@ def main():

changes_made = update_xml_files(manifest_repo_path, updates)
if changes_made:
commit_and_push(manifest_repo_path, "Update manifest for {}".format(','.join(updates.keys())))
create_pull_request(github_token, manifest_repo_name, feature_branch, base_branch, manifest_pr_title, manifest_pr_description)
commit_and_push(manifest_repo_path, "Update manifest for {}".format(','.join(updates.keys())))
create_pull_request(github_token, manifest_repo_name, feature_branch, base_branch, manifest_pr_title, manifest_pr_description)
else:
# delete the unused feature branch
delete_branch(repo, feature_branch)


if __name__ == '__main__':
main()
100 changes: 95 additions & 5 deletions cov_docker_script/build_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,51 @@ parse_configure_options_file() {
cppflags="${cppflags//\$HOME/$HOME}"
cflags="${cflags//\$HOME/$HOME}"
ldflags="${ldflags//\$HOME/$HOME}"

# Build final options array
[[ -n "$cppflags" ]] && options_array+=("CPPFLAGS=${cppflags% }")
[[ -n "$cflags" ]] && options_array+=("CFLAGS=${cflags% }")
[[ -n "$ldflags" ]] && options_array+=("LDFLAGS=${ldflags% }")
}

# Build with custom commands
build_component_commands() {
cd "$COMPONENT_DIR"

local cmd_count
cmd_count=$(jq -r '.native_component.build.commands // [] | length' "$CONFIG_FILE")

if [[ "$cmd_count" -eq 0 ]]; then
err "No build commands configured for 'commands' build type"
return 1
fi

step "Running build commands ($cmd_count commands)"

local i=0
while [[ $i -lt $cmd_count ]]; do
local command
command=$(jq -r ".native_component.build.commands[$i]" "$CONFIG_FILE")

# Expand environment variables in command
command=$(expand_path "$command")

log " [$((i+1))/$cmd_count] Executing: $command"
if eval "$command"; then
ok "Success: Command $((i+1))"
else
err "Failed: Command $((i+1)): $command"
return 1
fi

i=$((i + 1))
done

ok "All build commands completed successfully"
echo ""
return 0
}

# Build with autotools
build_component_autotools() {
cd "$COMPONENT_DIR"
Expand Down Expand Up @@ -240,6 +278,16 @@ build_component_autotools() {
fi
ok "autogen.sh completed"
echo ""
elif [[ ! -f "./configure" ]] && [[ -f "./configure.ac" ]]; then
# No autogen.sh and no configure, but configure.ac exists
# Run autoreconf to generate configure script
step "Running autoreconf to generate configure script"
if ! autoreconf -fi; then
err "autoreconf failed"
return 1
fi
ok "autoreconf completed"
echo ""
fi

# Configure
Expand Down Expand Up @@ -335,21 +383,56 @@ run_pre_build_commands() {
# Build with CMake
build_component_cmake() {
cd "$COMPONENT_DIR"

local build_dir cmake_flags make_targets parallel_make
build_dir=$(jq -r '.native_component.build.build_dir // "build"' "$CONFIG_FILE")
cmake_flags=$(jq -r '.native_component.build.cmake_flags // empty' "$CONFIG_FILE")
cmake_flags=$(expand_path "$cmake_flags")
make_targets=$(jq -r '.native_component.build.make_targets[]? // "all"' "$CONFIG_FILE" | tr '\n' ' ')
parallel_make=$(jq -r '.native_component.build.parallel_make // true' "$CONFIG_FILE")

build_cmake "$COMPONENT_DIR" "$build_dir" "$cmake_flags" "$make_targets" "$parallel_make" || return 1


# Parse configure options file if exists
local config_file_path cppflags cflags ldflags
config_file_path=$(jq -r '.native_component.build.configure_options_file // empty' "$CONFIG_FILE")
if [[ -n "$config_file_path" ]]; then
config_file_path=$(expand_path "$config_file_path")
if [[ ! "$config_file_path" = /* ]]; then
config_file_path="$COMPONENT_DIR/$config_file_path"
fi

step "Reading configure options from: $config_file_path"
local parsed_array=()
if parse_configure_options_file "$config_file_path" parsed_array; then
for opt in "${parsed_array[@]}"; do
case $opt in
CPPFLAGS=*) cppflags="${opt#CPPFLAGS=}" ;;
CFLAGS=*) cflags="${opt#CFLAGS=}" ;;
LDFLAGS=*) ldflags="${opt#LDFLAGS=}" ;;
esac
done
else
err "Failed to parse configure options file (for cmake)"
return 1
fi
fi

# Compose cmake flags
local combined_cmake_flags="$cmake_flags"
[[ -n "$cppflags" ]] && combined_cmake_flags+=" -DCMAKE_C_FLAGS=\"$cppflags $cflags\" -DCMAKE_CXX_FLAGS=\"$cppflags $cflags\""
[[ -n "$ldflags" ]] && combined_cmake_flags+=" -DCMAKE_EXE_LINKER_FLAGS=\"$ldflags\""

build_cmake "$COMPONENT_DIR" "$build_dir" "$combined_cmake_flags" "$make_targets" "$parallel_make" || return 1
return 0
}

# Install libraries
install_libraries() {
# Skip library installation if LIB_PATH is not set or empty
if [[ -z "$LIB_PATH" || "$LIB_PATH" == "null" ]]; then
log "No library output path configured, skipping library installation"
return 0
fi

step "Installing libraries to $LIB_PATH"
mkdir -p "$LIB_PATH"

Expand Down Expand Up @@ -397,6 +480,13 @@ main() {
exit 1
fi
;;

commands)
if ! build_component_commands; then
err "Build commands failed"
exit 1
fi
;;

*)
err "Unsupported build type: $BUILD_TYPE"
Expand Down
10 changes: 10 additions & 0 deletions cov_docker_script/common_build_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ check_dependencies() {
return 0
}

# Get latest commit id
get_latest_sha() {
local repo_path="$1"

git -C "$repo_path" rev-parse -is-inside-work-tree >/dev/null 2>&1 \
|| { echo "Invalid git repo"; return 1; }

git -C "$repo_path" rev-parse --short HEAD
}

# Clone a git repository
clone_repo() {
local name="$1" repo="$2" branch="$3" dest="$4"
Expand Down
Loading
Loading