Skip to content

Commit

Permalink
modified isntallation scripts, docker file and test for pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
Ishaan-Datta committed Sep 1, 2024
1 parent 99585a3 commit 8e93b8d
Show file tree
Hide file tree
Showing 32 changed files with 2,446 additions and 392 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,26 @@ jobs:
echo "version=$NEXT_VERSION" >> $GITHUB_OUTPUT
fi
# - name: Build and push multi-platform Docker image
# uses: docker/build-push-action@v6
# with:
# # context: .
# push: true
# tags: ["agrobotappliedai/jetson_ros:${{ github.ref_name }}-latest", "agrobotappliedai/jetson_ros:${{ github.ref_name }}-v${{ steps.get_next_version.outputs.version }}"]
# platforms: linux/amd64,linux/arm64
# file: ./Container/Jetson.Dockerfile
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- run: echo ${{ steps.get_next_version.outputs.version }}
- name: Show directory contents
run: |
echo "Current directory: $(pwd)"
echo "Directory contents:"
ls -la
- name: List files in the repository
run: |
echo "github workspace folder"
ls ${{ github.workspace }}
- name: Build and push multi-platform Docker image
uses: docker/build-push-action@v6
with:
push: true
tags: ["agrobotappliedai/jetson_ros:${{ github.ref_name }}-latest", "agrobotappliedai/jetson_ros:${{ github.ref_name }}-v${{ steps.get_next_version.outputs.version }}"]
platforms: linux/amd64,linux/arm64
file: ./Container/Jetson.Dockerfile
network: host
build-args: BRANCH_NAME="${{ github.ref_name }}"
60 changes: 29 additions & 31 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ on:

workflow_dispatch:
inputs:
branch:
description: 'Which branch you would like to run the pipeline on?'
required: false
type: string
default: 'main'
delivery:
description: 'Would you like to update the official image?'
required: false
Expand All @@ -32,17 +27,16 @@ jobs:
id: integration
steps:
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- run: echo "BRANCH=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
- run: echo "The name of your branch is ${{ github.head_ref }} and your repository is ${{ github.repository }}."

- name: Checkout branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
ref: ${{ github.head_ref }}

- name: Print branch
run: |
echo "Checked out branch: ${{ github.event.inputs.branch || github.ref }}"
echo "Checked out branch: ${{ github.head_ref }}"
- name: Show directory contents
run: |
Expand Down Expand Up @@ -82,8 +76,6 @@ jobs:
# - name: C++ lint
# uses: cpp-linter/cpp-linter-action@v2
# id: cpp_linter
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# style: "file"
# tidy-checks: ""
Expand All @@ -100,10 +92,6 @@ jobs:
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

# - name: Fail fast?!
# if: steps.linter.outputs.checks-failed > 0
# run: exit 1

# - name: Check for linting errors
# id: lint-check
Expand Down Expand Up @@ -132,24 +120,34 @@ jobs:
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
git add .
git commit -m "Fix linting issues"
git push origin HEAD:${{ github.head_ref }}
if [[ $(git status --porcelain) ]]; then
git add .
git commit -m "Auto-fix lint issues"
git push origin HEAD:${{ github.head_ref }}
else
echo "No lint fixes applied, nothing to commit."
fi
- run: echo ${{ github.event.inputs.delivery }}
- run: echo ${{ inputs.delivery }}
- run: echo ${{ github.event.inputs.deployment }}
- run: echo ${{ inputs.deployment }}

# These are only triggered through workflow dispatch
delivery:
if: ${{ github.event.inputs.delivery == 'true' }}
needs: integration
uses: ./.github/workflows/delivery.yml
with:
branch: {{ github.events.inputs.branch }}
deployment: {{ github.events.inputs.deployment }}
if: ${{ github.event.inputs.delivery }}
run: echo "this was detected successfully as a boolean (delivery)"
# uses: ./.github/workflows/delivery.yml
# with:
# branch: {{ github.head_ref }}
# deployment: {{ github.events.inputs.deployment }}

deployment:
if: ${{ github.event.inputs.deployment == 'true' }}
needs: delivery
uses: ./.github/workflows/deployment.yml
with:
container_branch: {{ github.events.inputs.branch }}
container_version: {{ needs.delivery.outputs.version }}
if: ${{ inputs.deployment }}
run: echo "this was detected successfully as boolean (deployment)"
# needs: delivery
# uses: ./.github/workflows/deployment.yml
# with:
# container_branch: {{ github.head_ref }}
# container_version: {{ needs.delivery.outputs.version }}
4 changes: 4 additions & 0 deletions Container/Jetson.DockerFile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ ENV DEBIAN_FRONTEND=noninteractive \
OPENCV_VERSION=4.8.1 \
OPENCV_DEB=OpenCV-4.8.1-aarch64.tar.gz

ARG BRANCH_NAME=main

COPY ./scripts /scripts

RUN /scripts/install-build-essential.sh
Expand All @@ -33,4 +35,6 @@ RUN pip3 install -U --no-cache-dir --verbose jetson-stats numpy onnx && \
pip3 show numpy && python3 -c 'import numpy; print(numpy.__version__)' && \
pip3 show onnx && python3 -c 'import onnx; print(onnx.__version__)'

RUN /scripts/install-ros2-packages.sh

ENTRYPOINT ["/bin/bash"]
7 changes: 0 additions & 7 deletions Container/scripts/install-build-essential.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ set -ex
echo 'installing build-essential'

apt -y update && apt -y upgrade
# apt-get install -y --no-install-recommends
# locales \
# locales-all \
# tzdata \
# locale-gen en_US $LANG
# update-locale LC_ALL=$LC_ALL LANG=$LANG
# locale
apt-get install -y --no-install-recommends \
build-essential \
software-properties-common \
Expand Down
19 changes: 9 additions & 10 deletions Container/scripts/install-opencv-cuda.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
#!/bin/bash

#!/usr/bin/env bash
set -ex

version="4.10.0"
folder="workspace"

python3 -c "import cv2; print('OpenCV version:', str(cv2.__version__)); print(cv2.getBuildInformation())"
echo "** Remove other OpenCV first"
sudo apt -y purge *libopencv*
apt -y purge *libopencv*

echo "------------------------------------"
echo "** Install requirement (1/4)"
echo "------------------------------------"
sudo apt-get update
sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt-get install -y libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev
sudo apt-get install -y libv4l-dev v4l-utils qv4l2
sudo apt-get install -y curl
apt-get update
apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
apt-get install -y libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev
apt-get install -y libv4l-dev v4l-utils qv4l2
apt-get install -y curl
# sudo apt-get install python3-libnvinfer-dev?

echo "------------------------------------"
Expand Down Expand Up @@ -45,7 +44,7 @@ make -j$(nproc)
echo "------------------------------------"
echo "** Install opencv "${version}" (4/4)"
echo "------------------------------------"
sudo make install
make install
echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
echo 'export PYTHONPATH=/usr/local/lib/python3.8/site-packages/:$PYTHONPATH' >> ~/.bashrc
source ~/.bashrc
Expand Down
25 changes: 25 additions & 0 deletions Container/scripts/install-ros2-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -ex

'compiling ros2 package'

git clone --branch ${BRANCH_NAME} --single-branch --no-checkout https://github.com/UBCAgroBot/ROS.git
cd ROS

git sparse-checkout init

echo "/*" > .git/info/sparse-checkout
echo "!/.github/" >> .git/info/sparse-checkout
echo "!/Container/" >> .git/info/sparse-checkout
echo "!/Experiments/" >> .git/info/sparse-checkout
echo "!/Misc Scripts/" >> .git/info/sparse-checkout

git checkout ${BRANCH_NAME}

cd Workspace
rosdep init
rosdep update
rosdep install --from-paths src -y --ignore-src
colcon build --packages-select custom_interface
colcon build --packages-select node_test
source /opt/ros/humble/setup.bash
7 changes: 3 additions & 4 deletions Container/scripts/install-ros2.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env bash
set -ex

echo 'installing ros2'

locale-gen en_US en_US.UTF-8 && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8

apt-get update
Expand All @@ -9,10 +12,6 @@ apt-get install -y --no-install-recommends \
ca-certificates \
locales \
software-properties-common \
# libpython3-dev \
# python3-colcon-common-extensions \
# python3-numpy \
# python3-rosdep \

add-apt-repository universe
curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
Expand Down
15 changes: 10 additions & 5 deletions Container/scripts/install-script.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env bash

set -ex

apt update && apt upgrade -y

echo 'installing opencv-python-cuda'

python3 -m pip install --upgrade pip
URL="https://github.com/cudawarped/opencv-python-cuda-wheels/releases/download/4.9.80_13%2F05%2F24/opencv_contrib_python_rolling-4.9.0.80-cp37-abi3-linux_x86_64.whl"
# URL="https://github.com/cudawarped/opencv-python-cuda-wheels/releases/download/4.8.0.20230804/opencv_contrib_python_rolling-4.8.0.20230804-cp36-abi3-linux_x86_64.whl"
Expand All @@ -11,6 +13,8 @@ wget -O $FILENAME $URL
pip3 install --no-cache-dir --verbose numpy $FILENAME
# python3 -c "import cv2; print(cv2.__version__); print(cv2.getBuildInformation())"

echo 'installing ROS2'

apt install -y --no-install-recommends software-properties-common
add-apt-repository universe
apt update && apt install curl -y
Expand All @@ -22,6 +26,8 @@ echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
source /opt/ros/humble/setup.bash
printenv | grep -i ROS

echo 'installing ZED SDK'

apt-get update -y || true ; apt-get install --no-install-recommends lsb-release wget less zstd udev apt-transport-https -y
wget --no-check-certificate -O ZED_SDK_Linux.run https://download.stereolabs.com/zedsdk/4.1/cu121/ubuntu22
chmod +x ZED_SDK_Linux.run ; ./ZED_SDK_Linux.run silent skip_drivers
Expand All @@ -30,13 +36,12 @@ rm -rf ZED_SDK_Linux.run
rm -rf /var/lib/apt/lists/*
apt-get clean

echo 'installing pyzed'

apt-get update -y || true ; apt-get install --no-install-recommends python3 python3-pip python3-dev python3-setuptools build-essential -y
wget download.stereolabs.com/zedsdk/pyzed -O /usr/local/zed/get_python_api.py
python3 /usr/local/zed/get_python_api.py
python3 -m pip install cython wheel
python3 -m pip install numpy pyopengl *.whl
rm *.whl ; rm -rf /var/lib/apt/lists/*
apt-get clean

# echo 'Applying aliases'
# aliases....
apt-get clean
2 changes: 2 additions & 0 deletions Container/scripts/install-zed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ rm -rf ZED_SDK_Linux.run
rm -rf /var/lib/apt/lists/*
apt-get clean

echo 'installing pyzed'

apt-get update -y || true ; apt-get install --no-install-recommends python3 python3-pip python3-dev python3-setuptools build-essential -y
wget download.stereolabs.com/zedsdk/pyzed -O /usr/local/zed/get_python_api.py
python3 /usr/local/zed/get_python_api.py
Expand Down
Loading

0 comments on commit 8e93b8d

Please sign in to comment.