Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use maliput::test_utilities and try same branch name in actions #18

Merged
merged 3 commits into from
Nov 24, 2020

Conversation

scpeters
Copy link
Contributor

This is a companion to maliput/maliput#368 (use updated target name maliput::test_utilities). As can be seen in the workflow result for commit 300e101, the workflow fails when compiled against the master branch of maliput, so I've also added support for checking out matching branch names of package dependencies in GitHub actions workflows, as discussed in maliput/maliput_infrastructure#136 (comment). The code linked in that comment is added to the try_vcs_checkout script, and there are two additional changes needed:

  1. Set fetch-depth: 0 in actions/checkout steps for dependencies so that the fell git history is checked out (only needed for dependencies, not for checking out its own code since that is already on the proper branch).

  2. Ensure that git 2.18+ is installed on the system before the actions/checkout steps are run. On 18.04, the standard version of git is 2.17, so we use the git-core ppa to install a newer version (currently 2.29). In anticipation of 20.04, which has git 2.25, I've moved the setup-ros step to the beginning, so that it alone can be used to install git when we switch to 20.04, and the ppa step can be removed.

Once this code has been reviewed and approved, I will open matching pull requests on on the other needed repositories.

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.
@scpeters scpeters force-pushed the scpeters/shorten_maliput_test_utilities_target_name branch from 51f993e to 2c2111e Compare November 20, 2020 09:33
@scpeters
Copy link
Contributor Author

scpeters commented Nov 20, 2020

figuring out which branch to check out is a little tricky, since the GITHUB_REF is useful for push events if you strip the refs/heads/ prefix, but it is not useful in pull requests because it looks like refs/pull/18/merge. For pull requests, the GITHUB_HEAD_REF variable can be used, but this variable is blank for push workflows. With bash parameter substitution, I've used the following expression to use GITHUB_HEAD_REF if it is not empty, and otherwise use GITHUB_REF with refs/heads/ stripped from it:

  • ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}

Copy link
Collaborator

@francocipollone francocipollone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done!

Copy link
Collaborator

@agalbachicar agalbachicar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@scpeters scpeters merged commit e259113 into master Nov 24, 2020
@scpeters scpeters deleted the scpeters/shorten_maliput_test_utilities_target_name branch November 24, 2020 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants