Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Aug 12, 2023
1 parent 58c405a commit 9289f9b
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 21 deletions.
13 changes: 5 additions & 8 deletions .ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -78,18 +80,13 @@ 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

echo "$PACKAGE:
ubuntu: [$DEB_NAME]
" >> $ROSDEP_FILE

rosdep update

source /opt/ros/noetic/setup.bash

done

if [[ "$ARCH" != "x86_64" ]]; then
Expand Down
39 changes: 39 additions & 0 deletions .ci/get_repo_source.py
Original file line number Diff line number Diff line change
@@ -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()
21 changes: 10 additions & 11 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9289f9b

Please sign in to comment.