Skip to content

Commit

Permalink
♻️ refactor(ci): changed reusable source build to conditional checkou…
Browse files Browse the repository at this point in the history
…t and execute a local requirements.sh
  • Loading branch information
kluge7 committed Nov 14, 2024
1 parent a3670f5 commit 646a229
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions .github/workflows/reusable-source-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ on:
required: false
default: "11" # Default GCC version commonly available on Ubuntu 22.04
type: string
requirements_url:
description: "URL to the requirements.sh file for additional dependencies"
download_requirements:
description: "Download and execute requirements.sh if available"
required: false
default: ""
type: string
default: false
type: boolean
jobs:
build:
runs-on: ${{ inputs.os_name }}
Expand All @@ -54,30 +54,23 @@ jobs:
uses: ros-tooling/[email protected]
with:
required-ros-distributions: ${{ inputs.ros_distro }}
- name: Download and install extra dependencies
if: inputs.requirements_url != ''
run: |
echo "Downloading and executing requirements.sh from: ${{ inputs.requirements_url }}"
curl -o requirements.sh ${{ inputs.requirements_url }}
chmod +x requirements.sh
./requirements.sh
# Check out the repository if no external requirements URL is provided
# Check out the repository to get access to requirements.sh if required
- name: Check out the repository
if: inputs.requirements_url == ''
if: inputs.download_requirements
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
# Install extra dependencies from a local requirements.sh file if it exists in the root directory
- name: Install extra dependencies from local requirements.sh
if: inputs.requirements_url == ''
# Conditionally download and execute requirements.sh if download_requirements is true and file exists
- name: Download and install extra dependencies if requirements.sh exists
if: inputs.download_requirements
run: |
if [ -f requirements.sh ]; then
echo "Executing local requirements.sh from repository root directory"
echo "Executing requirements.sh from repository root directory"
chmod +x requirements.sh
./requirements.sh
else
echo "No local requirements.sh found in root directory"
fi
echo "requirements.sh file not found in repository root"
fi
- name: build and test ROS 2 packages
uses: ros-tooling/[email protected]
with:
Expand Down

0 comments on commit 646a229

Please sign in to comment.