From 9289f9b9266e663caa902364f7371b4429665fbc Mon Sep 17 00:00:00 2001 From: Tomas Baca Date: Sat, 12 Aug 2023 11:50:57 +0200 Subject: [PATCH] test --- .ci/build.sh | 13 +++++------- .ci/get_repo_source.py | 39 +++++++++++++++++++++++++++++++++++ .github/workflows/example.yml | 21 +++++++++---------- test.yaml | 4 ++-- 4 files changed, 56 insertions(+), 21 deletions(-) create mode 100755 .ci/get_repo_source.py diff --git a/.ci/build.sh b/.ci/build.sh index d529a5353f..e9c5f801f8 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -6,9 +6,10 @@ trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG trap 'echo "$0: \"${last_command}\" command failed with exit code $?"' ERR VARIANT=$1 +PACKAGE_NAME=$2 WORKSPACE=/tmp/workspace ARCH=$(uname -m) -YAML_FILE=packages.yaml +YAML_FILE=test.yaml ARTIFACTS_FOLDER=/tmp/artifacts ./.ci_scripts/package_build/install_ros.sh @@ -24,10 +25,11 @@ 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) +REPOS=$(./.ci/get_repo_source.py $YAML_FILE $VARIANT $ARCH $PACKAGE_NAME) + +sudo apt install $ARTIFACTS_FOLDER/*.deb || echo "no artifacts to install" mkdir -p $WORKSPACE -mkdir -p $ARTIFACTS_FOLDER cd $WORKSPACE mkdir src @@ -78,7 +80,6 @@ for PACKAGE in $BUILD_ORDER; do fakeroot debian/rules "binary --parallel" - sudo apt-get -y install --allow-downgrades ../*.deb DEB_NAME=$(dpkg --field ../*.deb | grep Package | awk '{print $2}') mv ../*.deb $ARTIFACTS_FOLDER @@ -86,10 +87,6 @@ for PACKAGE in $BUILD_ORDER; do ubuntu: [$DEB_NAME] " >> $ROSDEP_FILE - rosdep update - - source /opt/ros/noetic/setup.bash - done if [[ "$ARCH" != "x86_64" ]]; then diff --git a/.ci/get_repo_source.py b/.ci/get_repo_source.py new file mode 100755 index 0000000000..07a4b704af --- /dev/null +++ b/.ci/get_repo_source.py @@ -0,0 +1,39 @@ +#!/usr/bin/python3 + +import yaml +import sys + +def main(): + + if len(sys.argv) == 5: + file_path = sys.argv[1] + variant = sys.argv[2] + build_for = sys.argv[3] + repo_name = sys.argv[4] + else: + return + + with open(file_path, "r") as file: + + try: + data = yaml.safe_load(file) + except yaml.YAMLError as exc: + print(exc) + + properties = data[repo_name] + + 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(repo_name, url, ref)) + +if __name__ == '__main__': + main() diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml index 3815fd70d2..45e023ba80 100644 --- a/.github/workflows/example.yml +++ b/.github/workflows/example.yml @@ -55,19 +55,17 @@ jobs: - name: Load artifacts uses: actions/download-artifact@v3 with: - name: debs - path: /tmp/debs/ + name: artifacts + path: /tmp/artifacts/ - id: execute run: | - echo "starting with:" - cat /tmp/debs/test.txt - echo "" - echo "This is job named ${{ matrix.job }}" >> /tmp/debs/test.txt + mkdir -p /tmp/artifacts + .ci/build.sh unstable ${{ matrix.job }} - name: Save artifacts uses: actions/upload-artifact@v3 with: - name: debs - path: /tmp/debs/ + name: artifacts + path: /tmp/artifacts/ collect_artifacts: runs-on: ubuntu-20.04 @@ -76,8 +74,9 @@ jobs: - name: Load artifacts uses: actions/download-artifact@v3 with: - name: debs - path: /tmp/debs/ + name: artifacts + path: /tmp/artifacts/ - id: execute run: | - cat /tmp/debs/test.txt + ls -la /tmp/artifacts + cat /tmp/artifacts/generated.yaml diff --git a/test.yaml b/test.yaml index c0a1724db2..7b951e3e0e 100644 --- a/test.yaml +++ b/test.yaml @@ -10,8 +10,8 @@ mrs_lib: unstable_ref: hw_api stable_ref: release -mrs_uav_gazebo_simulation: +mrs_uav_hw_api: architecture: [x86_64] - source: https://github.com/ctu-mrs/mrs_uav_gazebo_simulation + source: https://github.com/ctu-mrs/mrs_uav_hw_api unstable_ref: master stable_ref: release