Open llxia opened 1 year ago
Lan, this sounds really cool way to speed up testing of PRs.
I expect nightly builds will continue to execute as they do today (not be changed based) and that we can tune the changed-based PR tests if we find more than the expected number of failing tests in the nightly builds?
Subsequently, we will analyze each code change within a PR and suggest and execute relevant test(s) accordingly. Ideally, from a user perspective, when a PR is created in the Openj9 repository, a GitHub workflow will automatically run and analyze the associated git PRs, initiating the execution of the relevant test(s), and the result will be displayed on PR.
"initiating the execution of the relevant test(s)".... I think the question here is "when"? Will the tests be run on every push to the PR? Only once? Manually triggered by the committer? I guess this only matters if we run into resource constraints on github runners...
The ideal application of change-based testing is to execute only the relevant test(s) for a given PR, offering prompt testing feedback to both contributors and committers. Committers can choose to run additional tests using the existing git comment-triggered test builds. It's important to note that change-based testing does not replace any Nightly/Weekly/Release testing. The Nightly/Weekly/Release testing should continue to encompass full-level testing. However, if the accuracy of change-based testing is established, it may be possible to reduce the extent of nightly testing in the future. Currently, the focus is on testing PRs exclusively.
Regarding the triggering mechanism for change-based testing, we have a couple of options. It can be automatically triggered when a PR is ready for review. Alternatively, we can customize the triggering process based on our specific requirements. For example, instead of an auto-trigger, it can be activated through git comments by committers and/or contributors. In case the GitHub runner's resources are limited, we can adapt the setup to utilize a Jenkins job instead.
Thanks for clarifying @llxia.
Regarding the triggering mechanism for change-based testing, we have a couple of options. It can be automatically triggered when a PR is ready for review. Alternatively, we can customize the triggering process based on our specific requirements. For example, instead of an auto-trigger, it can be activated through git comments by committers and/or contributors. In case the GitHub runner's resources are limited, we can adapt the setup to utilize a Jenkins job instead.
This is the part I'm still the most unclear on (and maybe that's a "me" thing). I'm not sure what flags a PR as "ready for review" apart from leaving draft status (and most of our PRs are never put in draft). Would the change based tests be re-triggered for every push to a non-draft PR? The more you can expand on the initial approach (totally fine to change it later) the easier it will be for devs to get value from it.
GitHub workflow can be triggered by the specific GitHub event(s). ready_for_review is just one example. By default, a workflow only runs when a pull_request event's activity type is opened, synchronize, or reopened.
(See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request). For example, we are using ready_for_review in AQA repo: https://github.com/adoptium/aqa-tests/blob/master/.github/workflows/directoriesFilesChangePR.yml#L4).
We can configure the GitHub workflow based on Openj9 needs. If we have concerns with auto-triggered GitHub workflow, we can do comment-triggered GitHub workflow (same as the existing auto exclude test GitHub workflow) or comment-triggered Jenkins job (same as the existing PR builds). We can start with a comment-triggered workflow/Jenkins job. It will allow us to have better control.
Motivation:
The increasing number of tests we have is resulting in longer testing times for completing the full testing process. For instance, the sanity.functional test currently takes approximately 2 hours when run in parallel on 3 machines, while the sanity.system test takes around 3 hours under the same conditions. Additionally, there are long-running extended and special level tests to consider. Although one potential solution is to increase the number of machines in parallel to expedite testing turnover, this approach incurs additional costs in terms of machine resources and triaging efforts. Furthermore, it prompts us to question whether it is truly necessary to execute the complete set of tests, particularly for PR testing. In light of agile development practices and a fast Java release cadence, we must strive for greater effectiveness and efficiency in our testing process. We firmly believe that implementing change-based testing can enable us to test more effectively, reduce testing turnover time, and optimize machine resources and triaging efforts. In other words, we can adopt a laser-focused approach by conducting change-based testing specifically targeting a given PR. This approach will benefit both the contributor and the committer by saving valuable time.
Proposal:
Our proposal entails leveraging code coverage information to acquire and store code and test-related data. Subsequently, we will analyze each code change within a PR and suggest and execute relevant test(s) accordingly. Ideally, from a user perspective, when a PR is created in the Openj9 repository, a GitHub workflow will automatically run and analyze the associated git PRs, initiating the execution of the relevant test(s), and the result will be displayed on PR. The committers still have the choice of running more testing if needed.
Implementation:
Related to https://github.com/adoptium/aqa-tests/issues/4278