Added: add publish artifacts in build workflow #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Test with SDK | |
on: [push, pull_request] | |
env: | |
PERSIST_DIR: /srv/gh-runners/quic-qrb-ros | |
DL_DIR: /srv/gh-runners/quic-qrb-ros/downloads | |
WORKSPACE: ${{ github.workspace }}/ros_ws | |
SDK_DIR: ${{ github.workspace }}/sdk | |
jobs: | |
build: | |
runs-on: [self-hosted, x86] | |
timeout-minutes: 720 | |
steps: | |
- name: Set up SDK | |
run: | | |
set -x | |
if [ -e ${PERSIST_DIR} ] && [ -r ${PERSIST_DIR} ] && [ -x ${PERSIST_DIR} ];then | |
echo "Setting up SDK..." | |
umask 022 | |
${PERSIST_DIR}/sdk/qcom-robotics-ros2-humble-x86_64-qcom-robotics-full-image-armv8-2a-qcs6490-rb3gen2-vision-kit-toolchain-1.0.sh <<EOF | |
${SDK_DIR} | |
Y | |
EOF | |
else | |
echo "Downloading SDK from CLO..." | |
wget -q https://artifacts.codelinaro.org/artifactory/qli-ci/flashable-binaries/qirpsdk/qcs6490-rb3gen2-vision-kit/x86/qcom-6.6.38-QLI.1.2-Ver.1.1_robotics-product-sdk-1.1.zip | |
if [ $? != 0 ];then | |
Download SDK failed!!!. Exit!. | |
exit 2 | |
fi | |
unzip qcom-6.6.38-QLI.1.2-Ver.1.1_robotics-product-sdk-1.1.zip | |
echo "Setting up SDK..." | |
umask 022 | |
./target/qcs6490-rb3gen2-vision-kit/sdk/qcom-robotics-ros2-humble-x86_64-qcom-robotics-full-image-armv8-2a-qcs6490-rb3gen2-vision-kit-toolchain-1.0.sh <<EOF | |
${SDK_DIR} | |
Y | |
EOF | |
fi | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
path: ${{ github.workspace }}/ros_ws/${{ github.event.repository.name }} | |
- name: Download dependencies | |
run: | | |
cd ${WORKSPACE} | |
git clone https://github.com/quic-qrb-ros/lib_mem_dmabuf.git | |
git clone https://github.com/quic-qrb-ros/qrb_ros_transport.git | |
cd qrb_ros_transport | |
git checkout 5d36172c87aaaaa95d9468549263af243c94b6da | |
- name: build | |
run: | | |
cd ${SDK_DIR} | |
umask 022 | |
. environment-setup-armv8-2a-qcom-linux | |
cd ${WORKSPACE} | |
export AMENT_PREFIX_PATH="${OECORE_TARGET_SYSROOT}/usr;${OECORE_NATIVE_SYSROOT}/usr" | |
export PYTHONPATH=${PYTHONPATH}:${OECORE_TARGET_SYSROOT}/usr/lib/python3.10/site-packages | |
colcon build --merge-install --cmake-args \ | |
-DPython3_ROOT_DIR=${OECORE_TARGET_SYSROOT}/usr \ | |
-DPython3_NumPy_INCLUDE_DIR=${OECORE_TARGET_SYSROOT}/usr/lib/python3.10/site-packages/numpy/core/include \ | |
-DPYTHON_SOABI=cpython-310-aarch64-linux-gnu -DCMAKE_STAGING_PREFIX=$(pwd)/install \ | |
-DCMAKE_PREFIX_PATH=$(pwd)/install/share \ | |
-DBUILD_TESTING=OFF | |
- name: Publish artifacts | |
run: | | |
build_dir=${PERSIST_DIR}/builds/${GITHUB_RUN_ID} | |
mkdir -p $build_dir | |
tar -cvf ${build_dir}/artifacts.tar ${WORKSPACE}/install ${WORKSPACE}/build ${WORKSPACE}/log | |
# Instruct our file server to make these files available for download | |
url="https://quic-qrt-ros-fileserver-1029608027416.us-central1.run.app/${GITHUB_RUN_ID}/" | |
retries=3 | |
for ((i=0; i<retries; i++)); do | |
curl -X POST -v ${url} && break | |
echo "something went wrong, sleep and retry" | |
sleep 2 | |
done | |
(( retries == i )) && { echo 'Failed to publish artifacts'; exit 1; } | |
echo Artifacts available at: ${url} |