-
Notifications
You must be signed in to change notification settings - Fork 521
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
Fix part of #1861: [RunAllTests] Update Bazel CI workflow to run all Oppia tests #1904
Conversation
Build all Oppia targets in Bazel rather than just the binary target.
Reset the workflow name so that it doesn't need to be renamed in GitHub settings.
Note that the build will be failing until after #1876 is merged. Switching to draft for now. |
#1876 is now merged and this PR is up-to-date so it should pass. Sending it to review. |
Hmm, maybe this isn't feasible. CI killed this after an hour run--I wasn't expecting it to take that long. |
Maybe we should try to create various tasks instead of one large task that builds all Bazel targets? I was thinking that since we already upload the Bazel binary we could download it for use in other tasks - maybe creating tasks that build all the Bazel targets for utility, then a task for model, etc. What do you think? |
We seem to be able to build the Android binary in ~15 minutes which covers all of the libraries. I think there might be some base overhead to tests that are being shared across the 100 test suites, and CI isn't great at parallel builds. I think maybe building the binary & then sharing those build results with the test run might help: we can actually share all of the libraries this way, and hopefully the tests go by a bit faster. I think this means that even running all the tests with Bazel will exceeds 50 minutes, though, which is definitely problematic. |
So I've had some luck locally with setting up remote caching--this seems to decrease build times 2-5x which might make an optional build-all actions check viable. We'll probably want to split up the build based on modules, though, to improve parallelization. |
This uses a remote storage service with a local file encrypted using git-secret to act as the authentication key for Bazel to read & write artifacts to the service for caching purposes.
Need to re-run everything due to Gradle flake. :( |
@seanlip please approve codeowners change. |
Done. @BenHenning just to check, is |
@seanlip so much as I can tell that file is expected to be present. I don't totally understand how git secret manages it internally, but it doesn't gitignore that file (which I would expect if it weren't necessary since it does gitignore others). It may be a necessary backup for the inner workings of git secret, not sure. Thanks for double checking! |
Conflicts: .github/workflows/main.yml domain/BUILD.bazel testing/BUILD.bazel
Note that I'm going to also split the Bazel tests into their own workflow so that failures don't require restarting all checks (only the Bazel ones). I've also filed the post-PR tracking issues now in preparation of merging this shortly. |
I think we also need a way to guarantee all tests are covered as we continue with the migration, otherwise it seems a bit too easy to miss things. Will follow up with something in a PR after this one. |
This fixes some tests that were broken after recent PRs, and fixed a visibility error introduced in #2663.
This will make it easier to restart failures without having to also restart unrelated tests.
I think I'm also going to move this to using Bazel 4.0 LTS since it will substantially speed up the cloning part of the workflow. |
Awesome, green PR. :) Going to merge this in as-is & add the optimization in a follow-up PR since this unlocks being able to fix a few different things. |
Thanks all for the feedback & reviews. This was a bit more complicated of a PR, and took quite a bit of time to get it merge-worthy. |
Fix part of #1861.
At a high-level, this PR introduces running all of Oppia's Robolectric tests in GitHub Actions via Bazel now that Bazel has shown sufficient maturity while being used to continually build the app binary. In particular:
develop
(e.g. for continuous builds) in which case all tests will run, or if the PR title includes[RunAllTests]
. While this is a nice addition, the real benefits won't be realized for a while: the lack of modularization means small changes (e.g. to just 1 app module file) will result in all tests tied to that module to need to re-run, and any changes to Bazel/BUILD files will trigger a re-run of the entire test suite since the Bazel files transitively expand to the whole set of BUILD files due to a circular dependency between domain & app. Changes to WORKSPACE will always trigger a full test re-run for safety.For some side context, #1876 required a lot of peripheral changes due to previous changes breaking Bazel test targets. This will help prevent that from happening. This PR will also help improve test reliability since it caught at least 1 test suite that had some timing issues that needed to be fixed that wasn't hit with Gradle (StateFragmentLocalTest).
FYI that #1861 is tracking long-term optimizations for improving Bazel builds in CI beyond those included in this PR.
Follow-up items to complete after this PR is merged:
Introduce a wiki article explaining how to setup Bazel locally to investigate CI failures (this is going to be a bit rough initially since Bazel 4.0 isn't released yet, so the custom build of Bazel will need to be used in the interim).Now available here.Note that GitHub seems to also have a nice visualization of the job dependency graph. For specifics, see: https://github.com/oppia/oppia-android/actions/runs/424948426.