Skip to content

Use setup bazel gha - #166

Merged
jwnimmer-tri merged 1 commit into
RobotLocomotion:mainfrom
tom-osika:setup_bazel_gha
Feb 2, 2026
Merged

Use setup bazel gha#166
jwnimmer-tri merged 1 commit into
RobotLocomotion:mainfrom
tom-osika:setup_bazel_gha

Conversation

@tom-osika

@tom-osika tom-osika commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

Towards #111

The first run shows the expected cache misses during the Run bazel-contrib/setup-bazel@0.15.0 GHA step here. The second run shows cache hits here

Just like RobotLocomotion/models#111, I added a temporary commit modifying the MODULE.bazel to ensure that the repository caching still works even when modifying this file (which, be default, is used as part of the restore key).

This change is Reviewable

@tom-osika
tom-osika requested a review from jwnimmer-tri January 5, 2026 16:22
@tom-osika
tom-osika marked this pull request as ready for review January 5, 2026 16:22
@jwnimmer-tri jwnimmer-tri self-assigned this Jan 5, 2026
@tom-osika

Copy link
Copy Markdown
Contributor Author

+a:@jwnimmer-tri

@tom-osika

Copy link
Copy Markdown
Contributor Author

+a:@jwnimmer-tri (trying again after permissions were updated)

@jwnimmer-tri jwnimmer-tri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fyi In the GHA Actions page, I clicked "re-run all jobs". The re-launched bazel_test job is here: https://github.com/RobotLocomotion/drake-blender/actions/runs/20720901652/job/59585025755. Notice the final output Executed 1 out of 18 tests: 18 tests pass.. That's pretty good (the expensive server tests were cached). It's a bit concerning that there was 1 cache miss (//test:pycodestyle_py_lint_test) but I don't think that's worth investigating.

@jwnimmer-tri reviewed 3 files and all commit messages, and made 3 comments.
Reviewable status: 2 unresolved discussions, LGTM missing from assignee jwnimmer-tri (waiting on @tom-osika).


.github/workflows/main.yml line 48 at r1 (raw file):

      - uses: actions/cache/restore@v5
        with:
          path: ~/.cache/pip

In the "install_test" job below, we use setup-python and set "cache: pip" and that gives us pip caching.

It is possible that we could use that same technique here, instead of doing a manual pip cache? That would be a lot simpler.


.github/workflows/main.yml line 74 at r1 (raw file):

          # This dumps configuration details to the log.
          bazelrc: common --announce_rc=yes
      - name: Report cache sizes

nit Ditto -- we can drop this now.

@tom-osika tom-osika left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching that. Its up to you, I can either look into it more before we merge or I can create a ticket for later.

@tom-osika made 2 comments.
Reviewable status: 2 unresolved discussions, LGTM missing from assignee jwnimmer-tri (waiting on @jwnimmer-tri).


.github/workflows/main.yml line 48 at r1 (raw file):

Previously, jwnimmer-tri (Jeremy Nimmer) wrote…

In the "install_test" job below, we use setup-python and set "cache: pip" and that gives us pip caching.

It is possible that we could use that same technique here, instead of doing a manual pip cache? That would be a lot simpler.

Yes, I think so. According to this, the setup-python action will compute the hash of the dependency file (either pyproject.toml or requirements.txt) and use that as part of the cache key. For pip, the action will cache the global cache directory

Would you like me to switch it?

@tom-osika
tom-osika force-pushed the setup_bazel_gha branch 2 times, most recently from 561ab3d to 0c4d54b Compare January 7, 2026 20:05

@jwnimmer-tri jwnimmer-tri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@jwnimmer-tri reviewed all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: 1 unresolved discussion, LGTM missing from assignee jwnimmer-tri (waiting on @tom-osika).


.github/workflows/main.yml line 48 at r1 (raw file):

Previously, tom-osika (Tom Osika) wrote…

Yes, I think so. According to this, the setup-python action will compute the hash of the dependency file (either pyproject.toml or requirements.txt) and use that as part of the cache key. For pip, the action will cache the global cache directory

Would you like me to switch it?

Yes, that sounds like a good idea.

@tom-osika
tom-osika force-pushed the setup_bazel_gha branch 5 times, most recently from e72bb29 to 7bca0a6 Compare January 15, 2026 18:49

@tom-osika tom-osika left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@tom-osika made 1 comment.
Reviewable status: 1 unresolved discussion, LGTM missing from assignee jwnimmer-tri (waiting on @jwnimmer-tri).


.github/workflows/main.yml line 48 at r1 (raw file):

Previously, jwnimmer-tri (Jeremy Nimmer) wrote…

Yes, that sounds like a good idea.

Hmm, for some reason using setup-python caching is causing all of the 18 tests to run instead of the 1/18 we saw before.... Investigating now.

@tom-osika
tom-osika force-pushed the setup_bazel_gha branch 2 times, most recently from f0cadde to 51a6ef3 Compare January 16, 2026 18:57

@tom-osika tom-osika left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@tom-osika made 1 comment.
Reviewable status: 1 unresolved discussion, LGTM missing from assignee jwnimmer-tri (waiting on @jwnimmer-tri).


.github/workflows/main.yml line 48 at r1 (raw file):

Previously, tom-osika (Tom Osika) wrote…

Hmm, for some reason using setup-python caching is causing all of the 18 tests to run instead of the 1/18 we saw before.... Investigating now.

If I remove the setup-python caching altogether, the tests still don't get cached. i.e., if setup-python is configured like this:

- uses: actions/setup-python@v6
        with:
          python-version: "3.11"

All of the tests run. This makes me think that the python version that setup-python is using is interfering with bazel / somehow causing the tests to no longer be hermetic. Looking more into it...

@jwnimmer-tri jwnimmer-tri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@jwnimmer-tri reviewed all commit messages.
Reviewable status: 1 unresolved discussion, LGTM missing from assignee jwnimmer-tri (waiting on @tom-osika).

@jwnimmer-tri jwnimmer-tri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@jwnimmer-tri reviewed all commit messages.
Reviewable status: 1 unresolved discussion, LGTM missing from assignee jwnimmer-tri (waiting on @tom-osika).

@tom-osika tom-osika left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@tom-osika made 1 comment.
Reviewable status: 1 unresolved discussion, LGTM missing from assignee jwnimmer-tri (waiting on @jwnimmer-tri).


.github/workflows/main.yml line 48 at r1 (raw file):

Previously, tom-osika (Tom Osika) wrote…

If I remove the setup-python caching altogether, the tests still don't get cached. i.e., if setup-python is configured like this:

- uses: actions/setup-python@v6
        with:
          python-version: "3.11"

All of the tests run. This makes me think that the python version that setup-python is using is interfering with bazel / somehow causing the tests to no longer be hermetic. Looking more into it...

Update on this: I don't think that the pip caching we originally had was necessary for the bazel_test job. As far as I understand, bazel manages all of the dependencies itself in a totally isolated, hermetic way, so the packages we were saving / restoring from the pip cache ourselves were irrelevant.

If I check out the $(bazel info output_base)/external/ directory, you can find subdirectories for the python dependencies. AFAIK this is totally separate from the normal pip cache.

I removed the pip caching from the bazel_test job and the runtime stayed the same. See here: https://github.com/RobotLocomotion/drake-blender/actions/runs/21525900666/job/62029310737

I re-ran the job and saw 0 tests run, instead of the 1/18 we were occasionally seeing before: https://github.com/RobotLocomotion/drake-blender/actions/runs/21525900666/job/62033212206

This is ready for re-review, @jwnimmer-tri

@jwnimmer-tri jwnimmer-tri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:lgtm:

@jwnimmer-tri reviewed 2 files and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignee jwnimmer-tri (waiting on @tom-osika).

@jwnimmer-tri
jwnimmer-tri merged commit 92cf385 into RobotLocomotion:main Feb 2, 2026
5 checks passed
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.

2 participants