From 6a82f0ac048aa8fb45d5ad245d3ed56afa463f2c Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Tue, 31 Oct 2023 21:25:23 +0700 Subject: [PATCH] refactor: move the content of `setup_dependencies.bash` to `action.yaml` --- action.yaml | 19 ++++++++++++++++--- scripts/setup-dependencies.bash | 18 ------------------ 2 files changed, 16 insertions(+), 21 deletions(-) delete mode 100644 scripts/setup-dependencies.bash diff --git a/action.yaml b/action.yaml index 764f430..c39e1cf 100644 --- a/action.yaml +++ b/action.yaml @@ -12,9 +12,22 @@ inputs: runs: using: composite steps: - - name: Setup dependencies - run: bash ${{ github.action_path }}/scripts/setup-dependencies.bash ${{ inputs.ros2-distro }} - shell: bash + - shell: bash + run: | + sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null + + - shell: bash + run: | + sudo apt update + sudo apt install -y python3-colcon-common-extensions python3-rosdep + + - shell: bash + run: | + sudo rosdep init + rosdep update + rosdep install -y --rosdistro ${{ inputs.ros2-distro }} --from-paths . + - name: Build and test workspace run: bash ${{ github.action_path }}/scripts/build-and-test.bash ${{ inputs.ros2-distro }} shell: bash diff --git a/scripts/setup-dependencies.bash b/scripts/setup-dependencies.bash deleted file mode 100644 index f4cf259..0000000 --- a/scripts/setup-dependencies.bash +++ /dev/null @@ -1,18 +0,0 @@ -ROS2_DISTRO="$1" - -# Add ROS 2 GPG key -sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg || exit $? - -# Add ROS 2 repository to the source list -echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null || exit $? - -# Install required tools -sudo apt update && sudo apt install -y \ - python3-colcon-common-extensions \ - python3-rosdep || exit $? - -# Initialize rosdep -sudo rosdep init || true - -# Install ROS 2 workspace dependencies -rosdep update && rosdep install -y --rosdistro "$ROS2_DISTRO" --from-paths . || exit $?