Testing swift-format as part of Swift’s CI infrastructure

In the last couple of weeks, we have made changes to the Swift testing infrastructure that allow testing dependent projects of SwiftSyntax without needing to rebuild SwiftSyntax. As a result, it would now be possible to test swift-format as part of the Swift CI testing infrastructure.

Integrating swift-format with the Swift CI infrastructure would allow PR testing on the apple/swift-format repository. Additionally, swift-format would be tested as part of Swift’s continuous integration jobs, ensuring that no change to the master branch of SwiftSyntax or the Swift compiler will break the master branch of swift-format.

The integration comes with the expectation that developers of swift-format take active part in fixing CI issues in a timely manner. Because of this, we leave it up to you to decide when and if the CI integration should be pushed forward. I have composed a list of the items below that need to be done in order to get the CI integration working:

[1] We are only building SwiftSyntax once without testability enabled, because that’s the version we are installing in the toolchain. SwiftPM does not support building targets with different build configurations, so we cannot build swift-format with testability enabled.

CC @allevato

8 Likes

Thanks for the detailed steps, Alex! Having swift-format integrated into the rest of the CI pipeline and getting PR testing will be a great improvement to our workflows.

Since we'll need some time to migrate to the latest SwiftSyntax API changes that were recently pushed, I think we'll tentatively aim to work on this after Thanksgiving.

Sounds like a good plan to me. Please let me know if you run into any questions during the integrations and I should be able to help you out.

My PR to create a testing preset for macOS and Linux was just submitted. It looks like we're ready for this step:

Let us know that you have completed the above steps, so swift-format can be added to the checkout on the CI bots and CI testing for the swift-format repository can be enabled

@ahoppen @akyrtzi Can someone add swift-format to the checkout on the CI bots?

1 Like

We can break this down into:

  1. Update the update-checkout configuration. This is something you can do in a PR.
  2. Update bots to checkout swift-format (some of our bots don't use update-checkout for security reasons).
  3. Add PR test bots for swift-format using the new presets added in Add a build product and presets for swift-format. by dylansturg · Pull Request #32546 · apple/swift · GitHub

@mishal_shah can you help us with (2) and (3)?

Update the update-checkout configuration. This is something you can do in a PR.

It looks like swift-format is already included in the update-checkout workflow. What else needs to be done for this?

I will update the CI bots next week to checkout swift-format.

My mistake, I didn't realize this had already been done.

Are there any updates regarding the CI bots?

Swift CI development (master) jobs are configured to checkout swift-format with master branch.

1 Like

Thank you!

@mishal_shah I noticed in recent CI logs that swift-format was being checked out, but should @swift-ci please test also be working now on the swift-format repo? I just tried it on this PR but I haven't seen any activity from it.