This is an archive of the discontinued LLVM Phabricator instance.

Implement the monolithic CI pipeline in the monorepo
ClosedPublic

Authored by ldionne on Aug 25 2023, 10:19 AM.

Details

Summary

This basically inlines the logic that was previously located in
https://github.com/google/llvm-premerge-checks so it is part of
the monorepo. This has the benefit of making it extremely easy
for individual projects to understand and modify this logic for
their own needs, unlike the current model where this logic lives
in a separate non-LLVM repository.

It also allows testing changes to the CI configuration using a simple
Phabricator review, since the code that defines the CI pipeline is taken
from the patch under review.

This (or something equivalent) is necessary if we want to retain the
current monolithic pre-commit CI throughout the GitHub PR transition.
Since triggering the monolithic CI is currently attached to the system
we use for triggering CI pipelines from Phabricator, we will lose that
part of the CI when we move to GitHub PRs if we don't do anything.

I've decided to rewrite the code as a shell script because the logic
was fairly simple and it seemed a lot easier than figuring out how to
pull only the relevant parts of llvm-premerge-checks into the monorepo.
Furthermore, I think we should strive to move away from the monolithic
CI altogether since sub-projects should understand, own and maintain the
tests that are relevant for them to run in the CI (with LLVM providing
the infrastructure). Hence, this is somewhat of a temporary solution
until monolithic CI is removed entirely.

Diff Detail

Event Timeline

ldionne created this revision.Aug 25 2023, 10:19 AM
Herald added a project: Restricted Project. · View Herald Transcript
ldionne requested review of this revision.Aug 25 2023, 10:19 AM
Herald added a project: Restricted Project. · View Herald Transcript
ldionne updated this revision to Diff 553556.Aug 25 2023, 11:38 AM

Use bash instead of zsh

ldionne updated this revision to Diff 553558.Aug 25 2023, 11:45 AM

Touch a file in a project to avoid tripping up the premerge_checks.py script

Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2023, 11:45 AM
ldionne updated this revision to Diff 553565.Aug 25 2023, 11:56 AM

Try again

I assume you've tried to run it, right? Otherwise I can try setting up PRs.

scripts for generic linux windows look fine, I will probably need to tune them up a bit afterwards

.ci/generate-buildkite-pipeline-premerge
163

do I understand correctly that if mlir and libcxx modified then only libcxx will be run as SPECIFIC_PIPELINE_AVAILABLE=1?

also, why do we need lld/bar etc.?

goncharov accepted this revision.Aug 28 2023, 10:09 AM
This revision is now accepted and ready to land.Aug 28 2023, 10:09 AM

as for project specific CIs - maybe, it's debatable. I understand that some projects might want to go extra mile, it's OK. Yet running "configure all + ninja check-all" should work and provide good coverage without much thoughts and tweaks

ldionne marked an inline comment as done.Aug 28 2023, 11:04 AM

also, why do we need lld/bar etc.?

This is temporary, it's just to trigger the builds of these projects!

I assume you've tried to run it, right?

Yes, I did run the pipeline for MLIR, LLD, LLVM by triggering them in this review.

.ci/generate-buildkite-pipeline-premerge
163

Yes. This corresponds to the current logic as well. Basically if a project has some custom CI set up, we don't want to also run the general CI since that's just a waste of resources.

ldionne updated this revision to Diff 554016.Aug 28 2023, 12:44 PM
ldionne marked an inline comment as done.

Test building all projects.

Herald added a reviewer: rafauler. · View Herald Transcript
Herald added a reviewer: Amir. · View Herald Transcript
Herald added a reviewer: maksfb. · View Herald Transcript
Herald added projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project. · View Herald Transcript
Herald added a reviewer: Restricted Project. · View Herald Transcript
This revision now requires review to proceed.Aug 28 2023, 12:44 PM

Sorry for spamming everyone, I'm trying to ensure that the CI will work with all the sub-projects in the monorepo once we move to GH PRs.

goncharov added inline comments.Aug 29 2023, 12:40 AM
.ci/generate-buildkite-pipeline-premerge
163

The previous logic was that we caclulated first all projects that might be affected by current set (e.g. mlir is affected by llvm), then we added add dependencies.
So e.g. if mlir was modified, we should add "flang" to test set and then add "llvm clang" as dependincies, resutling in "mlir flang llvm clang" set. I can re-implement this logic later here no problem.
Also, it seems incorrect to only run "libc++" tests if libc++ was modified among other things. E.g. if something has touched libc++ and mlir than mlir should still run.

ldionne marked an inline comment as done.Aug 29 2023, 6:49 AM
ldionne added inline comments.
.ci/generate-buildkite-pipeline-premerge
163

Ah, I see. Yeah I guess that makes sense. I'll update this review with the updated logic.

Also, it seems incorrect to only run "libc++" tests if libc++ was modified among other things. E.g. if something has touched libc++ and mlir than mlir should still run.

You're right, I guess in that case we should run both jobs. I'll remove the check.

ldionne updated this revision to Diff 554420.Aug 29 2023, 10:27 AM
ldionne marked an inline comment as done.

Address review comments. I did some testing using GH PRs and this should work, but some tweaks might be necessary. After discussing with Mikhail, I'll merge this now and we can make tweaks and fixes on top of it.

ldionne accepted this revision as: Restricted Project.Aug 29 2023, 10:31 AM
This revision is now accepted and ready to land.Aug 29 2023, 10:31 AM
This revision was landed with ongoing or failed builds.Aug 29 2023, 10:31 AM
This revision was automatically updated to reflect the committed changes.