-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Deactivate ROSDISTRO_INDEX_URL again * Try to use a bare ubuntu container * Noble is now supported by setup-ros * Add container input also for source build and pre-commit * Cleanup * Set it for pre-commit * Fix pre-commit * Test if this fixes the .git error * Fix also auto-update * Fix paths for autoupdate * Fix paths * Fix #13 * Use correct var * Remove double env.path * Bump version of pre-commit hooks (#58) Co-authored-by: christophfroehlich <[email protected]> * Harden behavior if sudo is installed or not --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: christophfroehlich <[email protected]>
- Loading branch information
1 parent
2888a81
commit b7592c8
Showing
6 changed files
with
121 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ jobs: | |
uses: ./.github/workflows/reusable-pre-commit.yml | ||
with: | ||
ros_distro: rolling | ||
container: ubuntu:24.04 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,32 +7,43 @@ on: | |
required: true | ||
type: string | ||
os_name: | ||
description: 'On which OS to run the workflow, e.g. ubuntu-22.04' | ||
description: 'On which runner-OS to run the workflow, e.g. ubuntu-22.04' | ||
required: false | ||
default: 'ubuntu-latest' | ||
type: string | ||
container: | ||
description: '(optional) Docker container to run the job in, e.g. ubuntu:noble' | ||
required: false | ||
default: '' | ||
type: string | ||
|
||
jobs: | ||
coverage: | ||
name: coverage build ${{ inputs.ros_distro }} | ||
runs-on: ${{ inputs.os_name }} | ||
container: ${{ inputs.container }} | ||
steps: | ||
- uses: ros-tooling/[email protected] | ||
- name: Temporary fix for rolling by setting the ROSDISTRO_INDEX_URL | ||
# see https://docs.ros.org/en/rolling/How-To-Guides/Using-Custom-Rosdistro.html | ||
# TODO(anyone): remove/deactivate after rolling is fixed on noble | ||
- name: "Determine prerequisites" | ||
id: prereq | ||
run: | | ||
if [[ "${{ inputs.ros_distro }}" == "rolling" ]]; then | ||
sudo sed -i "s|ros\/rosdistro\/master|ros\/rosdistro\/rolling\/2024-02-28|" /etc/ros/rosdep/sources.list.d/20-default.list | ||
echo "ROSDISTRO_INDEX_URL=https://raw.githubusercontent.com/ros/rosdistro/rolling/2024-02-28/index-v4.yaml" >> $GITHUB_ENV | ||
fi | ||
- name: Test some rosdep commands to see if the step above worked | ||
# TODO(anyone): remove/deactivate after rolling is fixed on noble | ||
command -v sudo >/dev/null 2>&1 || (apt update && apt install -y sudo) | ||
DEBIAN_FRONTEND=noninteractive sudo apt update && sudo apt upgrade -y | ||
echo "need_node=$(command -v node >/dev/null 2>&1 && echo 0 || echo 1)" >> $GITHUB_OUTPUT | ||
# needed for github actions, and only if a bare ubuntu image is used | ||
- uses: actions/setup-node@v4 | ||
if: ${{ steps.prereq.outputs.need_node == '1' && !env.ACT }} | ||
- name: Install node | ||
# Consider switching to https://github.com/actions/setup-node when it works | ||
# https://github.com/nektos/act/issues/973 | ||
if: ${{ steps.prereq.outputs.need_node == '1' && env.ACT }} | ||
run: | | ||
rosdep update | ||
echo "ROS_DISTRO: $ROS_DISTRO" | ||
rosdep resolve test_msgs std_msgs || true | ||
rosdep resolve test_msgs std_msgs --os=ubuntu:jammy --rosdistro=rolling | ||
sudo apt install -y curl | ||
curl -sS https://webi.sh/node | sh | ||
echo ~/.local/opt/node/bin >> $GITHUB_PATH | ||
# needed only if a non-ros image is used | ||
- uses: ros-tooling/[email protected] | ||
- uses: actions/checkout@v4 | ||
- id: package_list_action | ||
uses: ros-controls/ros2_control_ci/.github/actions/set-package-list@master | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,20 +14,60 @@ on: | |
required: false | ||
default: 'ubuntu-latest' | ||
type: string | ||
container: | ||
description: '(optional) Docker container to run the job in, e.g. ubuntu:noble' | ||
required: false | ||
default: '' | ||
type: string | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ${{ inputs.os_name }} | ||
container: ${{ inputs.container }} | ||
env: | ||
# this will be src/{repo-owner}/{repo-name} | ||
path: src/${{ github.repository }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ros-tooling/[email protected] | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: pre-commit-3|${{ inputs.ros_distro }}|${{ hashFiles('.pre-commit-config.yaml') }} | ||
- name: Install system hooks and run pre-commit | ||
run: | | ||
sudo apt-get install -qq ros-${{ inputs.ros_distro }}-ament-cppcheck ros-${{ inputs.ros_distro }}-ament-cpplint ros-${{ inputs.ros_distro }}-ament-lint-cmake ros-${{ inputs.ros_distro }}-ament-copyright | ||
source /opt/ros/${{ inputs.ros_distro }}/setup.bash | ||
python -m pip install pre-commit | ||
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual | ||
- name: "Determine prerequisites" | ||
id: prereq | ||
run: | | ||
command -v sudo >/dev/null 2>&1 || (apt update && apt install -y sudo) | ||
DEBIAN_FRONTEND=noninteractive sudo apt update && sudo apt upgrade -y | ||
echo "need_node=$(command -v node >/dev/null 2>&1 && echo 0 || echo 1)" >> $GITHUB_OUTPUT | ||
# needed for github actions, and only if a bare ubuntu image is used | ||
- uses: actions/setup-node@v4 | ||
if: ${{ steps.prereq.outputs.need_node == '1' && !env.ACT }} | ||
- name: Install node | ||
# Consider switching to https://github.com/actions/setup-node when it works | ||
# https://github.com/nektos/act/issues/973 | ||
if: ${{ steps.prereq.outputs.need_node == '1' && env.ACT }} | ||
run: | | ||
sudo apt install -y curl | ||
curl -sS https://webi.sh/node | sh | ||
echo ~/.local/opt/node/bin >> $GITHUB_PATH | ||
# needed only if a non-ros image is used | ||
- uses: ros-tooling/[email protected] | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
path: ${{ env.path }} | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: pre-commit-3|${{ inputs.ros_distro }}|${{ hashFiles('.pre-commit-config.yaml') }} | ||
- name: Install pre-commit and system hooks | ||
shell: bash | ||
run: | | ||
sudo apt-get install -qq ros-${{ inputs.ros_distro }}-ament-cppcheck ros-${{ inputs.ros_distro }}-ament-cpplint ros-${{ inputs.ros_distro }}-ament-lint-cmake ros-${{ inputs.ros_distro }}-ament-copyright python3-venv | ||
python3 -m venv .venv | ||
source .venv/bin/activate | ||
python3 -m pip install pre-commit | ||
- name: Run pre-commit | ||
shell: bash | ||
run: | | ||
source .venv/bin/activate | ||
source /opt/ros/${{ inputs.ros_distro }}/setup.bash | ||
cd ${{ env.path }} | ||
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,18 +23,42 @@ on: | |
required: false | ||
default: 'ubuntu-latest' | ||
type: string | ||
container: | ||
description: '(optional) Docker container to run the job in, e.g. ubuntu:noble' | ||
required: false | ||
default: '' | ||
type: string | ||
|
||
jobs: | ||
reusable_ros_tooling_source_build: | ||
name: ${{ inputs.ros_distro }} ${{ inputs.os_name }} | ||
runs-on: ${{ inputs.os_name }} | ||
container: ${{ inputs.container }} | ||
env: | ||
# this will be src/{repo-owner}/{repo-name} | ||
path: src/${{ github.repository }} | ||
steps: | ||
- name: "Determine prerequisites" | ||
id: prereq | ||
run: | | ||
command -v sudo >/dev/null 2>&1 || (apt update && apt install -y sudo) | ||
DEBIAN_FRONTEND=noninteractive sudo apt update && sudo apt upgrade -y | ||
echo "need_node=$(command -v node >/dev/null 2>&1 && echo 0 || echo 1)" >> $GITHUB_OUTPUT | ||
# needed for github actions, and only if a bare ubuntu image is used | ||
- uses: actions/setup-node@v4 | ||
if: ${{ steps.prereq.outputs.need_node == '1' && !env.ACT }} | ||
- name: Install node | ||
# Consider switching to https://github.com/actions/setup-node when it works | ||
# https://github.com/nektos/act/issues/973 | ||
if: ${{ steps.prereq.outputs.need_node == '1' && env.ACT }} | ||
run: | | ||
sudo apt install -y curl | ||
curl -sS https://webi.sh/node | sh | ||
echo ~/.local/opt/node/bin >> $GITHUB_PATH | ||
# needed only if a non-ros image is used | ||
- uses: ros-tooling/[email protected] | ||
with: | ||
required-ros-distributions: ${{ inputs.ros_distro }} | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters