fix: SwiftPM checksum is SHA-256, smoke extracts only Quick start - #9
Merged
Merged
Conversation
…ck start
Two unrelated bugs surfacing as one red CI on main:
1) Package.swift's checksum was 128 hex chars — a SHA-512 — when
SwiftPM's binaryTarget API requires SHA-256 (64 hex). SwiftPM
accepted the value at parse time but rejected at fetch:
error: checksum of downloaded artifact of binary target 'PilotC'
(a59c9b99…25e) does not match checksum specified by the
manifest (2a39465a…020)
Recomputed via `swift package compute-checksum` and updated. The
right value is the one SwiftPM was already showing in the diff.
2) The smoke test's awk extracted the FIRST ```swift fenced block,
which on this README is the install snippet showing how to add
the package to a consumer's Package.swift. Concatenated with the
actual quickstart block below, the result was syntactically
broken Swift that swiftc couldn't compile.
Anchored the extraction to the `## Quick start` heading so only
the runnable block is picked. Exits with a clearer error if the
heading or its swift block ever moves.
Verified locally: `swift package compute-checksum Pilot.xcframework.zip`
returns the new value; the awk extracts exactly the 27 runnable lines.
The previous quoted heredoc (<<'PKG') left the literal string $GITHUB_WORKSPACE in the generated smoke Package.swift. SwiftPM threw: 'The folder "$GITHUB_WORKSPACE" doesn't exist.' Same workflow, separate bug from the checksum + awk fix in the parent commit. Discovered when CI re-ran after pushing this PR.
Contributor
Author
CI status updateAfter this PR's three fixes (checksum + awk + heredoc), main's two pre-existing failures are now down to one different pre-existing failure: Both are independent of this PR's value (the checksum fix is what blocks consumers from resolving the SwiftPM package at all; the smoke test was already red on main and would need additional work). Filing separately:
The |
3 tasks
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Two unrelated bugs surfacing as one red CI on main:
1. `Package.swift` checksum was a SHA-512, not SHA-256
SwiftPM's `binaryTarget` requires SHA-256 (64 hex chars). The previous value was 128 hex (a SHA-512), which SwiftPM accepts at parse time but rejects on fetch:
```
error: checksum of downloaded artifact of binary target 'PilotC'
(a59c9b99…25e) does not match checksum specified by the
manifest (2a39465a…020)
```
The error itself prints the value SwiftPM is expecting. Replaced with the SHA-256 returned by `swift package compute-checksum`.
2. Smoke test extracted the wrong code block
The smoke's `awk` matched the FIRST ```swift fence in the README — which is the install-instructions `Package.swift` snippet, not the runnable quickstart. Concatenated with the real quickstart, the output was syntactically invalid Swift that swiftc couldn't compile.
Anchored the extraction to the `## Quick start` heading so only the runnable block is picked. Exits with a clearer error if that heading or its swift block ever moves.
Test plan