Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: CI

# Unless we are on the main branch, the workflow should stop and yield to a new run if new code is pushed.
concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.sha || github.ref }}
cancel-in-progress: ${{ !contains(github.ref, 'main')}}

on:
push:
branches: [main]
Expand Down Expand Up @@ -56,6 +61,41 @@ jobs:
- name: Run Swift foreign binding tests
run: ./swift/test_swift.sh

- name: Install SwiftLint
run: |
brew install swiftlint

- name: Lint Swift Tests
run: swiftlint swift/tests

kotlin-build-and-test:
name: Kotlin Build & Foreign Binding Tests
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.92.0

- name: Build and test Kotlin bindings
run: ./kotlin/test_kotlin.sh

- name: Install ktlint
run: |
curl -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint &&
chmod a+x ktlint &&
sudo mv ktlint /usr/local/bin/

- name: Lint Kotlin Tests
run: |
ktlint kotlin/walletkit-tests/src/test/kotlin

test:
name: Tests
runs-on: ubuntu-latest
Expand Down Expand Up @@ -112,7 +152,7 @@ jobs:
- uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check ${{ matrix.checks }}
rust-version: stable
rust-version: 1.92.0

docs:
name: Check docs
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/initiate-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@ jobs:
env:
BUMP_TYPE: ${{ github.event.inputs.bump_type }}
run: |
# Get current version from Cargo.toml
CURRENT_VERSION=$(grep -m 1 'version = ' Cargo.toml | cut -d '"' -f 2)
# Get current version from workspace package in Cargo.toml
CURRENT_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.workspace_members[0]' | cut -d '#' -f2)

# Ensure CURRENT_VERSION is in semantic versioning format
if [[ ! "$CURRENT_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "CRITICAL ERROR: CURRENT_VERSION '$CURRENT_VERSION' is not in semantic versioning format (MAJOR.MINOR.PATCH)."
exit 1
fi

cargo metadata --no-deps --format-version 1 | jq -r '.workspace_members'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug cargo metadata print left in release workflow

Low Severity

The line cargo metadata --no-deps --format-version 1 | jq -r '.workspace_members' prints workspace members to stdout without storing or using the result. This looks like a leftover debug statement that was not removed before committing.

Fix in Cursor Fix in Web


# Split version into components
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"

Expand Down
31 changes: 14 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ jobs:
components: rustfmt

- name: Build the project (iOS)
run: ./build_swift.sh
run: ./swift/build_swift.sh

- name: Compress XCFramework binary
run: |
zip -r WalletKit.xcframework.zip WalletKit.xcframework
zip -r WalletKit.xcframework.zip swift/WalletKit.xcframework
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zip embeds XCFramework under nested path breaking SPM

High Severity

The zip command zip -r WalletKit.xcframework.zip swift/WalletKit.xcframework stores the framework inside the archive under the path swift/WalletKit.xcframework/.... Swift Package Manager binary targets require the .xcframework bundle to be at the root of the zip archive. Since it's now nested under swift/, SPM won't locate the framework when consumers resolve the package, breaking the entire Swift release distribution.

Fix in Cursor Fix in Web


- name: Checkout swift repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -112,11 +112,11 @@ jobs:

run: |
# Copy non-binary source files
cp -r Sources/ target-repo/Sources
cp -r swift/Sources/ target-repo/Sources

# Prepare Package.swift
brew install swiftlint
./archive_swift.sh --asset-url "$ASSET_URL" --checksum "$CHECKSUM" --release-version "$NEW_VERSION"
./swift/archive_swift.sh --asset-url "$ASSET_URL" --checksum "$CHECKSUM" --release-version "$NEW_VERSION"
cp Package.swift target-repo/

# Commit changes
Expand Down Expand Up @@ -210,7 +210,7 @@ jobs:

- name: Move artifacts
run: |
mkdir -p kotlin/lib/src/main/jniLibs && cd kotlin/lib/src/main/jniLibs
mkdir -p kotlin/walletkit-android/src/main/jniLibs && cd kotlin/walletkit-android/src/main/jniLibs
mkdir armeabi-v7a arm64-v8a x86 x86_64
mv /home/runner/work/walletkit/walletkit/android-armv7-linux-androideabi/libwalletkit.so ./armeabi-v7a/libwalletkit.so
mv /home/runner/work/walletkit/walletkit/android-aarch64-linux-android/libwalletkit.so ./arm64-v8a/libwalletkit.so
Expand All @@ -219,11 +219,11 @@ jobs:

- name: Generate bindings
working-directory: kotlin
run: cargo run -p uniffi-bindgen generate ./lib/src/main/jniLibs/arm64-v8a/libwalletkit.so --library --language kotlin --no-format --out-dir lib/src/main/java
run: cargo run -p uniffi-bindgen generate ./walletkit-android/src/main/jniLibs/arm64-v8a/libwalletkit.so --library --language kotlin --no-format --out-dir walletkit-android/src/main/java

- name: Publish
working-directory: kotlin
run: ./gradlew lib:publish -PversionName=${{ needs.pre-release-checks.outputs.new_version }}
run: ./gradlew walletkit-android:publish
env:
GITHUB_ACTOR: wld-walletkit-bot
GITHUB_TOKEN: ${{ github.token }}
Expand All @@ -243,16 +243,13 @@ jobs:
make_latest: true

- name: Create Release in swift repo
uses: softprops/action-gh-release@v2
with:
repository: worldcoin/walletkit-swift
token: ${{ secrets.WALLETKIT_BOT_TOKEN }}
name: ${{ needs.pre-release-checks.outputs.new_version }}
tag_name: ${{ needs.pre-release-checks.outputs.new_version }}
body: |
## Version ${{ needs.pre-release-checks.outputs.new_version }}
For full release notes, see the [main repo release](https://github.com/worldcoin/walletkit/releases/tag/${{ needs.pre-release-checks.outputs.new_version }}).
make_latest: true
env:
GH_TOKEN: ${{ secrets.WALLETKIT_BOT_TOKEN }}
run: |
gh release edit ${{ needs.pre-release-checks.outputs.new_version }} \
--repo worldcoin/walletkit-swift \
--draft=false \
--latest

publish-to-crates-io:
needs: [pre-release-checks, create-github-release]
Expand Down
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ target/
# Swift build outputs are not committed to this repo.
WalletKit.xcframework/
Sources/
swift/WalletKit.xcframework/
swift/Sources/
swift/ios_build/
swift/local_build/
swift/tests/Sources/
swift/tests/.build/

# Kotlin bindings and native libs
kotlin/libs/
kotlin/walletkit-android/src/main/java/uniffi/
kotlin/walletkit-tests/build/

.build/

Expand All @@ -21,4 +32,8 @@ Sources/
cache/
**/out/build-info

# Allow storage cache module sources.
!walletkit-core/src/storage/cache/
!walletkit-core/src/storage/cache/**

# NOTE: Cargo.lock is not ignored because it is used for FFI builds (Swift & Kotlin)
Loading