Skip to content

Commit 8d47479

Browse files
committed
Test XCFramework
1 parent b6995f5 commit 8d47479

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// XCFrameworkTests.swift
3+
// 21-DOT-DEV/swift-secp256k1
4+
//
5+
// Copyright (c) 2025 GigaBitcoin LLC
6+
// Distributed under the MIT software license
7+
//
8+
// See the accompanying file LICENSE for information
9+
//
10+
11+
import P256K
12+
import Testing
13+
14+
struct XCFrameworkTestSuite {
15+
16+
@Test("Compressed Key pair test with raw data")
17+
func compressedKeypairImplementationWithRaw() {
18+
let expectedPrivateKey = "7da12cc39bb4189ac72d34fc2225df5cf36aaacdcac7e5a43963299bc8d888ed"
19+
let expectedPublicKey = "023521df7b94248ffdf0d37f738a4792cc3932b6b1b89ef71cddde8251383b26e7"
20+
let privateKeyBytes = try! expectedPrivateKey.bytes
21+
let privateKey = try! secp256k1.Signing.PrivateKey(dataRepresentation: privateKeyBytes)
22+
23+
#expect(String(bytes: privateKey.dataRepresentation) == expectedPrivateKey)
24+
#expect(String(bytes: privateKey.publicKey.dataRepresentation) == expectedPublicKey)
25+
}
26+
}

bitrise.yml

+30-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ workflows:
132132
-scheme "$SCHEME" \
133133
-configuration "$CONFIGURATION" \
134134
-destination "generic/platform=$PLATFORM" \
135-
-archivePath "$ARCHIVE_DIR/P256K-$PLATFORM.xcarchive" | xcbeautify
135+
-archivePath "$ARCHIVE_DIR/P256K-$PLATFORM.xcarchive"| xcbeautify
136136
137137
# Check if archive command was successful
138138
if [ $? -eq 0 ]; then
@@ -162,6 +162,35 @@ workflows:
162162
inputs:
163163
- deploy_path: "$BITRISE_SOURCE_DIR/P256K.xcframework"
164164
- is_compress: true
165+
- script:
166+
title: TEST XCFRAMEWORK
167+
timeout: 360
168+
inputs:
169+
- content: |-
170+
#!/usr/bin/env bash
171+
# fail if any commands fails; debug log
172+
set -ex
173+
174+
# Comment out the existing target for "P256K" in the Package.swift file.
175+
sed -i '' '/\.target(name: "P256K", dependencies: \["libsecp256k1"\]),/s/^/\/\//g' Package.swift
176+
177+
# Add the new target for "P256K" in the Package.swift file.
178+
sed -i '' '/\.target(name: "P256K", dependencies: \["libsecp256k1"\]),/a\
179+
.binaryTarget(\
180+
name: "P256K",\
181+
path: "./P256K.xcframework"\
182+
),\
183+
' Package.swift
184+
185+
# Update the ZKPTests target to XCFrameworkTests and use the binary target for "P256K" in the manifest file.
186+
sed -i '' \
187+
-e 's/\.testTarget(name: "libsecp256k1zkpTests", dependencies: \["ZKP", "libsecp256k1_zkp"\]),/\/\/ .testTarget(name: "libsecp256k1zkpTests", dependencies: ["ZKP", "libsecp256k1_zkp"]),/' \
188+
-e 's/\.testTarget(name: "ZKPTests", dependencies: \["ZKP"\])/\.testTarget(name: "XCFrameworkTests", dependencies: \["P256K"\])/' \
189+
Package.swift
190+
191+
# Run swift tests after modifying the Package.swift, allowing verification
192+
# of the setup with the newly integrated XCFramework.
193+
swift test
165194
PULL-PACKAGE-FILES:
166195
steps:
167196
- pull-intermediate-files:

0 commit comments

Comments
 (0)