Repository navigation
docs: every README example compiles, and CI keeps it that way - #219
Merged
Merged
Conversation
Four README snippets did not compile: Transform's arguments out of order,
.speed(0.5) instead of .speed(.flat(0.5)), an array mapped inside Video {},
and an undefined MultiplyBlend. Tools/readme-snippets.sh copies each Swift
block into Examples/ReadmeSnippets.swift so the Examples target compiles it;
CI fails if that copy is stale.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four README examples did not compile. They now do, and CI compiles every Swift block in the README from here on.
Fixed in the README
Transform(scale:center:)→Transform(center:scale:). The initialiser takescenterfirst..speed(0.5)→.speed(.flat(0.5)).Video { urls.map { VideoClip(url: $0) } }→Video { for url in urls { VideoClip(url: url) } }.MultiplyBlend()without defining it. The block now defines it, using the code from theMultiInputCompositordoc comment.let urleight times, so it could not compile as written. It is now one block per recipe, each with a heading.How it stays fixed
Tools/readme-snippets.shcopies each ```swift block intoExamples/ReadmeSnippets.swift, one function per block. `swift test` already builds the `Examples` target, so a broken example fails the build.Tools/readme-snippets.sh --check, fails if that file is out of date.Package.swiftsnippet) opt out with<!-- readme-snippets: skip -->.Examples/ReadmeSnippetAssets.swift. That file also checks the before/after table by hand, because the table is inline code.Verified
.speed(0.5)back is caught twice: the drift check flags the stale file, and the build fails after regenerating.Examples/failsswift build --build-tests, which confirms CI compiles the target.swift build --target KadrExamplesis clean, with no warnings from the new files.No library code changes.