ahoppen
(Alex Hoppen)
1
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:
- Update swift-format to depend on SwiftSyntax’s master branch
- Make all
@testable imports in swift-format’s test normal imports, making all necessary types and methods public [1]
- Depend on local dependencies if the
SWIFTCI_USE_LOCAL_DEPS environment flag is specified
- Add a
build-script-helper.py script to the package which can be invoked by the build-script in the main Swift repository
- Add
swift-format as a product to Swift’s swift_build_support
- Create a preset for PR testing in the swift-format repository
- 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
- After verifying that the CI works on the swift-format repository using a dummy PR, update the presets to test swift-format as a downstream dependency of SwiftSyntax
- As a starting point, it would be a good idea to test it everywhere
swift-evolve is being tested
- If
swift-format should also be tested on Linux, it needs to be added to the corresponding Linux bots as well
[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
allevato
(Tony Allevato)
2
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.
ahoppen
(Alex Hoppen)
3
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.
dylansturg
(Dylan Sturgeon)
4
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
blangmuir
(Ben Langmuir)
5
We can break this down into:
- Update the
update-checkout configuration. This is something you can do in a PR.
- Update bots to checkout swift-format (some of our bots don't use update-checkout for security reasons).
- 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)?
dylansturg
(Dylan Sturgeon)
6
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.
blangmuir
(Ben Langmuir)
8
My mistake, I didn't realize this had already been done.
dylansturg
(Dylan Sturgeon)
9
Are there any updates regarding the CI bots?
Swift CI development (master) jobs are configured to checkout swift-format with master branch.
1 Like
allevato
(Tony Allevato)
12
@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.