Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Jul 28, 2023
1 parent a152436 commit 757ae52
Show file tree
Hide file tree
Showing 5 changed files with 298 additions and 0 deletions.
94 changes: 94 additions & 0 deletions .ci/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/bin/bash

set -e

trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
trap 'echo "$0: \"${last_command}\" command failed with exit code $?"' ERR

VARIANT=$1
WORKSPACE=/tmp/workspace
ARCH=$(uname -m)
YAML_FILE=packages.yaml
ARTIFACTS_FOLDER=/tmp/artifacts

./.ci_scripts/package_build/install_ros.sh

if [[ "$VARIANT" == "stable" ]]; then
./.ci_scripts/package_build/add_ctu_mrs_stable_ppa.sh
else
./.ci_scripts/package_build/add_ctu_mrs_unstable_ppa.sh
fi

# dependencies need for build the deb package
sudo apt-get -y install ros-noetic-catkin python3-catkin-tools
sudo apt-get -y install fakeroot dpkg-dev debhelper
sudo pip3 install -U bloom

REPOS=$(./.ci/parse_yaml.py $YAML_FILE $VARIANT $ARCH)

[ -d $WORKSPACE ] && rm -rf $WORKSPACE
[ -d $ARTIFACTS_FOLDER ] && rm -rf $ARTIFACTS_FOLDER

mkdir -p $WORKSPACE
mkdir -p $ARTIFACTS_FOLDER

cd $WORKSPACE
mkdir src
catkin init

cd src

# clone and checkout
echo "$REPOS" | while IFS= read -r REPO; do

PACKAGE=$(echo "$REPO" | awk '{print $1}')
URL=$(echo "$REPO" | awk '{print $2}')
BRANCH=$(echo "$REPO" | awk '{print $3}')

git clone $URL $PACKAGE
cd $PACKAGE
git checkout $BRANCH
git submodule update --init --recursive

cd $WORKSPACE/src

done

BUILD_ORDER=$(catkin list -u)

echo ""
echo "$0: catking reported following topological build order:"
echo "$BUILD_ORDER"
echo ""

touch $ARTIFACTS_FOLDER/generated.yaml

for PACKAGE in $BUILD_ORDER; do

PKG_PATH=$(catkin locate $PACKAGE)

echo "$0: cding to '$PKG_PATH'"
cd $PKG_PATH

rosdep install -y -v --rosdistro=noetic --from-paths ./

export DEB_BUILD_OPTIONS="parallel=`nproc`"
bloom-generate rosdebian --os-name ubuntu --os-version focal --ros-distro noetic

fakeroot debian/rules "binary --parallel"

sudo apt-get -y install ../*.deb
DEB_NAME=$(dpkg --field ../*.deb | grep Package | awk '{print $2}')
mv ../*.deb $ARTIFACTS_FOLDER

echo "$PACKAGE:
ubuntu: [$DEB_NAME]
" >> $ARTIFACTS_FOLDER/generated.yaml

done

echo ""
echo "$0: the generated rosdep file follows:"
echo ""
cat $ARTIFACTS_FOLDER/generated.yaml
echo ""
40 changes: 40 additions & 0 deletions .ci/parse_yaml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python

import yaml
import sys

def main():

if len(sys.argv) == 4:
file_path = sys.argv[1]
variant = sys.argv[2]
build_for = sys.argv[3]
else:
return

with open(file_path, "r") as file:

try:
data = yaml.safe_load(file)
except yaml.YAMLError as exc:
print(exc)

for package in data:

properties = data[package]

architecture = properties['architecture']

url = properties['source']

if build_for in architecture:

if variant == "stable":
ref = properties['stable_ref']
else:
ref = properties['unstable_ref']

print("{} {} {}".format(package, url, ref))

if __name__ == '__main__':
main()
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: ros_package_build

on:

push:
branches: [ master ]

pull_request:
branches: [ master ]

workflow_dispatch:

jobs:

build_amd64:
runs-on: ubuntu-20.04

env:
PUSH_TOKEN: ${{ secrets.PUSH_TOKEN }}

steps:

- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: 'recursive'

- name: Checkout CI scripts
uses: actions/checkout@v3
with:
repository: ctu-mrs/ci_scripts
ref: master
path: .ci_scripts
token: ${{ secrets.PUSH_TOKEN }}

- name: Build
run: .ci/build.sh unstable

- name: Deploy
run: .ci_scripts/package_build/push_to_ppa.sh unstable /tmp/artifacts
5 changes: 5 additions & 0 deletions act.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

act -s RELEASE_KEY="$(cat ~/.gpg/ctu-mrs.key)" -s PUSH_TOKEN="$GITHUB_TOKEN2"
# act -s RELEASE_KEY="$(cat ~/.gpg/ctu-mrs.key)" -j build
# act -j build
119 changes: 119 additions & 0 deletions packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
mrs_uav_core:
architecture: [x86_64, aarch64]
source: https://github.com/ctu-mrs/mrs_uav_core
unstable_ref: master
stable_ref: release

mrs_uav_gazebo_simulation:
architecture: [x86_64]
source: https://github.com/ctu-mrs/mrs_uav_gazebo_simulation
unstable_ref: master
stable_ref: release

mrs_msgs:
architecture: [x86_64, aarch64]
source: https://github.com/ctu-mrs/mrs_msgs
unstable_ref: hw_api_ci
stable_ref: release

mrs_lib:
architecture: [x86_64, aarch64]
source: https://github.com/ctu-mrs/mrs_lib
unstable_ref: hw_api_ci
stable_ref: release

mrs_uav_managers:
architecture: [x86_64, aarch64]
source: https://github.com/ctu-mrs/mrs_uav_managers
unstable_ref: hw_api_ci
stable_ref: release

mrs_bumper:
architecture: [x86_64, aarch64]
source: https://github.com/ctu-mrs/mrs_bumper
unstable_ref: hw_api_ci
stable_ref: release

mrs_multirotor_simulator:
architecture: [x86_64, aarch64]
source: https://github.com/ctu-mrs/mrs_multirotor_simulator
unstable_ref: master
stable_ref: release

mrs_uav_controllers:
architecture: [x86_64, aarch64]
source: https://github.com/ctu-mrs/mrs_uav_controllers
unstable_ref: hw_api_ci
stable_ref: release

mrs_uav_general:
architecture: [x86_64, aarch64]
source: https://github.com/ctu-mrs/mrs_uav_general
unstable_ref: hw_api_ci
stable_ref: release

mrs_uav_hw_api:
architecture: [x86_64, aarch64]
source: https://github.com/ctu-mrs/mrs_uav_hw_api
unstable_ref: master
stable_ref: release

mrs_uav_state_estimators:
architecture: [x86_64, aarch64]
source: https://github.com/ctu-mrs/mrs_uav_state_estimators
unstable_ref: hw_api_ci
stable_ref: release

mrs_uav_status:
architecture: [x86_64, aarch64]
source: https://github.com/ctu-mrs/mrs_uav_status
unstable_ref: hw_api_ci
stable_ref: release

mrs_uav_testing:
architecture: [x86_64, aarch64]
source: https://github.com/ctu-mrs/mrs_uav_testing
unstable_ref: hw_api_ci
stable_ref: release

mrs_uav_trackers:
architecture: [x86_64, aarch64]
source: https://github.com/ctu-mrs/mrs_uav_trackers
unstable_ref: hw_api_ci
stable_ref: release

mrs_uav_trajectory_generation:
architecture: [x86_64, aarch64]
source: https://github.com/ctu-mrs/mrs_uav_trajectory_generation
unstable_ref: hw_api_ci
stable_ref: release

mrs_uav_rviz_plugins:
architecture: [x86_64, aarch64]
source: https://github.com/ctu-mrs/mrs_uav_rviz_plugins
unstable_ref: hw_api_ci
stable_ref: release

mrs_uav_testing:
architecture: [x86_64, aarch64]
source: https://github.com/ctu-mrs/mrs_uav_testing
unstable_ref: hw_api_ci
stable_ref: release

mrs_uav_px4_api:
architecture: [x86_64, aarch64]
source: https://github.com/ctu-mrs/mrs_uav_px4_api
unstable_ref: master
stable_ref: release

mavlink_sitl_gazebo:
architecture: [x86_64]
source: https://github.com/ctu-mrs/mavlink_sitl_gazebo
unstable_ref: firmware_1.13.2-deb
stable_ref: release

mavlink_gazebo_common_resources:
architecture: [x86_64]
source: https://github.com/ctu-mrs/mavlink_gazebo_common_resources
unstable_ref: hw_api
stable_ref: release

0 comments on commit 757ae52

Please sign in to comment.