Skip to content

Commit

Permalink
Changed: update test workflow
Browse files Browse the repository at this point in the history
Add shared download directory.
Set job timeout-minutes.
Add deploy SDK.

Signed-off-by: Jiaxing Shi <[email protected]>
  • Loading branch information
jiaxshi committed Oct 26, 2024
1 parent 8926835 commit 384b0ab
Showing 1 changed file with 62 additions and 3 deletions.
65 changes: 62 additions & 3 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Build test
run-name: Build test by ${{github.event_name}}

on:
pull_request:
Expand Down Expand Up @@ -38,16 +39,49 @@ on:
required: false
type: string
default: ''
deploy_sdk:
description: "Deploy generated SDK to persistent directory"
required: false
type: boolean
default: false

env:
PERSIST_DIR: /srv/gh-runners/quic-qrb-ros
DL_DIR: /srv/gh-runners/quic-qrb-ros/downloads
MACHINE: ${{inputs.machine || 'qcs6490-rb3gen2-vision-kit'}}
DISTRO: ${{inputs.distro || 'qcom-robotics-ros2-humble'}}
QCOM_SELECTED_BSP: ${{inputs.build_override || 'custom'}}
DEPLOY_SDK: ${{github.event.inputs.deploy_sdk || 'false'}}

jobs:
build-pr:
runs-on: [self-hosted, x86]
name: ${{inputs.machine}}.${{inputs.distro}}.${{inputs.build_override}}
timeout-minutes: 720
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
path: ${{github.event.repository.name}}

- name: Check and create work directories
run: |
if [ -e ${PERSIST_DIR} ] && [ -r ${PERSIST_DIR} ] && [ -w ${PERSIST_DIR} ];then
if [ ! -d ${DL_DIR} ];then
echo "Creating ${DL_DIR}!"
mkdir -p ${DL_DIR}
fi
if [ ! -d ${PERSIST_DIR}/sstate-cache-$DISTRO ];then
echo "Creating ${PERSIST_DIR}/sstate-cache-$DISTRO !"
mkdir -p ${PERSIST_DIR}/sstate-cache-$DISTRO
fi
echo "ls ${PERSIST_DIR}:"
ls ${PERSIST_DIR}/ -al
else
echo "DEPLOY_SDK=false" >> $GITHUB_ENV
echo ""persist_dir" is not available. Set DEPLOY_SDK=false."
fi
- name: Sync source tree
run: |
Expand All @@ -57,11 +91,36 @@ jobs:
- name: Custom build
if: ${{github.event.inputs.custom_build_cmd != ''}}
run: |
MACHINE=${{inputs.machine}} DISTRO=${{inputs.distro}} QCOM_SELECTED_BSP=${{inputs.build_override}} source setup-robotics-environment
if [ -e ${DL_DIR} ] && [ -r ${DL_DIR} ] && [ -w ${DL_DIR} ];then
ln -s ${DL_DIR} ./downloads
fi
source setup-robotics-environment
${{github.event.inputs.custom_build_cmd}}
- name: Full compilation
if: ${{github.event.inputs.custom_build_cmd == ''}}
run: |
MACHINE=${{inputs.machine}} DISTRO=${{inputs.distro}} QCOM_SELECTED_BSP=${{inputs.build_override}} source setup-robotics-environment
if [ -e ${DL_DIR} ] && [ -r ${DL_DIR} ] && [ -w ${DL_DIR} ];then
ln -s ${DL_DIR} ./downloads
fi
source setup-robotics-environment
../qirp-build qcom-robotics-full-image
- name: Deploy SDK
if: env.DEPLOY_SDK
run: |
if [ ! -d ${PERSIST_DIR}/qirp-sdk-$DISTRO ];then
echo "Creating ${PERSIST_DIR}/qirp-sdk-$DISTRO"
mkdir -p ${PERSIST_DIR}/qirp-sdk-$DISTRO"
mkdir -p ${PERSIST_DIR}/qirp-sdk-$DISTRO/.backup"
fi
mv ${PERSIST_DIR}/qirp-sdk-$DISTRO/* ${PERSIST_DIR}/qirp-sdk-$DISTRO/.backup/
cp ${{ github.workspace }}/build-$DISTRO/tmp-glibc/deploy/qirpsdk_artifacts/* ${PERSIST_DIR}/qirp-sdk-$DISTRO/
if [ $? == 0 ];then
rm ${PERSIST_DIR}/qirp-sdk-$DISTRO/.backup/* -fr
else
mv ${PERSIST_DIR}/qirp-sdk-$DISTRO/.backup/* ${PERSIST_DIR}/qirp-sdk-$DISTRO/
fi

0 comments on commit 384b0ab

Please sign in to comment.