Skip to content

Commit b6f601d

Browse files
dignifiedquireArquokdistribute
authored
feat: update to 1.0.0-rc.1 (#236)
* wip: start transition to 0.93 * chore: add normalized formatting * feat!: refactor to 1.0 API * ci: run on feat-1-0 + properly build/test kotlin and swift - add feat-1-0 to push triggers (run CI without a PR) + workflow_dispatch - swift: test-swift now assembles a self-contained macOS-only xcframework into IrohLib/artifacts (gitignored/absent on fresh checkout); full iOS+macOS xcframework build job + swift build smoke check - make_swift.sh: mkdir IrohLib/artifacts before copy; honor CARGO_TARGET_DIR - kotlin: Android cross-build job (cargo-ndk, 4 ABIs) + new kotlin-android cargo-make task, alongside the JVM gradle test job - js CI: enable corepack so yarn is on PATH - ci_js: use non-lts napi-rs docker images (current Rust, edition 2024) - Swatinem/rust-cache on heavy native jobs * test: add custom-preset tests in every binding Rust struct / Python subclass / JS function / Kotlin class / Swift protocol conformance, each implementing the Preset trait and binding an endpoint through it. * ci: build aarch64 linux with apt cross-gcc napi-cross's bundled gcc fails to assemble ring's armv8 .S. Install gcc-aarch64-linux-gnu and point CC/CXX/linker at it for the aarch64 gnu+musl targets while keeping napi-cross for the sysroot. * feat(services): use crates.io iroh-services + add tests in every binding - depend on published iroh-services =1.0.0-rc.0 instead of the git branch - rename ServicesClient::new -> create (uniffi-python can't do async 'new' constructors; named async classmethods work, like Endpoint.bind) - add services tests in Rust/Python/JS/Kotlin/Swift: a well-formed fake api secret boots the client (lazy connection, no network), and the credential validation (none / two / malformed) is exercised * fix(ci): build full xcframework for swift tests The hand-rolled single-slice macOS-only framework xcframework was not resolved by `swift test` on the CI runner (every C symbol "not in scope" because the `Iroh` clang module was silently dropped), while the proven multi-slice framework xcframework built by `make_swift.sh` passes there. Point `test-swift` at the full `swift-xcframework` build and collapse the two Swift CI jobs into one (full build + test). Drop the now-unused, trap-prone `bindgen-swift-macos` task. * fix(ci-js): build aarch64-musl with zig napi-cross has no aarch64-musl toolchain and napi sets LINKER=aarch64-linux-musl-gcc, which the apt gnu cross-gcc does not provide — the link step failed with "linker not found". Switch this target to cargo-zigbuild (`--zig`), the napi-rs-documented path for musl cross builds, which supplies a correct musl linker/libc. * refactor(swift): single root Package.swift Collapse the duplicated root + IrohLib/ manifests into one root manifest whose Iroh binaryTarget is env-switched: the pinned GitHub-release zip by default (consumers / Swift Package Index), or the locally built Iroh.xcframework when IROH_LOCAL_XCFRAMEWORK is set (dev / CI). This removes the silent drift between the two manifests — notably the shipped manifest was iOS-only and missing the SystemConfiguration / CoreWLAN linker settings, so the macOS slice did not link for consumers. The corrected platform list, linker settings and test target now live in exactly one place. test-swift runs at the repo root with the env set; make_swift.sh no longer needs the IrohLib/artifacts copy. * fix(ci-js): cross-compile aarch64-musl via zig shim napi-rs CLI 3.x has no --zig flag (Unknown Syntax Error). Drive the cross build through env instead: a tiny zig `cc -target aarch64-linux-musl` shim used as CC/CXX/linker, so the plain `cargo build` napi invokes cross-compiles with zig's bundled musl libc and assembler (also fixes ring's armv8 asm). No napi CLI flag or external musl toolchain mirror needed. * fix(swift): presence-based local xcframework selection Selecting the local xcframework via an env var only worked for swift test / CI; a GUI Xcode consumer pointing at a local checkout got the pinned remote release zip instead, then failed to compile the fresh 1.0-rc binding against the stale binary. Switch on the presence of the gitignored built marker (Iroh.xcframework/macos-arm64/Iroh.framework/Iroh), resolved via #filePath so it is CWD-independent. A built source checkout (local dev, CI, an app pointing at a local clone) gets the local xcframework; a fresh git-URL / Swift Package Index consumer falls through to the release zip. IROH_FORCE_REMOTE_XCFRAMEWORK forces the zip. Validated against the ios-motion-demo consumer. * chore(swift): resync tracked xcframework headers to 1.0-rc The committed xcframework-skeleton uniffi headers were a stale snapshot predating the ServicesClient::create rename. Regenerate them from the current API so the tracked skeleton matches the 1.0-rc surface. * fix(ci-js): strip Rust target triple in zig shim cc-rs appends --target=aarch64-unknown-linux-musl (the Rust triple) to the C compiler invocation; zig cc cannot parse it ("UnknownOperatingSystem") and the ring build failed. Filter any --target=* arg out of the shim before forcing zig's own -target aarch64-linux-musl. * fix(ci): run Swift tests via xcodebuild `swift test` (SwiftPM CLI) cannot form the `Iroh` clang module from the framework-bundle xcframework on the CI runner — every uniffi type ("RustBuffer", etc.) resolves as "not in scope" — while full Xcode consumes the same xcframework correctly (proven by the iOS demo and the prior swift build smoke). Drive the suite through `xcodebuild test` (scheme IrohLib, macOS arm64) so local and CI use the working toolchain. * fix(ci-js): build x86_64-musl with the zig shim x86_64-musl still used --use-napi-cross, whose host gcc produced a glibc-linked .node (test failed: needs ld-linux-x86-64.so.2 in the musl container). Switch it to the same zig-shim used by aarch64-musl, which on the prior run produced a static-musl binary that passed both build and the musl test job. Unifies both musl targets on zig. * fix(ci): target macOS for xcodebuild test + link Network.framework Two issues surfaced once xcodebuild started forming the Iroh module: - `-destination 'platform=macOS,arch=arm64'` matched nothing on the older CI Xcode, so it fell back to an iOS simulator. Use the portable canonical `platform=macOS` (no arch), which resolves to the Mac on every Xcode version. - iroh's netdev references Network.framework (nw_* / nw_path_monitor_*); the IrohLib target only linked SystemConfiguration + CoreWLAN, so the link failed. Link Network.framework (needed by iOS consumers too). Validated locally: xcodebuild test -scheme IrohLib -destination 'platform=macOS' builds for macOS and passes all 16 tests. * fix(ci): hermetic xcodebuild derived data for Swift tests The self-hosted CI runner reuses the shared DerivedData across runs, so xcodebuild relinked a stale extracted Iroh.framework from an earlier run (undefined uniffi_iroh_ffi_checksum_* symbols) instead of the freshly built xcframework. Run xcodebuild test with a clean repo-local -derivedDataPath so each run re-extracts the just-built xcframework. Validated locally: 16/16 tests pass via the exact CI invocation. * fix(ci): force native arm64 for Swift xcodebuild test The xcframework macOS slice is arm64-only, but the self-hosted runner (hetz-ci-mac-aarch64-1 — arm64 hardware) runs its Actions agent under Rosetta, so an unwrapped xcodebuild built x86_64 and failed to link the arm64 Iroh binary (every uniffi_* symbol undefined). Wrap the xcodebuild invocations in `arch -arm64` so the test build is native arm64 regardless of the agent's process arch (a no-op on a native runner). Log `uname -m` to confirm host arch. Validated locally: TEST SUCCEEDED, 16/16. * fix: swift builds & ci parallelism (#234) * feat(docs): self-hosted multi-language docs site + SPI manifest Phase 7. Self-host the API reference for all four bindings on GitHub Pages, with Swift additionally on the Swift Package Index: - Swift: xcodebuild docbuild + DocC static-hosting transform (make_swift_docs.sh), plus .spi.yml for the SPI mirror - JS: TypeDoc over the napi index.d.ts - Kotlin: Dokka v2 (dokkaGeneratePublicationHtml) - Python: pdoc over iroh.iroh_ffi - Landing: gen_landing.py renders site/index.html from support-matrix.yaml (matrix + per-language links) Unified under cargo-make (docs-* + docs-site aggregate) and deployed by .github/workflows/docs.yml on tag push or manual dispatch via actions/deploy-pages. * ci(docs): temporary feat-1-0 push trigger to validate the pipeline Revert before merging to main; docs deploy should stay tag/dispatch-only. * fix(ci-docs): pin setup-python to arm64 (Rosetta runner / maturin wheel ABI) * perf(ci-docs): parallelize docs into per-language jobs + macOS-only Swift slice Fan out Swift (macOS) / Python / JS / Kotlin / landing into independent jobs, assemble artifacts, then deploy — total time ~= slowest job, not the sum. Swift now builds only the macOS-arm64 framework slice (DocC never consumes the 3 iOS slices), cutting its Rust build from ~13min to ~3min. Python/JS/Kotlin move to Linux runners (also sidesteps the Rosetta wheel-ABI issue). * fix(ci-docs): tar-wrap Swift DocC artifact (upload-artifact rejects ':' filenames) * chore(ci): move to self hosted runners (#235) * chore(ci-docs): move to self-hosted runners + adopt PR #235 patterns Mirror PR #235 in docs.yml: all runners now [self-hosted, macOS, ARM64] or [self-hosted, linux, X64], Swatinem/rust-cache on every Rust-compiling job, and corepack enable on the JS job (self-hosted runners don't ship yarn). * fix(ci-js): force linux/amd64 for x86_64 test-bindings docker runs The self-hosted [linux,X64] runner also services arm64 binding-test jobs; `node:N-slim` in its Docker image cache may already be the arm64 variant of the multi-arch manifest. Without --platform, Docker reuses the cached variant and process.arch ends up reporting arm64, so napi-rs loads the wrong native binding ("Cannot find module @number0/iroh-linux-arm64-gnu"). The arm64/armv7 jobs already pass --platform explicitly; add the same to the two x86_64 jobs. * chore(ci): drop feat-1-0 from push branches; PR #236 handles it via pull_request With PR #236 open, every push to feat-1-0 fired both `push` and `pull_request` events. The concurrency group cancels one of the two, but it still churns the queue and wastes scheduler cycles on the already-contended self-hosted runners. Trigger feat-1-0 via PR only; keep main + tags on push so release/post-merge still fire. * chore(ci-js): drop x86_64-apple-darwin (not shipped, removes Rosetta flake) PR #235 already dropped macOS x86_64 from release.yml — we no longer ship that binary. The CI JS build/test matrix and universal-apple-darwin job were testing a target we don't publish, and the test-bindings step under Rosetta on the arm64 mac runner segfaults intermittently (yarn under Rosetta'd node@20). Remove the build/test matrix entries, the universal-macOS job, and the universal-apple-darwin napi target. * chore(ci): split monolithic ci.yml into per-language workflows Mirrors the existing ci_js.yml pattern — each language gets its own workflow file with the same triggers (workflow_dispatch + pull_request + merge_group + push:main) and concurrency group: ci.yml rust matrix + fmt/clippy/docs (Rust core) ci_python.yml python build & test ci_swift.yml full xcframework build & test ci_kotlin.yml JVM test matrix + Android cross-build ci_js.yml (existing) napi multi-target + tests, plus the cargo-make test-js macOS smoke test ("native-test") absorbed from ci.yml's `js` job Behavior is unchanged: jobs are copied verbatim with their original runners, steps, and timeouts. * feat(release): prepare-release mechanism + PyPI trusted publishing Phase 6, step 1+2. Two things land together because they share the same "manifest is self-consistent at every commit; CI never writes to main" constraint. scripts/release/bump_version.py — rewrites Cargo.toml [package].version, iroh-js/package.json version, and Package.swift releaseTag / releaseChecksum in surgical text edits. scripts/release/zip_xcframework.sh — produces a deterministic, byte-identical zip of Iroh.xcframework (fixed mtimes, sorted entries, zip -X). Verified locally: identical SHA-256 across runs. cargo make prepare-release <VERSION> — chains the above with cargo make swift-xcframework + Cargo.lock + yarn.lock refresh into a single local command that produces the release commit (macOS-only; needs Xcode). release.yml build-and-publish-swift now uses the same zip script so the SHA-256 it uploads matches what prepare-release baked into Package.swift. wheels.yml gains a publish job that downloads all wheel artifacts and pushes them to PyPI via pypa/gh-action-pypi-publish (Trusted Publishing / OIDC, id-token: write — no long-lived token). Gated on push: tags: v*. RELEASING.md documents the 5-step release procedure + the why behind the local-only prepare model (matches firebase-ios-sdk / Sentry-Cocoa convention for binary SwiftPM packages). * feat(kotlin): expose Android JNI context init via IrohAndroid (#237) * fix(kotlin): add Android stubs as compileOnly so JVM build resolves Context IrohAndroid.kt (PR #237) imports android.content.Context — that symbol isn't on the JVM classpath, so compileKotlin failed for the JVM library. The Android stubs jar is a compile-time-only dep: the published JAR doesn't ship it, Android apps get the real Context at runtime, and JVM consumers (who never call IrohAndroid) ignore the unloaded class. * fix(kotlin): defer uniffi android codegen until Android-library multi-module split PR #237 flipped `android = true` in uniffi.toml, which makes uniffi-kotlin inject `androidx.annotation.RequiresApi` and `Build.VERSION_CODES.UPSIDE_DOWN_CAKE` (API 34) into the generated iroh_ffi.kt. Those references don't resolve under the pure JVM `java-library` plugin — supporting them properly requires kotlin/lib to be split into a JVM module + a com.android.library AAR module. PR #237's actual feature (IrohAndroid.installAndroidContext + the Rust JNI glue in src/android_init.rs) works without the uniffi flag. * refactor: address PR #236 review feedback Two unrelated comments from okdistribute on PR #236, batched because they're both small surface changes touching tests + a demo file. - rename EndpointTicket::new -> EndpointTicket::from_addr and EndpointTicket::parse -> EndpointTicket::from_string so the uniffi side matches the JS binding (which already exposes fromAddr / fromString) and so the two constructors are clearly distinguished by name rather than positional. All 4 binding test suites updated. - python/main.py: drop client/server framing for peer-to-peer wording (subcommand 'serve' -> 'accept'; 'server received'/'client received' prints -> 'echo side'/'dial side'). Docstring rewritten accordingly. * refactor: hex helper, signed counters, EndpointTicket error test (PR #236) * fix(keys): export Eq+Hash for EndpointId/Signature, drop .equal() (PR #236) * fix(keys): JS isEqual -> equals; EndpointAddr exports Eq+Hash, drops .equal() (PR #236) * style: rustfmt close() let-binding * style: derive PartialEq on EndpointId (clippy: derived Hash + manual PartialEq) * feat(kotlin-maven): vanniktech publish plugin + computer.iroh coordinates * feat(kotlin-maven): real publish job — cross-build cdylibs + gradle Central publish * feat(release): cargo make pre-release-check (local dry-run before tagging) * fix(kotlin-maven): Vanniktech 0.34 publishToMavenCentral API (no SonatypeHost arg) * fix(release): pre-release-check provisions maturin venv; never skip steps * fix(release): pre-release-check writes wheel to explicit --out (custom CARGO_TARGET_DIR) * fix(release): reference rsop key file, not gpg, for local signing dry-run * deps: bump iroh to 1.0.0-rc.1, iroh-services to 1.0.0-rc.2 * feat(path): expose local_addr on PathEvent::{Opened,Closed,Selected} * chore(iroh-js): sync npm sub-packages + optionalDependencies to 0.35.0 * chore(bindgen): regenerate kotlin + js bindings for PathEvent.local_addr * ci(docs): drop temp feat-1-0 push trigger (tag/dispatch only) * docs(readme): describe 1.0 surface, Maven Central, docs site, cargo-make --------- Co-authored-by: Asmir Avdicevic <asmir.avdicevic64@gmail.com> Co-authored-by: rae <633012+okdistribute@users.noreply.github.com>
1 parent c96e428 commit b6f601d

127 files changed

Lines changed: 29211 additions & 63705 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 29 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,177 +1,60 @@
11
name: CI
22

3+
# Rust core only — per-language CI lives in sibling workflows:
4+
# ci_python.yml, ci_swift.yml, ci_kotlin.yml, ci_js.yml
5+
36
on:
7+
workflow_dispatch:
48
pull_request:
59
merge_group:
610
push:
711
branches:
812
- main
913

1014
concurrency:
11-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
15+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
1216
cancel-in-progress: true
1317

1418
env:
1519
IROH_FORCE_STAGING_RELAYS: "1"
1620

1721
jobs:
18-
build_and_test_rust:
22+
rust:
1923
runs-on: ${{ matrix.runner }}
2024
timeout-minutes: 30
21-
name: Rust - Build and test
25+
name: Rust - ${{ matrix.name }}
2226
strategy:
2327
fail-fast: false
2428
matrix:
2529
name: [ubuntu-latest, macOS-arm-latest, windows-latest]
26-
rust: [stable]
2730
include:
2831
- name: ubuntu-latest
29-
os: ubuntu-latest
30-
release-os: linux
31-
release-arch: amd64
32-
runner: [linux, X64]
32+
runner: [self-hosted, linux, X64]
3333
- name: macOS-arm-latest
34-
os: macOS-latest
35-
release-os: darwin
36-
release-arch: aarch64
37-
runner: [macOS, ARM64]
34+
runner: [self-hosted, macOS, ARM64]
3835
- name: windows-latest
39-
os: windows
4036
runner: [windows-latest]
41-
4237
steps:
43-
- name: Checkout
44-
uses: actions/checkout@master
45-
with:
46-
submodules: recursive
47-
48-
- name: Install ${{ matrix.rust }}
49-
uses: dtolnay/rust-toolchain@master
50-
with:
51-
toolchain: ${{ matrix.rust }}
52-
53-
- name: cargo test
54-
run: cargo test
55-
56-
check_fmt_and_docs:
57-
timeout-minutes: 30
58-
name: Checking fmt and docs
59-
runs-on: ubuntu-latest
60-
steps:
61-
- uses: actions/checkout@master
62-
- uses: dtolnay/rust-toolchain@stable
63-
with:
64-
components: rustfmt
65-
- name: fmt
66-
run: cargo fmt -- --check
67-
- name: Docs
68-
run: cargo doc --all-features --no-deps --document-private-items
69-
70-
clippy_check:
38+
- uses: actions/checkout@master
39+
with:
40+
submodules: recursive
41+
- uses: dtolnay/rust-toolchain@stable
42+
with:
43+
components: rustfmt, clippy
44+
- uses: davidB/rust-cargo-make@v1
45+
- name: cargo make test-rust
46+
run: cargo make test-rust
47+
48+
fmt-clippy-docs:
7149
timeout-minutes: 30
50+
name: fmt + clippy + docs
7251
runs-on: ubuntu-latest
7352
steps:
74-
- uses: actions/checkout@master
75-
- uses: dtolnay/rust-toolchain@stable
76-
with:
77-
components: clippy
78-
79-
- name: clippy check
80-
run: cargo clippy --all-targets --bins --tests --benches
81-
82-
build_and_test_python:
83-
name: Python - Build and test
84-
timeout-minutes: 30
85-
runs-on: [linux, x64]
86-
steps:
87-
- uses: actions/checkout@master
88-
- uses: dtolnay/rust-toolchain@stable
89-
- uses: actions/setup-python@v5
90-
with:
91-
python-version: 3.12
92-
- name: Install virtualenv
93-
run: pip install virtualenv
94-
- name: Python tests
95-
run: |
96-
virtualenv venv
97-
source venv/bin/activate
98-
pip install setuptools pytest pytest-asyncio "maturin[patchelf]" uniffi-bindgen
99-
maturin develop
100-
pytest -v
101-
102-
build_and_test_swift:
103-
name: Swift - Build and test
104-
timeout-minutes: 30
105-
runs-on: [macOS, ARM64]
106-
steps:
107-
- uses: actions/checkout@master
108-
- uses: dtolnay/rust-toolchain@stable
109-
with:
110-
targets: aarch64-apple-ios,aarch64-apple-ios-sim,x86_64-apple-ios,aarch64-apple-darwin
111-
- name: Swift tests
112-
run: |
113-
./make_swift.sh
114-
cp -R Iroh.xcframework IrohLib/artifacts/
115-
cd IrohLib
116-
swift test
117-
118-
build_and_test_kotlin:
119-
runs-on: ${{ matrix.runner }}
120-
timeout-minutes: 30
121-
name: Kotlin - Build and test
122-
strategy:
123-
fail-fast: false
124-
matrix:
125-
name: [ubuntu-latest, macOS-arm-latest]
126-
rust: [stable]
127-
include:
128-
- name: ubuntu-latest
129-
os: linux
130-
release-os: linux
131-
release-arch: amd64
132-
runner: [linux, X64]
133-
- name: macOS-arm-latest
134-
os: mac
135-
release-os: darwin
136-
release-arch: aarch64
137-
runner: [macOS, ARM64]
138-
# - name: windows-latest
139-
# os: windows
140-
# runner: [windows-latest]
141-
142-
steps:
143-
- name: Checkout
144-
uses: actions/checkout@master
145-
with:
146-
submodules: recursive
147-
148-
- name: Install ${{ matrix.rust }}
149-
uses: dtolnay/rust-toolchain@master
150-
with:
151-
toolchain: ${{ matrix.rust }}
152-
153-
- name: setup java
154-
uses: actions/setup-java@v4
155-
with:
156-
distribution: 'temurin' # See 'Supported distributions' for available options
157-
java-version: '21'
158-
159-
- name: install kotlin
160-
uses: arqu/setup-kotlin@main
161-
162-
- name: install ktlint
163-
uses: arqu/action-ktlint-setup@main
164-
165-
- name: Setup Gradle
166-
uses: gradle/actions/setup-gradle@v4
167-
168-
- name: build kotlin
169-
env:
170-
TEST_OS: ${{ matrix.os }}
171-
shell: bash
172-
run: ./make_kotlin.sh
173-
174-
- name: Gradle Test
175-
run: |
176-
cd kotlin
177-
./gradlew test
53+
- uses: actions/checkout@master
54+
- uses: dtolnay/rust-toolchain@stable
55+
with:
56+
components: rustfmt, clippy
57+
- uses: davidB/rust-cargo-make@v1
58+
- run: cargo make format-check
59+
- run: cargo make clippy
60+
- run: cargo make docs

0 commit comments

Comments
 (0)