-
Notifications
You must be signed in to change notification settings - Fork 4
355 lines (292 loc) · 10.6 KB
/
Copy pathci.yml
File metadata and controls
355 lines (292 loc) · 10.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
name: CI
permissions:
contents: read
on:
push:
branches: ["main"]
pull_request:
jobs:
rust-core:
name: Rust Core - Build & Test
runs-on:
group: arc-public-large-amd64-runner
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Read rust-toolchain
id: rust-version
run: echo "toolchain=$(yq '.toolchain.channel' rust-toolchain.toml)" >> $GITHUB_OUTPUT
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ steps.rust-version.outputs.toolchain }}
components: rustfmt,clippy
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
- name: Lint with Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Build Rust core
run: cargo build --release --package idkit-core
- name: Run Rust tests
run: cargo test --package idkit-core
go-server:
name: Go Server - Build & Test
runs-on:
group: arc-public-large-amd64-runner
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go/idkit/go.mod
- name: Check formatting
working-directory: go/idkit
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "Go files are not formatted. Run: gofmt -w ."
gofmt -l .
exit 1
fi
- name: Run Go tests
working-directory: go/idkit
run: go test ./...
go-rust-parity:
name: Go ↔ Rust Parity Tests
runs-on:
group: arc-public-large-amd64-runner
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go/idkit/go.mod
- name: Read rust-toolchain
id: rust-version
run: echo "toolchain=$(yq '.toolchain.channel' rust-toolchain.toml)" >> $GITHUB_OUTPUT
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ steps.rust-version.outputs.toolchain }}
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Build rp-sign-vectors binary
run: cargo build --release -p idkit-core --bin rp-sign-vectors --features rp-signature
- name: Run Go parity tests
working-directory: go/idkit
run: go test -tags rust_parity -v ./...
swift-bindings:
name: Swift Bindings - Build & Test
runs-on: ${{ matrix.os }}
needs: rust-core
strategy:
fail-fast: false
matrix:
include:
- os: macos-26
xcode: "26.0.1"
- os: macos-26
xcode: "26.1.1"
- os: macos-26
xcode: "26.2"
- os: macos-26
xcode: "26.3"
# - os: macos-26
# xcode: "26.4"
# - os: macos-26
# xcode: "26.5-beta"
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Set Xcode developer directory
run: |
XCODE_APP_VERSION="${{ matrix.xcode }}"
XCODE_APP_VERSION="${XCODE_APP_VERSION//-/_}"
echo "DEVELOPER_DIR=/Applications/Xcode_${XCODE_APP_VERSION}.app/Contents/Developer" >> "$GITHUB_ENV"
- name: Read rust-toolchain
id: rust-version
run: echo "toolchain=$(yq '.toolchain.channel' rust-toolchain.toml)" >> $GITHUB_OUTPUT
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ steps.rust-version.outputs.toolchain }}
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Restore Swift .build cache
id: restore-swift-build
uses: actions/cache/restore@v4
with:
path: swift/.build
restore-keys: "swiftpm-build-${{ runner.os }}-${{ matrix.xcode }}-"
key: "swiftpm-build-${{ runner.os }}-${{ matrix.xcode }}-${{ hashFiles('**/Package.swift', '**/Package.resolved') }}"
- name: Build Swift artifacts (Rust + XCFramework + Bindings)
run: bash scripts/package-swift.sh
- name: Build Swift package
working-directory: swift
run: swift build
- name: Run Swift tests
working-directory: swift
run: set -o pipefail; xcodebuild test -scheme IDKit -destination "platform=macOS" | xcbeautify
- name: Check Swift sample app destinations
id: check-destinations
run: |
xcodebuild -version
DESTINATIONS=$(xcodebuild -showdestinations \
-project swift/Examples/IDKitSampleApp/IDKitSampleApp.xcodeproj \
-scheme IDKitSampleApp 2>&1)
echo "$DESTINATIONS"
if echo "$DESTINATIONS" | grep -q "Available destinations"; then
echo "has_destinations=true" >> $GITHUB_OUTPUT
else
echo "has_destinations=false" >> $GITHUB_OUTPUT
echo "No available destinations — skipping build"
fi
- name: Download iOS platform
if: steps.check-destinations.outputs.has_destinations == 'false'
run: xcodebuild -downloadPlatform iOS
- name: Build Swift sample app for iOS
run: |
set -o pipefail; xcodebuild \
-project swift/Examples/IDKitSampleApp/IDKitSampleApp.xcodeproj \
-scheme IDKitSampleApp \
-sdk iphoneos \
-destination "generic/platform=iOS" \
CODE_SIGNING_ALLOWED=NO \
build | xcbeautify
- name: Build Swift sample app for iOS Simulator
run: |
set -o pipefail; xcodebuild \
-project swift/Examples/IDKitSampleApp/IDKitSampleApp.xcodeproj \
-scheme IDKitSampleApp \
-sdk iphonesimulator \
-destination "generic/platform=iOS Simulator" \
CODE_SIGNING_ALLOWED=NO \
build | xcbeautify
- name: Cache Swift .build
if: steps.restore-swift-build.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: swift/.build
key: "swiftpm-build-${{ runner.os }}-${{ matrix.xcode }}-${{ hashFiles('**/Package.swift', '**/Package.resolved') }}"
js-packages:
name: JavaScript - Build & Test
runs-on:
group: arc-public-large-amd64-runner
needs: rust-core
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Read rust-toolchain
id: rust-version
run: echo "toolchain=$(yq '.toolchain.channel' rust-toolchain.toml)" >> $GITHUB_OUTPUT
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ steps.rust-version.outputs.toolchain }}
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Install wasm-pack
run: cargo install wasm-pack --locked
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Check formatting
run: pnpm lint:js
- name: Build packages
run: pnpm build
- name: Run tests
run: pnpm test
kotlin-bindings:
name: Kotlin Bindings - Build (multi-ABI)
runs-on: ubuntu-latest
needs: rust-core
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Free disk space
run: |
df -h
sudo rm -rf /opt/hostedtoolcache/CodeQL \
/usr/share/dotnet \
/opt/ghc || true
sudo apt-get clean
docker system prune -af || true
docker volume prune -f || true
docker builder prune -af || true
df -h
- name: Read rust-toolchain
id: rust-version
run: echo "toolchain=$(yq '.toolchain.channel' rust-toolchain.toml)" >> $GITHUB_OUTPUT
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ steps.rust-version.outputs.toolchain }}
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Install cross (for Android targets, if not cached)
run: command -v cross || cargo install cross --git https://github.com/cross-rs/cross --locked
- name: Build Kotlin bindings (host + Android ABIs)
run: ./scripts/build-kotlin.sh
- name: Setup Android SDK
uses: android-actions/setup-android@v4
with:
packages: tools platform-tools platforms;android-35 build-tools;35.0.0
- name: Run tests
working-directory: kotlin/
run: gradle bindings:test
- name: Build Kotlin sample app
working-directory: kotlin/Examples/IDKitSampleApp
run: ./gradlew :app:assembleDebug
- name: Validate Kotlin Maven publication
run: |
set -euo pipefail
./kotlin/Examples/IDKitSampleApp/gradlew -p kotlin :bindings:publishToMavenLocal
./kotlin/Examples/IDKitSampleApp/gradlew -p kotlin \
-Pidkit.publish.mavenCentral=true \
:bindings:publishToMavenCentral --dry-run
VERSION="$(grep '^version=' kotlin/gradle.properties | cut -d= -f2- | tr -d '[:space:]')"
ARTIFACT_DIR="$HOME/.m2/repository/com/worldcoin/idkit/$VERSION"
ARTIFACT_BASE="$ARTIFACT_DIR/idkit-$VERSION"
for artifact in \
"$ARTIFACT_BASE.aar" \
"$ARTIFACT_BASE.pom" \
"$ARTIFACT_BASE.module" \
"$ARTIFACT_BASE-sources.jar" \
"$ARTIFACT_BASE-javadoc.jar"; do
if [ ! -s "$artifact" ]; then
echo "::error::Missing Maven publication artifact: $artifact"
exit 1
fi
done
grep -q '<groupId>com.worldcoin</groupId>' "$ARTIFACT_BASE.pom"
grep -q '<artifactId>idkit</artifactId>' "$ARTIFACT_BASE.pom"
grep -q '<packaging>aar</packaging>' "$ARTIFACT_BASE.pom"
AAR_CONTENTS="$(mktemp)"
jar tf "$ARTIFACT_BASE.aar" > "$AAR_CONTENTS"
for abi in arm64-v8a armeabi-v7a x86 x86_64; do
if ! grep -q "^jni/$abi/libidkit.so$" "$AAR_CONTENTS"; then
echo "::error::Missing native library in AAR: jni/$abi/libidkit.so"
exit 1
fi
done