diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..4ec1786 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,70 @@ +name: main + +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - 'ver_ssrc_rel_*' # Push events to matching ver_ssrc_rel_* + +jobs: + tii-deb: + runs-on: ubuntu-latest + steps: + + - name: Checkout fog_sw + uses: actions/checkout@v2 + with: + path: fog_sw + + - name: Checkout ci-scripts + uses: actions/checkout@v2 + with: + repository: tiiuae/fogsw-ci-scripts + path: fogsw-ci-scripts + + # Run docker build + - name: Run fog-sw docker build + run: | + set -eux + mkdir bin + pushd fogsw-ci-scripts + ./generate_deb.sh ../fog_sw ../bin/ + popd + + - name: Install jfrog CLI tool + env: + JFROG_CLI_URL: https://artifactory.ssrc.fi/artifactory/gen-public-local/tools/jfrog/jfrog-1.45.2.tar.gz + if: github.event_name == 'push' + run: | + set -exu + mkdir -p "$GITHUB_WORKSPACE/.jfrog/bin" + curl -L "$JFROG_CLI_URL" -o "$GITHUB_WORKSPACE/.jfrog/jfrog.tar.gz" + tar -C "$GITHUB_WORKSPACE/.jfrog/bin" -zxf "$GITHUB_WORKSPACE/.jfrog/jfrog.tar.gz" + echo "$GITHUB_WORKSPACE/.jfrog/bin" >> "$GITHUB_PATH" + echo "JFROG_CLI_HOME_DIR=$GITHUB_WORKSPACE/.jfrog" >> "$GITHUB_ENV" + + - name: Upload to Artifactory + env: + ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }} + ARTIFACTORY_REPO: debian-release-local + DISTRIBUTION: focal + COMPONENT: fog-sw + ARCHITECTURE: amd64 + BUILD_NAME: fog-sw-full + CI: true + if: github.event_name == 'push' + run: | + set -exu + jfrog rt c import "$ARTIFACTORY_TOKEN" + jfrog rt ping + pkg=$(find bin -name 'fog-sw-full*.deb') + jfrog rt u --deb "$DISTRIBUTION/$COMPONENT/$ARCHITECTURE" \ + --target-props COMMIT="$GITHUB_SHA" \ + --build-name "$BUILD_NAME" \ + --build-number "$GITHUB_SHA" \ + "$pkg" \ + "$ARTIFACTORY_REPO" + jfrog rt build-publish "$BUILD_NAME" "$GITHUB_SHA" + jfrog rt bpr "$BUILD_NAME" "$GITHUB_SHA" "$ARTIFACTORY_REPO" \ + --status "${GITHUB_REF#refs/tags/}" \ + --comment "fog-sw-full release build" diff --git a/.gitignore b/.gitignore index 37520a0..80ff6e2 100644 --- a/.gitignore +++ b/.gitignore @@ -12,8 +12,7 @@ build/ venv/ ros2_ws/KeyFrameTrajectory.txt ros2_ws/src/ros-foxy-* -*debian/ *obj-x86_64*/ # avoid adding binary to repo -packaging/agent_protocol_splitter/protocol_splitter \ No newline at end of file +packaging/agent_protocol_splitter/protocol_splitter diff --git a/packaging/build.sh b/packaging/build.sh new file mode 100755 index 0000000..c56e6b0 --- /dev/null +++ b/packaging/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +build_dir=$1 +dest_dir=$2 + +# Copy debian files from mod_specific directory +cp ${build_dir}/packaging/debian/* ${dest_dir}/DEBIAN/ + +exit 0 \ No newline at end of file diff --git a/packaging/debian/control b/packaging/debian/control new file mode 100644 index 0000000..d6fecf2 --- /dev/null +++ b/packaging/debian/control @@ -0,0 +1,20 @@ +Package: fog-sw-full +Version: VERSION +Maintainer: manuel.segarra-abad +Architecture: amd64 +Description: FOG SW meta package. +Depends: agent-protocol-splitter (= 1.0.0-13~git20210419.ed16b42), + communication-link (= 2.0.0-29~git20210526.843fd45), + fast-dds-gen (= 1.0.0-3~git20210421.694704f), + fogsw-configs (= 1.0.0-4~git20210526.5b156bf), + fog-sw-systemd-services (= 1.0.0-21~git20210601.675cb6f), + libsurvive (= 1.0.0-3~git20210421.b966a6c), + mavlink-router (= 1.0.0-6~git20210419.14c1368), + mavsdk (= 0.34.0), + mission-engine (= 2.0.0-10~git20210526.b4285bc), + ros-foxy-depthai-ctrl (= 0.5.3-28~git20210601.80de68d), + ros-foxy-indoor-pos (= 1.0.0-12~git20210426.81d1987), + ros-foxy-mesh-com (= 0.3.3-29~git20210601.8ecb707), + ros-foxy-px4-mavlink-ctrl (= 0.1.0-11~git20210426.5836a83), + ros-foxy-px4-msgs (= 2.0.1-5~git20210419.b4c4a12), + ros-foxy-px4-ros-com (= 0.1.0-15~git20210602.4acff59) diff --git a/packaging/debian/postinst b/packaging/debian/postinst new file mode 100755 index 0000000..8c3cbfc --- /dev/null +++ b/packaging/debian/postinst @@ -0,0 +1,3 @@ +#!/bin/bash + +exit 0 diff --git a/packaging/debian/prerm b/packaging/debian/prerm new file mode 100755 index 0000000..8c3cbfc --- /dev/null +++ b/packaging/debian/prerm @@ -0,0 +1,3 @@ +#!/bin/bash + +exit 0 diff --git a/packaging/package.sh b/packaging/package.sh index 2d0a490..ab1b991 100755 --- a/packaging/package.sh +++ b/packaging/package.sh @@ -1,53 +1,25 @@ #!/bin/bash -pushd agent_protocol_splitter -./package.sh -popd - -pushd systemd -./package.sh -popd - -pushd mavlink-router -./package.sh -popd - -pushd ../ros2_ws/src/px4_mavlink_ctrl -bloom-generate rosdebian --os-name ubuntu --os-version focal --ros-distro foxy && sed -i 's/^\tdh_shlibdeps.*/& --dpkg-shlibdeps-params=--ignore-missing-info/g' debian/rules && fakeroot debian/rules binary && mv ../*.deb ../../../packaging/ -popd - -pushd ../ros2_ws/src/mesh_com/modules/mesh_com -bloom-generate rosdebian --os-name ubuntu --os-version focal --ros-distro foxy && fakeroot debian/rules binary && mv ../*.deb ../../../../../packaging/ -popd - -pushd ../ros2_ws/src/px4_msgs -bloom-generate rosdebian --os-name ubuntu --os-version focal --ros-distro foxy && fakeroot debian/rules binary && mv ../*.deb ../../../packaging/ -# The following px4_ros_com needs px4_msgs, which was just compiled, so add it to the CMAKE paths -export CMAKE_PREFIX_PATH=${PWD}/debian/ros-foxy-px4-msgs/opt/ros/foxy -popd - -pushd ../ros2_ws/src/px4_ros_com -bloom-generate rosdebian --os-name ubuntu --os-version focal --ros-distro foxy && fakeroot debian/rules binary && mv ../*.deb ../../../packaging/ -popd - -pushd ../ros2_ws/src/indoor_pos -bloom-generate rosdebian --os-name ubuntu --os-version focal --ros-distro foxy && fakeroot debian/rules binary && mv ../*.deb ../../../packaging/ -popd - -pushd communication_link -./package.sh -popd - -pushd ../ros2_ws/src/depthai_ctrl -bloom-generate rosdebian --os-name ubuntu --os-version focal --ros-distro foxy && \ -sed -i 's/^\tdh_shlibdeps.*/& --dpkg-shlibdeps-params=--ignore-missing-info/g' debian/rules && \ -fakeroot debian/rules binary && \ -mv ../*.deb ../../../packaging/ -popd - -pushd ../fogsw_secure_os -./package.sh -popd -mv ../fogsw-secure-os*.deb . - -exit 0 +get_version() { + version=3.1~$(git log --date=format:%Y%m%d --pretty=git%cd.%h -n 1) + echo ${version} +} + +make_deb() { + echo "Creating deb package..." + build_dir=$(mktemp -d) + mkdir ${build_dir}/DEBIAN + + cp packaging/debian/* ${build_dir}/DEBIAN/ + + get_version + sed -i "s/VERSION/${version}/" ${build_dir}/DEBIAN/control + cat ${build_dir}/DEBIAN/control + echo fog-sw-full_${version}_amd64.deb + fakeroot dpkg-deb --build ${build_dir} ../fog-sw-full_${version}_amd64.deb + rm -rf ${build_dir} + echo "Done" +} + +version=$(get_version) +make_deb diff --git a/packaging/package_all.sh b/packaging/package_all.sh new file mode 100755 index 0000000..2d0a490 --- /dev/null +++ b/packaging/package_all.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +pushd agent_protocol_splitter +./package.sh +popd + +pushd systemd +./package.sh +popd + +pushd mavlink-router +./package.sh +popd + +pushd ../ros2_ws/src/px4_mavlink_ctrl +bloom-generate rosdebian --os-name ubuntu --os-version focal --ros-distro foxy && sed -i 's/^\tdh_shlibdeps.*/& --dpkg-shlibdeps-params=--ignore-missing-info/g' debian/rules && fakeroot debian/rules binary && mv ../*.deb ../../../packaging/ +popd + +pushd ../ros2_ws/src/mesh_com/modules/mesh_com +bloom-generate rosdebian --os-name ubuntu --os-version focal --ros-distro foxy && fakeroot debian/rules binary && mv ../*.deb ../../../../../packaging/ +popd + +pushd ../ros2_ws/src/px4_msgs +bloom-generate rosdebian --os-name ubuntu --os-version focal --ros-distro foxy && fakeroot debian/rules binary && mv ../*.deb ../../../packaging/ +# The following px4_ros_com needs px4_msgs, which was just compiled, so add it to the CMAKE paths +export CMAKE_PREFIX_PATH=${PWD}/debian/ros-foxy-px4-msgs/opt/ros/foxy +popd + +pushd ../ros2_ws/src/px4_ros_com +bloom-generate rosdebian --os-name ubuntu --os-version focal --ros-distro foxy && fakeroot debian/rules binary && mv ../*.deb ../../../packaging/ +popd + +pushd ../ros2_ws/src/indoor_pos +bloom-generate rosdebian --os-name ubuntu --os-version focal --ros-distro foxy && fakeroot debian/rules binary && mv ../*.deb ../../../packaging/ +popd + +pushd communication_link +./package.sh +popd + +pushd ../ros2_ws/src/depthai_ctrl +bloom-generate rosdebian --os-name ubuntu --os-version focal --ros-distro foxy && \ +sed -i 's/^\tdh_shlibdeps.*/& --dpkg-shlibdeps-params=--ignore-missing-info/g' debian/rules && \ +fakeroot debian/rules binary && \ +mv ../*.deb ../../../packaging/ +popd + +pushd ../fogsw_secure_os +./package.sh +popd +mv ../fogsw-secure-os*.deb . + +exit 0