Skip to content

Commit

Permalink
Use maliput::test_utilities and try same branch name in actions (#18)
Browse files Browse the repository at this point in the history
* Try to checkout same branch in dependencies

This implements some behavior from our Jenkins CI that
attemps to checkout a branch of the same name in all
dependency packages. This requires setting `fetch-depth: 0`
in the actions/checkout steps and installing git 2.18+
before those checkout steps. For 18.04, the git-core ppa
is used; this will not be needed on 20.04.
  • Loading branch information
scpeters authored Nov 24, 2020
1 parent ea21ac2 commit e259113
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 6 deletions.
16 changes: 16 additions & 0 deletions .github/try_vcs_checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# Copyright 2020 Toyota Research Institute

CHANGE_BRANCH=$1
SRC_FOLDER=$2

echo try checking out ${CHANGE_BRANCH}
vcs custom $SRC_FOLDER --args branch -f $CHANGE_BRANCH origin/$CHANGE_BRANCH > /dev/null || true
vcs custom $SRC_FOLDER --args merge --no-edit $CHANGE_BRANCH > /dev/null || true
DIFF=$(vcs diff -s $SRC_FOLDER | tr -d '.\n')
if [ ! -z "$DIFF" ]; then
echo "Have merge conflicts!"
echo $DIFF
exit 1
fi
vcs status $SRC_FOLDER
17 changes: 16 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,31 @@ jobs:
container:
image: ubuntu:18.04
steps:
# setup-ros first since it installs git, which is needed to fetch all branches from actions/checkout
- uses: ros-tooling/[email protected]
# install git from ppa since git 2.18+ is needed to fetch all branches from actions/checkout
# this step can be removed on 20.04
- name: install git from ppa
shell: bash
run: |
apt update;
apt install -y software-properties-common;
add-apt-repository -y -u ppa:git-core/ppa;
apt install -y git;
- uses: actions/checkout@v2
with:
path: ${{ env.ROS_WS }}/src/${{ env.PACKAGE_NAME }}
# clone private dependencies
- uses: actions/checkout@v2
with:
repository: ToyotaResearchInstitute/maliput
fetch-depth: 0
path: ${{ env.ROS_WS }}/src/maliput
token: ${{ secrets.MALIPUT_TOKEN }}
- uses: ros-tooling/[email protected]
- name: check if dependencies have a matching branch
shell: bash
working-directory: ${{ env.ROS_WS }}/src
run: ./${PACKAGE_NAME}/.github/try_vcs_checkout ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} .
# clone public dependencies
- name: vcs import
shell: bash
Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,31 @@ jobs:
CXX: clang++
LINKER_PATH: /usr/bin/llvm-ld
steps:
# setup-ros first since it installs git, which is needed to fetch all branches from actions/checkout
- uses: ros-tooling/[email protected]
# install git from ppa since git 2.18+ is needed to fetch all branches from actions/checkout
# this step can be removed on 20.04
- name: install git from ppa
shell: bash
run: |
apt update;
apt install -y software-properties-common;
add-apt-repository -y -u ppa:git-core/ppa;
apt install -y git;
- uses: actions/checkout@v2
with:
path: ${{ env.ROS_WS }}/src/${{ env.PACKAGE_NAME }}
# clone private dependencies
- uses: actions/checkout@v2
with:
repository: ToyotaResearchInstitute/maliput
fetch-depth: 0
path: ${{ env.ROS_WS }}/src/maliput
token: ${{ secrets.MALIPUT_TOKEN }}
# use setup-ros action to get vcs, rosdep, and colcon
- uses: ros-tooling/[email protected]
- name: check if dependencies have a matching branch
shell: bash
working-directory: ${{ env.ROS_WS }}/src
run: ./${PACKAGE_NAME}/.github/try_vcs_checkout ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} .
- name: clang 8 install
shell: bash
run: ${{ env.ROS_WS }}/src/${{ env.PACKAGE_NAME }}/.github/clang_suite_installation.sh
Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/scan_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,31 @@ jobs:
container:
image: ubuntu:18.04
steps:
# setup-ros first since it installs git, which is needed to fetch all branches from actions/checkout
- uses: ros-tooling/[email protected]
# install git from ppa since git 2.18+ is needed to fetch all branches from actions/checkout
# this step can be removed on 20.04
- name: install git from ppa
shell: bash
run: |
apt update;
apt install -y software-properties-common;
add-apt-repository -y -u ppa:git-core/ppa;
apt install -y git;
- uses: actions/checkout@v2
with:
path: ${{ env.ROS_WS }}/src/${{ env.PACKAGE_NAME }}
# clone private dependencies
- uses: actions/checkout@v2
with:
repository: ToyotaResearchInstitute/maliput
fetch-depth: 0
path: ${{ env.ROS_WS }}/src/maliput
token: ${{ secrets.MALIPUT_TOKEN }}
# use setup-ros action to get vcs, rosdep, and colcon
- uses: ros-tooling/[email protected]
- name: check if dependencies have a matching branch
shell: bash
working-directory: ${{ env.ROS_WS }}/src
run: ./${PACKAGE_NAME}/.github/try_vcs_checkout ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} .
- name: clang 8 install
shell: bash
run: ${{ env.ROS_WS }}/src/${{ env.PACKAGE_NAME }}/.github/clang_suite_installation.sh
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ macro(add_dependencies_to_test target)

target_link_libraries(${target}
maliput_dragway
maliput::maliput_test_utilities)
maliput::test_utilities)

endif()
endmacro()
Expand Down

0 comments on commit e259113

Please sign in to comment.