8000 ci: consumer-test the Swift package, before tagging and after publishing by adityamukho · Pull Request #8 · project-minigraf/minigraf-swift · GitHub
[go: up one dir, main page]

Skip to content

ci: consumer-test the Swift package, before tagging and after publishing - #8

Merged
adityamukho merged 2 commits into
mainfrom
ci/consumer-tests
Oct 21, 2026
Merged

adityamukho merged 2 commits into
mainfrom
ci/consumer-tests

Conversation

@adityamukho
@adityamukho adityamukho commented Oct 21, 2026 •
Copy link
Copy Markdown
Contributor

Step 7 of the binding consumer tests plan (minigraf docs/superpowers/plans/2026-10-20-binding-consumer-tests.md).

What

  • package.yml (macos-14): runs the device, simulator and lipo builds, bindgen and -create-xcframework. It uploads dist-xcframework, which holds MinigrafKit-v<version>.xcframework.zip and Sources/minigraf_ffi.swift.
  • consumer-test/run.sh local <dist> <version> | registry <version> sets up an empty SPM app package (consumer-test/App) that depends on minigraf-swift. Then it runs swift package resolve and xcodebuild test on the newest available iPhone simulator.
    • local: assembles the tree the release commits to swift-releases: this repo's Package.swift and Sources/MinigrafKit, the generated Swift, and the xcframework by path:.
    • registry: .package(url:, exact:); also checks that Package.resolved pins the version under test.
    • Tests: QuickstartTests is the README quick start line for line (readme-sync). ContractTests covers in-memory, file-backed with a reopen, and the error type (MiniGrafError carrying a [XXX-NNN] code).
  • ci.yml: the package, consumer and readme-sync jobs replace the iOS simulator smoke build.
  • release.yml:
    • test passes version.
    • publish (now on ubuntu-latest) downloads dist-xcframework and computes the checksum from the tested zip, then writes swift-releases, tags it and uploads that zip. It doesn't rebuild.
    • prepare also stamps the README install version.
    • verify-published runs after the upload.
  • verify-published.yml: registry mode on macos-14, plus the release-broken report job.

Fix found by the test: no release up to 2.0.8 compiles

A temporary CI job resolved the published 2.0.8 (exact:). It failed to build with minigraf_ffi.swift:14:23: error: cannot find type 'RustBuffer' in scope, and the same for ForeignBytes, RustCallStatus and every FFI symbol.

The cause: the xcframework's Headers/ held the module map under its generated name, minigraf_ffiFFI.modulemap. Clang finds a module in a header directory only through module.modulemap, so #if canImport(minigraf_ffiFFI) was false and the import was skipped. Now:

  • the module map is copied as module.modulemap;
  • Sources/MinigrafKit gets only the .swift file;
  • publish replaces the target's files on swift-releases, so the old .h and .modulemap don't linger.

With that, the iOS simulator run passes all 4 tests (run 39545941139). The temporary job was removed before the final commit. The README now says releases up to v2.0.8 don't compile.

Deviations from the plan

  • Local mode uses .package(path:) to the assembled tree, with binaryTarget(path:) inside it, instead of unzipping into the app package. That way it tests the Package.swift and Sources/ that users get.
  • No installed-version check in local mode: a path dependency has no version. The zip name must carry the version, and registry mode checks Package.resolved.

After merge, verify-published -f version=2.0.8 should fail and open the release-broken issue, which stays open until 2.0.9 verifies.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz

package.yml builds the xcframework zip and the generated Swift sources
exactly as the release publishes them. The consumer test assembles the
package swift-releases will carry, adds it to an empty SPM app package, and
runs the README quick start and the consumer contract with xcodebuild test on
an iOS simulator. The release tests these files at the release version and
publishes exactly them (the checksum comes from the tested zip);
verify-published.yml resolves the published version with SPM afterwards and
opens a release-broken issue on failure.

Fix found by the test: no release up to 2.0.8 compiled. The xcframework's
module map was named minigraf_ffiFFI.modulemap, which Clang never finds, so
`canImport(minigraf_ffiFFI)` was false and minigraf_ffi.swift failed with
"cannot find type 'RustBuffer' in scope". It is now module.modulemap, and
Sources/MinigrafKit gets only the Swift file; swift-releases drops the stale
header and module map. The release also stamps the README install version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz
@adityamukho
adityamukho marked this pull request as ready for review October 21, 2026 04:56
@adityamukho
adityamukho merged commit 43ca1f9 into main Oct 21, 2026
4 checks passed
@adityamukho
adityamukho deleted the ci/consumer-tests branch October 21, 2026 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0