Integrating swift-format with Swift CI infrastructure

Hey @allevato, I'm starting this thread to discuss about what needs to be done to integrate swift-format with the rest of the Swift CI machinery.

As a first step @mishal_shah already added the repo to the list of swift repos for cloning via utils/update-checkout. The next step will be to add the capability for swift/utils/build-script to be able to build swift-format along with the rest of the repos.

I had a brief discussion with @blangmuir and we recommend to follow the example of the SourceKit-LSP project for how to setup building via the build-script. On a high-level, swift-format's Package.swift should declare the dependency to swift-syntax differently depending on whether it is invoked by build-script or not. Normally it should have a dependency against a tag of swift-syntax, but if it is invoked via build-script it should setup a local dependency (find the swift-syntax repo next to the swift-format one). What we are going for is that the CI build will ensure that everything builds correctly against the master branch of each repo.

swift-format should also have a build-script helper script that will prepare things properly, for example it will de-gyb the source files from the local swift-syntax repo before starting the build for swift-format.

Hopefully there's enough info to get started, if you have any questions let us know!

3 Likes

Thanks for the pointers! I'll start looking into this ASAP.