sia-storage 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sia_storage-0.3.0/.github/workflows/kotlin.yml +244 -0
- sia_storage-0.3.0/.github/workflows/python.yml +156 -0
- sia_storage-0.3.0/.github/workflows/swift.yml +291 -0
- sia_storage-0.3.0/.gitignore +21 -0
- sia_storage-0.3.0/Cargo.lock +3798 -0
- sia_storage-0.3.0/Cargo.toml +19 -0
- sia_storage-0.3.0/LICENSE +21 -0
- sia_storage-0.3.0/PKG-INFO +22 -0
- sia_storage-0.3.0/Package.swift +43 -0
- sia_storage-0.3.0/SiaStorageSDK.podspec +61 -0
- sia_storage-0.3.0/examples/kotlin/README.md +54 -0
- sia_storage-0.3.0/examples/kotlin/build.gradle.kts +22 -0
- sia_storage-0.3.0/examples/kotlin/gradle.properties +1 -0
- sia_storage-0.3.0/examples/kotlin/settings.gradle.kts +1 -0
- sia_storage-0.3.0/examples/kotlin/src/main/kotlin/Example.kt +75 -0
- sia_storage-0.3.0/examples/python/README.md +27 -0
- sia_storage-0.3.0/examples/python/example.py +104 -0
- sia_storage-0.3.0/examples/swift/Package.swift +23 -0
- sia_storage-0.3.0/examples/swift/Sources/main.swift +151 -0
- sia_storage-0.3.0/kotlin/README.md +97 -0
- sia_storage-0.3.0/kotlin/build.gradle.kts +90 -0
- sia_storage-0.3.0/kotlin/gradle.properties +3 -0
- sia_storage-0.3.0/kotlin/settings.gradle.kts +1 -0
- sia_storage-0.3.0/kotlin/src/main/kotlin/sia/indexd/Wrappers.kt +95 -0
- sia_storage-0.3.0/kotlin/src/test/kotlin/sia/indexd/SdkTest.kt +21 -0
- sia_storage-0.3.0/kotlin/uniffi.toml +2 -0
- sia_storage-0.3.0/pyproject.toml +39 -0
- sia_storage-0.3.0/python/pyproject.toml +39 -0
- sia_storage-0.3.0/python/sia_storage/__init__.py +114 -0
- sia_storage-0.3.0/python/sia_storage/py.typed +0 -0
- sia_storage-0.3.0/python/sia_storage/wrappers.py +207 -0
- sia_storage-0.3.0/sia_storage/__init__.py +114 -0
- sia_storage-0.3.0/sia_storage/py.typed +0 -0
- sia_storage-0.3.0/sia_storage/wrappers.py +207 -0
- sia_storage-0.3.0/src/bin/uniffi-bindgen.rs +3 -0
- sia_storage-0.3.0/src/lib.rs +1 -0
- sia_storage-0.3.0/swift/README.md +103 -0
- sia_storage-0.3.0/swift/Sources/SiaStorageSDK/SiaStorageSDK.swift +6062 -0
- sia_storage-0.3.0/swift/build.sh +99 -0
- sia_storage-0.3.0/swift/uniffi.toml +4 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
name: Kotlin SDK build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
pull_request:
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
inputs:
|
|
10
|
+
publish:
|
|
11
|
+
description: 'Publish to Maven Central'
|
|
12
|
+
required: false
|
|
13
|
+
type: boolean
|
|
14
|
+
default: false
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
|
|
19
|
+
env:
|
|
20
|
+
GRADLE_VERSION: '8.10.2'
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
build:
|
|
24
|
+
name: Build native library (${{ matrix.target }})
|
|
25
|
+
runs-on: ${{ matrix.os }}
|
|
26
|
+
strategy:
|
|
27
|
+
fail-fast: false
|
|
28
|
+
matrix:
|
|
29
|
+
include:
|
|
30
|
+
# Linux x86_64
|
|
31
|
+
- os: ubuntu-latest
|
|
32
|
+
target: x86_64-unknown-linux-gnu
|
|
33
|
+
lib: libsia_storage_ffi.so
|
|
34
|
+
# Linux aarch64
|
|
35
|
+
- os: ubuntu-latest
|
|
36
|
+
target: aarch64-unknown-linux-gnu
|
|
37
|
+
lib: libsia_storage_ffi.so
|
|
38
|
+
# macOS x86_64
|
|
39
|
+
- os: macos-15-intel
|
|
40
|
+
target: x86_64-apple-darwin
|
|
41
|
+
lib: libsia_storage_ffi.dylib
|
|
42
|
+
# macOS ARM64
|
|
43
|
+
- os: macos-14
|
|
44
|
+
target: aarch64-apple-darwin
|
|
45
|
+
lib: libsia_storage_ffi.dylib
|
|
46
|
+
# Windows x86_64
|
|
47
|
+
- os: windows-latest
|
|
48
|
+
target: x86_64-pc-windows-msvc
|
|
49
|
+
lib: sia_storage_ffi.dll
|
|
50
|
+
|
|
51
|
+
steps:
|
|
52
|
+
- uses: actions/checkout@v4
|
|
53
|
+
|
|
54
|
+
- name: Install Rust
|
|
55
|
+
uses: dtolnay/rust-toolchain@stable
|
|
56
|
+
with:
|
|
57
|
+
targets: ${{ matrix.target }}
|
|
58
|
+
|
|
59
|
+
- name: Install cross-compilation tools
|
|
60
|
+
if: matrix.target == 'aarch64-unknown-linux-gnu'
|
|
61
|
+
run: |
|
|
62
|
+
sudo apt-get update
|
|
63
|
+
sudo apt-get install -y gcc-aarch64-linux-gnu
|
|
64
|
+
|
|
65
|
+
- name: Build native library
|
|
66
|
+
run: cargo build --release --target ${{ matrix.target }}
|
|
67
|
+
# Fix for ring crate cross-compilation on aarch64
|
|
68
|
+
# See: https://github.com/briansmith/ring/issues/1789
|
|
69
|
+
env:
|
|
70
|
+
CFLAGS_aarch64_unknown_linux_gnu: "-D__ARM_ARCH=8"
|
|
71
|
+
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
|
72
|
+
|
|
73
|
+
- name: Upload native library
|
|
74
|
+
uses: actions/upload-artifact@v4
|
|
75
|
+
with:
|
|
76
|
+
name: native-${{ matrix.target }}
|
|
77
|
+
path: target/${{ matrix.target }}/release/${{ matrix.lib }}
|
|
78
|
+
|
|
79
|
+
generate:
|
|
80
|
+
name: Generate Kotlin bindings
|
|
81
|
+
runs-on: ubuntu-latest
|
|
82
|
+
steps:
|
|
83
|
+
- uses: actions/checkout@v4
|
|
84
|
+
|
|
85
|
+
- name: Install Rust
|
|
86
|
+
uses: dtolnay/rust-toolchain@stable
|
|
87
|
+
|
|
88
|
+
- name: Build library
|
|
89
|
+
run: cargo build --release
|
|
90
|
+
|
|
91
|
+
- name: Generate Kotlin bindings
|
|
92
|
+
run: cargo run --bin uniffi-bindgen generate --library target/release/libsia_storage_ffi.so --language kotlin --out-dir bindings --config kotlin/uniffi.toml --no-format
|
|
93
|
+
|
|
94
|
+
- name: Upload bindings
|
|
95
|
+
uses: actions/upload-artifact@v4
|
|
96
|
+
with:
|
|
97
|
+
name: kotlin-bindings
|
|
98
|
+
path: bindings/
|
|
99
|
+
|
|
100
|
+
test:
|
|
101
|
+
name: Test (${{ matrix.os }})
|
|
102
|
+
needs: [build, generate]
|
|
103
|
+
runs-on: ${{ matrix.os }}
|
|
104
|
+
strategy:
|
|
105
|
+
fail-fast: false
|
|
106
|
+
matrix:
|
|
107
|
+
include:
|
|
108
|
+
- os: ubuntu-latest
|
|
109
|
+
target: x86_64-unknown-linux-gnu
|
|
110
|
+
jna_dir: linux-x86-64
|
|
111
|
+
- os: macos-14
|
|
112
|
+
target: aarch64-apple-darwin
|
|
113
|
+
jna_dir: darwin-aarch64
|
|
114
|
+
- os: windows-latest
|
|
115
|
+
target: x86_64-pc-windows-msvc
|
|
116
|
+
jna_dir: win32-x86-64
|
|
117
|
+
|
|
118
|
+
steps:
|
|
119
|
+
- uses: actions/checkout@v4
|
|
120
|
+
|
|
121
|
+
- name: Set up JDK
|
|
122
|
+
uses: actions/setup-java@v4
|
|
123
|
+
with:
|
|
124
|
+
distribution: temurin
|
|
125
|
+
java-version: '17'
|
|
126
|
+
|
|
127
|
+
- name: Setup Gradle
|
|
128
|
+
uses: gradle/actions/setup-gradle@v4
|
|
129
|
+
with:
|
|
130
|
+
gradle-version: ${{ env.GRADLE_VERSION }}
|
|
131
|
+
|
|
132
|
+
- name: Download generated bindings
|
|
133
|
+
uses: actions/download-artifact@v4
|
|
134
|
+
with:
|
|
135
|
+
name: kotlin-bindings
|
|
136
|
+
path: kotlin/src/main/kotlin
|
|
137
|
+
|
|
138
|
+
- name: Download native library
|
|
139
|
+
uses: actions/download-artifact@v4
|
|
140
|
+
with:
|
|
141
|
+
name: native-${{ matrix.target }}
|
|
142
|
+
path: kotlin/src/main/resources/${{ matrix.jna_dir }}
|
|
143
|
+
|
|
144
|
+
- name: Run tests
|
|
145
|
+
working-directory: kotlin
|
|
146
|
+
run: gradle test
|
|
147
|
+
|
|
148
|
+
package:
|
|
149
|
+
name: Package JAR
|
|
150
|
+
needs: [build, generate, test]
|
|
151
|
+
runs-on: ubuntu-latest
|
|
152
|
+
steps:
|
|
153
|
+
- uses: actions/checkout@v4
|
|
154
|
+
|
|
155
|
+
- name: Set up JDK
|
|
156
|
+
uses: actions/setup-java@v4
|
|
157
|
+
with:
|
|
158
|
+
distribution: temurin
|
|
159
|
+
java-version: '17'
|
|
160
|
+
|
|
161
|
+
- name: Setup Gradle
|
|
162
|
+
uses: gradle/actions/setup-gradle@v4
|
|
163
|
+
with:
|
|
164
|
+
gradle-version: ${{ env.GRADLE_VERSION }}
|
|
165
|
+
|
|
166
|
+
- name: Download generated bindings
|
|
167
|
+
uses: actions/download-artifact@v4
|
|
168
|
+
with:
|
|
169
|
+
name: kotlin-bindings
|
|
170
|
+
path: kotlin/src/main/kotlin
|
|
171
|
+
|
|
172
|
+
- name: Download linux-x86-64
|
|
173
|
+
uses: actions/download-artifact@v4
|
|
174
|
+
with:
|
|
175
|
+
name: native-x86_64-unknown-linux-gnu
|
|
176
|
+
path: kotlin/src/main/resources/linux-x86-64
|
|
177
|
+
|
|
178
|
+
- name: Download linux-aarch64
|
|
179
|
+
uses: actions/download-artifact@v4
|
|
180
|
+
with:
|
|
181
|
+
name: native-aarch64-unknown-linux-gnu
|
|
182
|
+
path: kotlin/src/main/resources/linux-aarch64
|
|
183
|
+
|
|
184
|
+
- name: Download darwin-x86-64
|
|
185
|
+
uses: actions/download-artifact@v4
|
|
186
|
+
with:
|
|
187
|
+
name: native-x86_64-apple-darwin
|
|
188
|
+
path: kotlin/src/main/resources/darwin-x86-64
|
|
189
|
+
|
|
190
|
+
- name: Download darwin-aarch64
|
|
191
|
+
uses: actions/download-artifact@v4
|
|
192
|
+
with:
|
|
193
|
+
name: native-aarch64-apple-darwin
|
|
194
|
+
path: kotlin/src/main/resources/darwin-aarch64
|
|
195
|
+
|
|
196
|
+
- name: Download win32-x86-64
|
|
197
|
+
uses: actions/download-artifact@v4
|
|
198
|
+
with:
|
|
199
|
+
name: native-x86_64-pc-windows-msvc
|
|
200
|
+
path: kotlin/src/main/resources/win32-x86-64
|
|
201
|
+
|
|
202
|
+
- name: Build JAR
|
|
203
|
+
working-directory: kotlin
|
|
204
|
+
run: gradle build -x test
|
|
205
|
+
|
|
206
|
+
- name: Upload JAR
|
|
207
|
+
uses: actions/upload-artifact@v4
|
|
208
|
+
with:
|
|
209
|
+
name: jar
|
|
210
|
+
path: kotlin/build/libs/siastoragesdk-*.jar
|
|
211
|
+
|
|
212
|
+
publish:
|
|
213
|
+
name: Publish to Maven Central
|
|
214
|
+
needs: package
|
|
215
|
+
runs-on: ubuntu-latest
|
|
216
|
+
if: github.event.inputs.publish == 'true'
|
|
217
|
+
steps:
|
|
218
|
+
- uses: actions/checkout@v4
|
|
219
|
+
|
|
220
|
+
- name: Set up JDK
|
|
221
|
+
uses: actions/setup-java@v4
|
|
222
|
+
with:
|
|
223
|
+
distribution: temurin
|
|
224
|
+
java-version: '17'
|
|
225
|
+
|
|
226
|
+
- name: Setup Gradle
|
|
227
|
+
uses: gradle/actions/setup-gradle@v4
|
|
228
|
+
with:
|
|
229
|
+
gradle-version: ${{ env.GRADLE_VERSION }}
|
|
230
|
+
|
|
231
|
+
- name: Download packaged JAR artifacts
|
|
232
|
+
uses: actions/download-artifact@v4
|
|
233
|
+
with:
|
|
234
|
+
name: jar
|
|
235
|
+
path: kotlin/build/libs
|
|
236
|
+
|
|
237
|
+
- name: Publish
|
|
238
|
+
working-directory: kotlin
|
|
239
|
+
run: gradle publish -x test -x jar -x sourcesJar -x javadocJar
|
|
240
|
+
env:
|
|
241
|
+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
|
|
242
|
+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
|
|
243
|
+
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
|
|
244
|
+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
name: Python SDK build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
pull_request:
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
inputs:
|
|
10
|
+
publish:
|
|
11
|
+
description: 'Publish to PyPI'
|
|
12
|
+
required: false
|
|
13
|
+
type: boolean
|
|
14
|
+
default: false
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
build:
|
|
21
|
+
name: Build wheels (${{ matrix.target }} - ${{ matrix.os }})
|
|
22
|
+
runs-on: ${{ matrix.os }}
|
|
23
|
+
strategy:
|
|
24
|
+
fail-fast: false
|
|
25
|
+
matrix:
|
|
26
|
+
include:
|
|
27
|
+
# Linux x86_64
|
|
28
|
+
- os: ubuntu-latest
|
|
29
|
+
target: x86_64-unknown-linux-gnu
|
|
30
|
+
manylinux: manylinux2014
|
|
31
|
+
# Linux aarch64
|
|
32
|
+
- os: ubuntu-latest
|
|
33
|
+
target: aarch64-unknown-linux-gnu
|
|
34
|
+
manylinux: manylinux2014
|
|
35
|
+
# macOS x86_64
|
|
36
|
+
- os: macos-15-intel
|
|
37
|
+
target: x86_64-apple-darwin
|
|
38
|
+
# macOS ARM64
|
|
39
|
+
- os: macos-14
|
|
40
|
+
target: aarch64-apple-darwin
|
|
41
|
+
# Windows x86_64
|
|
42
|
+
- os: windows-latest
|
|
43
|
+
target: x86_64-pc-windows-msvc
|
|
44
|
+
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/checkout@v4
|
|
47
|
+
|
|
48
|
+
- name: Set up Python
|
|
49
|
+
uses: actions/setup-python@v5
|
|
50
|
+
with:
|
|
51
|
+
python-version: '3.12'
|
|
52
|
+
|
|
53
|
+
- name: Build wheels
|
|
54
|
+
uses: PyO3/maturin-action@v1
|
|
55
|
+
with:
|
|
56
|
+
working-directory: python
|
|
57
|
+
target: ${{ matrix.target }}
|
|
58
|
+
manylinux: ${{ matrix.manylinux || 'auto' }}
|
|
59
|
+
args: --release --out dist
|
|
60
|
+
sccache: 'true'
|
|
61
|
+
# Fix for ring crate cross-compilation on aarch64
|
|
62
|
+
# See: https://github.com/briansmith/ring/issues/1789
|
|
63
|
+
env:
|
|
64
|
+
CFLAGS_aarch64_unknown_linux_gnu: "-D__ARM_ARCH=8"
|
|
65
|
+
|
|
66
|
+
- name: Upload wheels
|
|
67
|
+
uses: actions/upload-artifact@v4
|
|
68
|
+
with:
|
|
69
|
+
name: wheels-${{ matrix.target }}
|
|
70
|
+
path: python/dist/*.whl
|
|
71
|
+
|
|
72
|
+
sdist:
|
|
73
|
+
name: Build source distribution
|
|
74
|
+
runs-on: ubuntu-latest
|
|
75
|
+
steps:
|
|
76
|
+
- uses: actions/checkout@v4
|
|
77
|
+
|
|
78
|
+
- name: Build sdist
|
|
79
|
+
uses: PyO3/maturin-action@v1
|
|
80
|
+
with:
|
|
81
|
+
working-directory: python
|
|
82
|
+
command: sdist
|
|
83
|
+
args: --out dist
|
|
84
|
+
|
|
85
|
+
- name: Upload sdist
|
|
86
|
+
uses: actions/upload-artifact@v4
|
|
87
|
+
with:
|
|
88
|
+
name: wheels-sdist
|
|
89
|
+
path: python/dist/*.tar.gz
|
|
90
|
+
|
|
91
|
+
test:
|
|
92
|
+
name: Test wheel (${{ matrix.os }} - Python ${{ matrix.python }})
|
|
93
|
+
needs: build
|
|
94
|
+
runs-on: ${{ matrix.os }}
|
|
95
|
+
strategy:
|
|
96
|
+
fail-fast: false
|
|
97
|
+
matrix:
|
|
98
|
+
include:
|
|
99
|
+
- os: ubuntu-latest
|
|
100
|
+
target: x86_64-unknown-linux-gnu
|
|
101
|
+
python: '3.10'
|
|
102
|
+
- os: ubuntu-latest
|
|
103
|
+
target: x86_64-unknown-linux-gnu
|
|
104
|
+
python: '3.12'
|
|
105
|
+
- os: macos-14
|
|
106
|
+
target: aarch64-apple-darwin
|
|
107
|
+
python: '3.12'
|
|
108
|
+
- os: windows-latest
|
|
109
|
+
target: x86_64-pc-windows-msvc
|
|
110
|
+
python: '3.12'
|
|
111
|
+
|
|
112
|
+
steps:
|
|
113
|
+
- uses: actions/checkout@v4
|
|
114
|
+
|
|
115
|
+
- name: Set up Python
|
|
116
|
+
uses: actions/setup-python@v5
|
|
117
|
+
with:
|
|
118
|
+
python-version: ${{ matrix.python }}
|
|
119
|
+
|
|
120
|
+
- name: Download wheels
|
|
121
|
+
uses: actions/download-artifact@v4
|
|
122
|
+
with:
|
|
123
|
+
name: wheels-${{ matrix.target }}
|
|
124
|
+
path: dist
|
|
125
|
+
|
|
126
|
+
- name: Install wheel
|
|
127
|
+
shell: bash
|
|
128
|
+
run: |
|
|
129
|
+
pip install dist/*.whl
|
|
130
|
+
|
|
131
|
+
- name: Test import
|
|
132
|
+
run: |
|
|
133
|
+
python -c "from sia_storage import generate_recovery_phrase, SDK, Builder; print('Import successful'); print(generate_recovery_phrase()[:20] + '...')"
|
|
134
|
+
|
|
135
|
+
publish:
|
|
136
|
+
name: Publish to PyPI
|
|
137
|
+
needs: [build, sdist, test]
|
|
138
|
+
runs-on: ubuntu-latest
|
|
139
|
+
if: github.event.inputs.publish == 'true'
|
|
140
|
+
environment:
|
|
141
|
+
name: pypi
|
|
142
|
+
url: https://pypi.org/project/sia_storage/
|
|
143
|
+
permissions:
|
|
144
|
+
id-token: write
|
|
145
|
+
steps:
|
|
146
|
+
- name: Download all artifacts
|
|
147
|
+
uses: actions/download-artifact@v4
|
|
148
|
+
with:
|
|
149
|
+
pattern: wheels-*
|
|
150
|
+
path: dist
|
|
151
|
+
merge-multiple: true
|
|
152
|
+
|
|
153
|
+
- name: Publish to PyPI
|
|
154
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
155
|
+
with:
|
|
156
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
name: Swift SDK build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
pull_request:
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
inputs:
|
|
10
|
+
publish:
|
|
11
|
+
description: 'Create GitHub Release'
|
|
12
|
+
required: false
|
|
13
|
+
type: boolean
|
|
14
|
+
default: false
|
|
15
|
+
version:
|
|
16
|
+
description: 'Release version (e.g., 1.0.0)'
|
|
17
|
+
required: false
|
|
18
|
+
type: string
|
|
19
|
+
|
|
20
|
+
permissions:
|
|
21
|
+
contents: read
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
build:
|
|
25
|
+
name: Build XCFramework
|
|
26
|
+
runs-on: macos-15
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v4
|
|
29
|
+
|
|
30
|
+
- name: Install Rust
|
|
31
|
+
uses: dtolnay/rust-toolchain@stable
|
|
32
|
+
with:
|
|
33
|
+
targets: aarch64-apple-ios,aarch64-apple-ios-sim,x86_64-apple-ios,aarch64-apple-darwin,x86_64-apple-darwin
|
|
34
|
+
|
|
35
|
+
- name: Cache Cargo
|
|
36
|
+
uses: Swatinem/rust-cache@v2
|
|
37
|
+
with:
|
|
38
|
+
workspaces: .
|
|
39
|
+
|
|
40
|
+
- name: Build XCFramework
|
|
41
|
+
run: ./swift/build.sh
|
|
42
|
+
|
|
43
|
+
- name: Upload XCFramework
|
|
44
|
+
uses: actions/upload-artifact@v4
|
|
45
|
+
with:
|
|
46
|
+
name: SiaStorageSDKFFI-xcframework
|
|
47
|
+
path: build/SiaStorageSDKFFI.xcframework.zip
|
|
48
|
+
|
|
49
|
+
- name: Compute and save checksum
|
|
50
|
+
run: |
|
|
51
|
+
CHECKSUM=$(swift package compute-checksum build/SiaStorageSDKFFI.xcframework.zip)
|
|
52
|
+
echo "$CHECKSUM" > checksum.txt
|
|
53
|
+
echo "Checksum: $CHECKSUM"
|
|
54
|
+
|
|
55
|
+
- name: Upload checksum
|
|
56
|
+
uses: actions/upload-artifact@v4
|
|
57
|
+
with:
|
|
58
|
+
name: checksum
|
|
59
|
+
path: checksum.txt
|
|
60
|
+
|
|
61
|
+
test:
|
|
62
|
+
name: Test Swift package
|
|
63
|
+
needs: build
|
|
64
|
+
runs-on: macos-15
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/checkout@v4
|
|
67
|
+
|
|
68
|
+
- name: Download XCFramework
|
|
69
|
+
uses: actions/download-artifact@v4
|
|
70
|
+
with:
|
|
71
|
+
name: SiaStorageSDKFFI-xcframework
|
|
72
|
+
path: build
|
|
73
|
+
|
|
74
|
+
- name: Extract XCFramework
|
|
75
|
+
run: unzip -q build/SiaStorageSDKFFI.xcframework.zip -d build
|
|
76
|
+
|
|
77
|
+
- name: Build package
|
|
78
|
+
run: SIA_STORAGE_SDK_USE_LOCAL_XCFRAMEWORK=1 swift build
|
|
79
|
+
|
|
80
|
+
- name: Build example
|
|
81
|
+
run: |
|
|
82
|
+
cd examples/swift
|
|
83
|
+
SIA_STORAGE_SDK_USE_LOCAL_XCFRAMEWORK=1 swift build
|
|
84
|
+
|
|
85
|
+
- name: Build downstream consumer package
|
|
86
|
+
run: |
|
|
87
|
+
TMP_DIR="$(mktemp -d)"
|
|
88
|
+
cd "$TMP_DIR"
|
|
89
|
+
swift package init --type executable
|
|
90
|
+
rm -rf Sources/*
|
|
91
|
+
mkdir -p Sources/ConsumerSmoke
|
|
92
|
+
cat > Package.swift <<EOF
|
|
93
|
+
// swift-tools-version: 6.0
|
|
94
|
+
import PackageDescription
|
|
95
|
+
|
|
96
|
+
let package = Package(
|
|
97
|
+
name: "ConsumerSmoke",
|
|
98
|
+
platforms: [
|
|
99
|
+
.iOS(.v16),
|
|
100
|
+
.macOS(.v14)
|
|
101
|
+
],
|
|
102
|
+
dependencies: [
|
|
103
|
+
.package(path: "${GITHUB_WORKSPACE}")
|
|
104
|
+
],
|
|
105
|
+
targets: [
|
|
106
|
+
.executableTarget(
|
|
107
|
+
name: "ConsumerSmoke",
|
|
108
|
+
dependencies: [
|
|
109
|
+
.product(name: "SiaStorageSDK", package: "sia-storage-sdk")
|
|
110
|
+
]
|
|
111
|
+
)
|
|
112
|
+
]
|
|
113
|
+
)
|
|
114
|
+
EOF
|
|
115
|
+
cat > Sources/ConsumerSmoke/main.swift <<'EOF'
|
|
116
|
+
import SiaStorageSDK
|
|
117
|
+
import Foundation
|
|
118
|
+
|
|
119
|
+
let _ = try Builder(indexerUrl: "https://app.sia.storage", appMeta: AppMeta(id: Data(repeating: 0x01, count: 32), name: "smoke test", description: "smoke test", serviceUrl: "https://example.com", logoUrl: nil, callbackUrl: nil))
|
|
120
|
+
print("consumer smoke build ok")
|
|
121
|
+
EOF
|
|
122
|
+
SIA_STORAGE_SDK_USE_LOCAL_XCFRAMEWORK=1 swift build
|
|
123
|
+
|
|
124
|
+
publish:
|
|
125
|
+
name: Publish to GitHub Releases
|
|
126
|
+
needs: [build, test]
|
|
127
|
+
runs-on: ubuntu-latest
|
|
128
|
+
if: github.event.inputs.publish == 'true' && github.event.inputs.version != ''
|
|
129
|
+
permissions:
|
|
130
|
+
contents: write
|
|
131
|
+
steps:
|
|
132
|
+
- uses: actions/checkout@v4
|
|
133
|
+
|
|
134
|
+
- name: Download XCFramework
|
|
135
|
+
uses: actions/download-artifact@v4
|
|
136
|
+
with:
|
|
137
|
+
name: SiaStorageSDKFFI-xcframework
|
|
138
|
+
path: dist
|
|
139
|
+
|
|
140
|
+
- name: Download checksum
|
|
141
|
+
uses: actions/download-artifact@v4
|
|
142
|
+
with:
|
|
143
|
+
name: checksum
|
|
144
|
+
path: dist
|
|
145
|
+
|
|
146
|
+
- name: Validate version format
|
|
147
|
+
env:
|
|
148
|
+
VERSION: ${{ github.event.inputs.version }}
|
|
149
|
+
run: |
|
|
150
|
+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
151
|
+
echo "Error: version must be in semver format (e.g., 1.0.0), got: $VERSION"
|
|
152
|
+
exit 1
|
|
153
|
+
fi
|
|
154
|
+
|
|
155
|
+
- name: Prepare release assets
|
|
156
|
+
env:
|
|
157
|
+
VERSION: ${{ github.event.inputs.version }}
|
|
158
|
+
run: |
|
|
159
|
+
cd dist
|
|
160
|
+
mv SiaStorageSDKFFI.xcframework.zip "SiaStorageSDKFFI-${VERSION}.xcframework.zip"
|
|
161
|
+
SHA256=$(shasum -a 256 "SiaStorageSDKFFI-${VERSION}.xcframework.zip" | cut -d' ' -f1)
|
|
162
|
+
SPM_CHECKSUM=$(cat checksum.txt)
|
|
163
|
+
echo "SiaStorageSDKFFI-${VERSION}.xcframework.zip: $SHA256" > CHECKSUMS.txt
|
|
164
|
+
echo "CHECKSUM_CONTENT=$(cat CHECKSUMS.txt)" >> "$GITHUB_ENV"
|
|
165
|
+
echo "SPM_CHECKSUM=$SPM_CHECKSUM" >> "$GITHUB_ENV"
|
|
166
|
+
|
|
167
|
+
- name: Validate manifest metadata
|
|
168
|
+
env:
|
|
169
|
+
VERSION: ${{ github.event.inputs.version }}
|
|
170
|
+
run: |
|
|
171
|
+
MANIFEST_URL=$(awk -F'"' '/url: "https:\/\/github.com\/SiaFoundation\/sia-storage-sdk\/releases\/download\/v/ {print $2}' Package.swift)
|
|
172
|
+
MANIFEST_VERSION=$(echo "$MANIFEST_URL" | sed -E 's#.*\/download\/v([0-9]+\.[0-9]+\.[0-9]+)\/.*#\1#')
|
|
173
|
+
MANIFEST_CHECKSUM=$(awk -F'"' '/checksum:/ {print $2}' Package.swift)
|
|
174
|
+
PODSPEC_VERSION=$(awk -F"'" '/s.version/ {print $2}' SiaStorageSDK.podspec)
|
|
175
|
+
|
|
176
|
+
if [ "$MANIFEST_VERSION" != "$VERSION" ]; then
|
|
177
|
+
echo "Error: Package.swift release URL version ($MANIFEST_VERSION) does not match workflow version ($VERSION)"
|
|
178
|
+
exit 1
|
|
179
|
+
fi
|
|
180
|
+
|
|
181
|
+
if [ "$MANIFEST_CHECKSUM" != "$SPM_CHECKSUM" ]; then
|
|
182
|
+
echo "Error: Package.swift checksum ($MANIFEST_CHECKSUM) does not match built artifact checksum ($SPM_CHECKSUM)"
|
|
183
|
+
exit 1
|
|
184
|
+
fi
|
|
185
|
+
|
|
186
|
+
if [ "$PODSPEC_VERSION" != "$VERSION" ]; then
|
|
187
|
+
echo "Error: SiaStorageSDK.podspec version ($PODSPEC_VERSION) does not match workflow version ($VERSION)"
|
|
188
|
+
exit 1
|
|
189
|
+
fi
|
|
190
|
+
|
|
191
|
+
- name: Create Release
|
|
192
|
+
uses: softprops/action-gh-release@v2
|
|
193
|
+
with:
|
|
194
|
+
tag_name: v${{ github.event.inputs.version }}
|
|
195
|
+
name: SiaStorageSDK Swift v${{ github.event.inputs.version }}
|
|
196
|
+
body: |
|
|
197
|
+
## SiaStorageSDK for Swift v${{ github.event.inputs.version }}
|
|
198
|
+
|
|
199
|
+
### Installation
|
|
200
|
+
|
|
201
|
+
#### Swift Package Manager
|
|
202
|
+
|
|
203
|
+
Add to your `Package.swift`:
|
|
204
|
+
```swift
|
|
205
|
+
dependencies: [
|
|
206
|
+
.package(url: "https://github.com/SiaFoundation/sia-storage-sdk", from: "${{ github.event.inputs.version }}")
|
|
207
|
+
]
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Or add via Xcode: File → Add Packages → Enter repository URL.
|
|
211
|
+
|
|
212
|
+
#### CocoaPods
|
|
213
|
+
|
|
214
|
+
```ruby
|
|
215
|
+
pod 'SiaStorageSDK', '~> ${{ github.event.inputs.version }}'
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Checksums
|
|
219
|
+
SHA-256:
|
|
220
|
+
```
|
|
221
|
+
${{ env.CHECKSUM_CONTENT }}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
SPM (`swift package compute-checksum`):
|
|
225
|
+
```
|
|
226
|
+
${{ env.SPM_CHECKSUM }}
|
|
227
|
+
```
|
|
228
|
+
files: |
|
|
229
|
+
dist/SiaStorageSDKFFI-${{ github.event.inputs.version }}.xcframework.zip
|
|
230
|
+
dist/CHECKSUMS.txt
|
|
231
|
+
draft: false
|
|
232
|
+
prerelease: false
|
|
233
|
+
|
|
234
|
+
smoke-test-release:
|
|
235
|
+
name: Smoke test published release
|
|
236
|
+
needs: publish
|
|
237
|
+
runs-on: macos-15
|
|
238
|
+
if: github.event.inputs.publish == 'true' && github.event.inputs.version != ''
|
|
239
|
+
steps:
|
|
240
|
+
- name: Build downstream package from released tag
|
|
241
|
+
env:
|
|
242
|
+
VERSION: ${{ github.event.inputs.version }}
|
|
243
|
+
run: |
|
|
244
|
+
TMP_DIR="$(mktemp -d)"
|
|
245
|
+
cd "$TMP_DIR"
|
|
246
|
+
swift package init --type executable
|
|
247
|
+
rm -rf Sources/*
|
|
248
|
+
mkdir -p Sources/ReleaseSmoke
|
|
249
|
+
cat > Package.swift <<EOF
|
|
250
|
+
// swift-tools-version: 6.0
|
|
251
|
+
import PackageDescription
|
|
252
|
+
|
|
253
|
+
let package = Package(
|
|
254
|
+
name: "ReleaseSmoke",
|
|
255
|
+
platforms: [
|
|
256
|
+
.iOS(.v16),
|
|
257
|
+
.macOS(.v14)
|
|
258
|
+
],
|
|
259
|
+
dependencies: [
|
|
260
|
+
.package(url: "https://github.com/SiaFoundation/sia-storage-sdk", exact: "$VERSION")
|
|
261
|
+
],
|
|
262
|
+
targets: [
|
|
263
|
+
.executableTarget(
|
|
264
|
+
name: "ReleaseSmoke",
|
|
265
|
+
dependencies: [
|
|
266
|
+
.product(name: "SiaStorageSDK", package: "sia-storage-sdk")
|
|
267
|
+
]
|
|
268
|
+
)
|
|
269
|
+
]
|
|
270
|
+
)
|
|
271
|
+
EOF
|
|
272
|
+
cat > Sources/ReleaseSmoke/main.swift <<'EOF'
|
|
273
|
+
import SiaStorageSDK
|
|
274
|
+
import Foundation
|
|
275
|
+
|
|
276
|
+
let _ = try Builder(indexerUrl: "https://app.sia.storage", appMeta: AppMeta(id: Data(repeating: 0x01, count: 32), name: "smoke test", description: "smoke test", serviceUrl: "https://example.com", logoUrl: nil, callbackUrl: nil))
|
|
277
|
+
print("release smoke build ok")
|
|
278
|
+
EOF
|
|
279
|
+
|
|
280
|
+
for ATTEMPT in 1 2 3 4 5; do
|
|
281
|
+
if swift build; then
|
|
282
|
+
exit 0
|
|
283
|
+
fi
|
|
284
|
+
echo "Retrying release smoke test ($ATTEMPT/5)..."
|
|
285
|
+
swift package reset || true
|
|
286
|
+
rm -rf .build
|
|
287
|
+
sleep 10
|
|
288
|
+
done
|
|
289
|
+
|
|
290
|
+
echo "Release smoke test failed after retries"
|
|
291
|
+
exit 1
|