-
Notifications
You must be signed in to change notification settings - Fork 12
597 lines (563 loc) · 25.2 KB
/
build.yml
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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
name: Build
on:
push:
branches:
- fix/*
- feature/*
- release/*
- misc/*
- develop
- main
jobs:
build:
runs-on: ${{ matrix.build-target.runner }}
continue-on-error: false
strategy:
matrix:
build-target:
# =============
# JSON Toolkit
# =============
# WASM Targets
- crate: radix-engine-toolkit
target-triple: wasm32-unknown-unknown
runner: ubuntu-latest
# ===============
# UniFFI Toolkit
# ===============
# Linux Targets
- crate: radix-engine-toolkit-uniffi
target-triple: x86_64-unknown-linux-gnu
runner: ubuntu-20.04
- crate: radix-engine-toolkit-uniffi
target-triple: aarch64-unknown-linux-gnu
runner: ubuntu-latest
# PC Targets
- crate: radix-engine-toolkit-uniffi
target-triple: x86_64-pc-windows-gnu
runner: ubuntu-latest
# Android Targets
- crate: radix-engine-toolkit-uniffi
target-triple: aarch64-linux-android
runner: ubuntu-latest
- crate: radix-engine-toolkit-uniffi
target-triple: armv7-linux-androideabi
runner: ubuntu-latest
# MacOS Targets
- crate: radix-engine-toolkit-uniffi
target-triple: aarch64-apple-darwin
runner: macos-latest
- crate: radix-engine-toolkit-uniffi
target-triple: x86_64-apple-darwin
runner: macos-latest
# iOS Targets
- crate: radix-engine-toolkit-uniffi
target-triple: x86_64-apple-ios
runner: macos-latest
- crate: radix-engine-toolkit-uniffi
target-triple: aarch64-apple-ios
runner: macos-latest
- crate: radix-engine-toolkit-uniffi
target-triple: aarch64-apple-ios-sim
runner: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust Target
run: |
# Install Nightly
rustup toolchain install nightly
# Update both toolchains
rustup update stable
rustup update nightly
# Add target
rustup target install ${{ matrix.build-target.target-triple }}
rustup +nightly target install ${{ matrix.build-target.target-triple }}
# Install the nightly toolchain of the target of this machine.
DEFAULT_TARGET=$(rustc -vV | sed -n 's|host: ||p')
rustup component add rust-src --toolchain nightly-$DEFAULT_TARGET
# - name: Cache Dependencies
# uses: mozilla-actions/[email protected]
# Installing Build Dependencies
- name: Build Dependencies (aarch64 linux)
if: ${{ matrix.build-target.target-triple == 'aarch64-unknown-linux-gnu' }}
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "AR=aarch64-linux-gnu-gcc-ar" >> $GITHUB_ENV
- name: Build Dependencies (android)
uses: nttld/setup-ndk@v1
id: setup-ndk
if: ${{ matrix.build-target.target-triple == 'aarch64-linux-android' || matrix.build-target.target-triple == 'armv7-linux-androideabi' }}
with:
ndk-version: r25b
- name: Build Dependencies (aarch64 android)
if: ${{ matrix.build-target.target-triple == 'aarch64-linux-android' }}
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
echo "CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang" >> $GITHUB_ENV
echo "CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang" >> $GITHUB_ENV
echo "AR=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar" >> $GITHUB_ENV
- name: Build Dependencies (armv7 android)
if: ${{ matrix.build-target.target-triple == 'armv7-linux-androideabi' }}
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
echo "CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi19-clang" >> $GITHUB_ENV
echo "CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi19-clang" >> $GITHUB_ENV
echo "AR=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar" >> $GITHUB_ENV
- name: Build Dependencies (aarch64/x86_64 windows)
if: ${{ matrix.build-target.target-triple == 'x86_64-pc-windows-gnu' }}
run: |
sudo apt-get install -y mingw-w64
echo "CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc" >> $GITHUB_ENV
echo "CC=x86_64-w64-mingw32-gcc" >> $GITHUB_ENV
echo "AR=x86_64-w64-mingw32-gcc-ar" >> $GITHUB_ENV
- name: Build
working-directory: ${{ matrix.build-target.crate }}
# env:
# SCCACHE_GHA_ENABLED: "true"
# RUSTC_WRAPPER: "sccache"
run: |
target_triple="${{ matrix.build-target.target-triple }}"
if [[ $target_triple =~ "ios" ]]; then
export IPHONEOS_DEPLOYMENT_TARGET="11.0"
fi
echo $IPHONEOS_DEPLOYMENT_TARGET
cargo build \
--target ${{ matrix.build-target.target-triple }} \
--release
- name: Clean Build Artifacts
run: find "./${{ matrix.build-target.crate }}/target/${{ matrix.build-target.target-triple }}/release" -mindepth 1 -maxdepth 1 -type d -exec rm -r {} \;
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.build-target.crate }}-${{ matrix.build-target.target-triple }}
path: "./${{ matrix.build-target.crate }}/target/${{ matrix.build-target.target-triple }}/release"
generate-uniffi-bindings:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clone uniffi-bindgen-cs
uses: actions/checkout@v3
with:
repository: radixdlt/uniffi-bindgen-cs
path: uniffi-bindgen-cs
submodules: 'recursive'
ref: f1a6ef67449b47028fd5c3d8e5c6d3b80ddefd2b
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Generate the Bindings
run: |
# Generating the path of the dynamic library
DYNAMIC_LIBRARY_PATH="./artifacts/radix-engine-toolkit-uniffi-x86_64-unknown-linux-gnu/libradix_engine_toolkit_uniffi.so"
OUTPUT_DIRECTORY="./uniffi-bindings"
for LANGUAGE in "swift" "kotlin" "python"
do
cargo run \
--manifest-path="./uniffi-bindgen/Cargo.toml" -- \
generate ./radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl \
--language $LANGUAGE \
--out-dir $OUTPUT_DIRECTORY \
--lib-file $DYNAMIC_LIBRARY_PATH
done
cargo run \
--manifest-path="./uniffi-bindgen-cs/bindgen/Cargo.toml" -- \
./radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl \
--out-dir $OUTPUT_DIRECTORY \
--lib-file $DYNAMIC_LIBRARY_PATH
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: uniffi-bindings
path: uniffi-bindings
build-test-kit:
needs: [build]
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Generate Test Kit
run: cargo run
working-directory: generator
- name: Upload Generated Artifacts
uses: actions/upload-artifact@v3
with:
name: "test-kit"
path: "./generator/output"
publish-swift-spm:
needs: [build, generate-uniffi-bindings]
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout Swift Engine Toolkit
uses: actions/checkout@v3
with:
repository: radixdlt/swift-engine-toolkit
token: ${{ secrets.RADIX_BOT_PAT }}
path: ./swift-engine-toolkit
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Build XCFramework
working-directory: artifacts
run: |
PLISTBUDDY_EXEC="/usr/libexec/PlistBuddy"
# The name of the crate that we will be creating the XCFramework and the bindings for.
CRATE_NAME="radix-engine-toolkit-uniffi"
# Creating the include directory - this will be used in the XCFramework build steps
mkdir include
cp uniffi-bindings/radix_engine_toolkit_uniffiFFI.h include/radix_engine_toolkit_uniffiFFI.h
# Replace the generated module map with the one we actually want.
echo "framework module RadixEngineToolkit {" > "./include/module.modulemap"
echo " umbrella header \"radix_engine_toolkit_uniffiFFI.h\"" >> "./include/module.modulemap"
echo " export *" >> "./include/module.modulemap"
echo " module * { export * }" >> "./include/module.modulemap"
echo "}" >> "./include/module.modulemap"
# Using Lipo to combine some of the libraries into fat libraries.
mkdir ./macos-arm64_x86_64/
mkdir ./ios-simulator-arm64_x86_64
lipo -create \
"./$CRATE_NAME-aarch64-apple-darwin/libradix_engine_toolkit_uniffi.dylib" \
"./$CRATE_NAME-x86_64-apple-darwin/libradix_engine_toolkit_uniffi.dylib" \
-o "./macos-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib"
lipo -create \
"./$CRATE_NAME-aarch64-apple-ios-sim/libradix_engine_toolkit_uniffi.dylib" \
"./$CRATE_NAME-x86_64-apple-ios/libradix_engine_toolkit_uniffi.dylib" \
-o "./ios-simulator-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib"
for TARGET_TRIPLE in "$CRATE_NAME-aarch64-apple-ios" "macos-arm64_x86_64" "ios-simulator-arm64_x86_64"
do
FRAMEWORK_PATH="$TARGET_TRIPLE/RadixEngineToolkit.framework"
mkdir -p $FRAMEWORK_PATH/Headers
mkdir -p $FRAMEWORK_PATH/Modules
# Move the dylib into the framework, renaming it to match the framework name
mv $TARGET_TRIPLE/libradix_engine_toolkit_uniffi.dylib $FRAMEWORK_PATH/RadixEngineToolkit
# Copy headers to Headers folder and modulemap to Modules folder
cp include/radix_engine_toolkit_uniffiFFI.h $FRAMEWORK_PATH/Headers/
cp include/module.modulemap $FRAMEWORK_PATH/Modules/
"$PLISTBUDDY_EXEC" -c "Add :CFBundleIdentifier string com.radixpublishing.RadixEngineToolkit" \
-c "Add :CFBundleName string RadixEngineToolkit" \
-c "Add :CFBundleDisplayName string RadixEngineToolkit" \
-c "Add :CFBundleVersion string 1.0.0" \
-c "Add :CFBundleShortVersionString string 1.0.0" \
-c "Add :CFBundlePackageType string FMWK" \
-c "Add :CFBundleExecutable string RadixEngineToolkit" \
-c "Add :MinimumOSVersion string 11.0" \
-c "Add :CFBundleSupportedPlatforms array" \
$FRAMEWORK_PATH/Info.plist
case $TARGET_TRIPLE in
aarch64-apple-ios)
"$PLISTBUDDY_EXEC" -c "Add :CFBundleSupportedPlatforms:0 string iPhoneOS" $FRAMEWORK_PATH/Info.plist
;;
ios-simulator-arm64_x86_64)
"$PLISTBUDDY_EXEC" -c "Add :CFBundleSupportedPlatforms:0 string iPhoneOS" \
-c "Add :CFBundleSupportedPlatforms:1 string iPhoneSimulator" \
$FRAMEWORK_PATH/Info.plist
;;
macos-arm64_x86_64)
"$PLISTBUDDY_EXEC" -c "Add :CFBundleSupportedPlatforms:0 string MacOSX" $FRAMEWORK_PATH/Info.plist
;;
*)
;;
esac
install_name_tool -id @rpath/RadixEngineToolkit.framework/RadixEngineToolkit $FRAMEWORK_PATH/RadixEngineToolkit
done
# Creating the XCFramework
xcodebuild -create-xcframework \
-framework "./$CRATE_NAME-aarch64-apple-ios/RadixEngineToolkit.framework" \
-framework "./macos-arm64_x86_64/RadixEngineToolkit.framework" \
-framework "./ios-simulator-arm64_x86_64/RadixEngineToolkit.framework" \
-output "RadixEngineToolkit.xcframework"
- name: Publish to Swift Engine Toolkit
run: |
BRANCH=${{ github.ref_name }}
BUILD_CRATE_MANIFEST="./radix-engine-toolkit-uniffi/Cargo.toml"
CRATE_VERSION=$(cargo read-manifest --manifest-path $BUILD_CRATE_MANIFEST | jq -r '.version')
LAST_COMMIT_SHA=$(git rev-parse --short HEAD)
SPM_VERSION="$CRATE_VERSION-$LAST_COMMIT_SHA"
SET_UPSTREAM_FLAG=""
cd swift-engine-toolkit
REMOTE_BRANCH=$(git ls-remote --heads origin $BRANCH)
if [ -z "$REMOTE_BRANCH" ]
then
git checkout -b $BRANCH
# Allows creating branch on remote
SET_UPSTREAM_FLAG="-u"
else
git fetch origin $BRANCH
git checkout $BRANCH
git pull origin $BRANCH
fi
cp -R ../artifacts/RadixEngineToolkit.xcframework ./Sources/RadixEngineToolkit
cp -R ../artifacts/uniffi-bindings/radix_engine_toolkit_uniffi.swift ./Sources/EngineToolkit/radix_engine_toolkit_uniffi.swift
sed -i "" -E 's/[[:<:]]radix_engine_toolkit_uniffiFFI[[:>:]]/RadixEngineToolkit/g' ./Sources/EngineToolkit/radix_engine_toolkit_uniffi.swift
python3 add_license.py
git add .
git commit -m "Update RET from $BRANCH - $LAST_COMMIT_SHA"
git tag -a $SPM_VERSION -m "RET update from $BRANCH - $LAST_COMMIT_SHA"
git push $SET_UPSTREAM_FLAG origin $BRANCH
git push origin $SPM_VERSION
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: "RadixEngineToolkit.xcframework"
path: "./artifacts/RadixEngineToolkit.xcframework"
publish-kotlin-maven-github:
needs: [build, generate-uniffi-bindings]
runs-on: macos-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Create Kotlin Library
working-directory: interop/kotlin
run:
./bootstrap.sh
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: 8.0.2
arguments: wrapper -p interop/kotlin/ret-kotlin
- name: Build and publish Kotlin
uses: gradle/gradle-build-action@v2
with:
arguments: build publishMavenGithubPublicationToGitHubPackagesRepository
build-root-directory: interop/kotlin/ret-kotlin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-kotlin-maven-central:
needs: [build, generate-uniffi-bindings]
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Install AWS CLI
uses: unfor19/install-aws-cli-action@ee0eb151cf1bca186ccf8c35d314b08d62e0e878 # v1
with:
version: 2
- name: Checkout actions-oidc-debugger
uses: actions/checkout@v3
with:
repository: github/actions-oidc-debugger
ref: main
token: ${{ github.token }}
path: ./.github/actions/actions-oidc-debugger
- name: Debug OIDC Claims
uses: ./.github/actions/actions-oidc-debugger
with:
audience: 'https://github.com/github'
- name: Configure AWS credentials to fetch secrets
uses: aws-actions/configure-aws-credentials@97271860067ec931c45b8d104fbf0d15954ab85c # branch v1-node16
with:
role-to-assume: ${{ secrets.AWS_RET_ROLE_NAME }}
aws-region: eu-west-2
role-session-name: ret-${{ github.run_id }}-${{ github.run_attempt }}
- name: Fetch AWS secrets
uses: aws-actions/aws-secretsmanager-get-secrets@287592d14d9c9c48199db83dc182ae12af3df18e # v1.0.1
with:
parse-json-secrets: true
secret-ids: |
MAVEN_CENTRAL,${{ secrets.MAVEN_CENTRAL_SECRET_ID }},
GPG_PASSPHRASE,${{ secrets.GPG_PASSPHRASE_SECRET_ID }}
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Create Kotlin Library
working-directory: interop/kotlin
run: |
./bootstrap.sh
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: 8.0.2
arguments: wrapper -p interop/kotlin/ret-kotlin
- name: Get GPG key to sign
working-directory: interop/kotlin/ret-kotlin
run: |
aws secretsmanager get-secret-value --secret-id ${{ secrets.GPG_BINARY_SECRET_ID }} --query SecretBinary --output text | base64 --decode > rdx-secring.gpg
cp rdx-secring.gpg lib/rdx-secring.gpg
- name: Build and publish Kotlin
uses: gradle/gradle-build-action@v2
with:
arguments: build publishMavenCentralPublicationToMavenCentralRepository -Psigning.secretKeyRingFile=rdx-secring.gpg -Psigning.password=${{ env.GPG_PASSPHRASE_GPG_PASSPHRASE }} -Psigning.keyId=${{ secrets.GPG_KEY_ID }} -PossrhUsername=${{ env.MAVEN_CENTRAL_MAVEN_CENTRAL_USERNAME }} -PossrhPassword=${{ env.MAVEN_CENTRAL_MAVEN_CENTRAL_PASSWORD }}
build-root-directory: interop/kotlin/ret-kotlin
publish-android-maven:
needs: [build, generate-uniffi-bindings]
runs-on: macos-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Create Android Library
working-directory: interop/android
run:
./bootstrap.sh
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: 8.0.2
arguments: wrapper -p interop/android/ret-android
- name: Build and publish Android
uses: gradle/gradle-build-action@v2
with:
arguments: build publish
build-root-directory: interop/android/ret-android
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-dotnet-nuget:
needs: [build, generate-uniffi-bindings]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Setup .NET SDK
uses: actions/setup-dotnet@5a3fa01c67e60dba8f95e2878436c7151c4b5f01
with:
dotnet-version: 7.0.x
- name: Configure Version
run: |
BRANCH=${{ github.ref_name }}
BUILD_CRATE_MANIFEST="./radix-engine-toolkit-uniffi/Cargo.toml"
CRATE_VERSION=$(cargo read-manifest --manifest-path $BUILD_CRATE_MANIFEST | jq -r '.version')
LAST_COMMIT_SHA=$(git rev-parse --short HEAD)
VERSION="$CRATE_VERSION-commit-$LAST_COMMIT_SHA"
sed -i "s/\(<version>\)[^<>]*\(<\/version>\)/\1$VERSION\2/g" ./interop/csharp/RadixDlt.RadixEngineToolkit.nuspec
echo "Configured Version: $VERSION"
- name: Copying UniFFI Bindings
run: |
# We copy the UniFFI bindings to the interop/csharp/generated/ directory
mkdir ./interop/csharp/generated
cp ./artifacts/uniffi-bindings/radix_engine_toolkit_uniffi.cs ./interop/csharp/generated
- name: Copying Libraries
run: |
# We copy the UniFFI bindings to the interop/csharp/native directory
mkdir ./interop/csharp/native
mkdir ./interop/csharp/native/x86_64-unknown-linux-gnu
cp ./artifacts/radix-engine-toolkit-uniffi-x86_64-unknown-linux-gnu/libradix_engine_toolkit_uniffi.so ./interop/csharp/native/x86_64-unknown-linux-gnu
mkdir ./interop/csharp/native/aarch64-unknown-linux-gnu
cp ./artifacts/radix-engine-toolkit-uniffi-aarch64-unknown-linux-gnu/libradix_engine_toolkit_uniffi.so ./interop/csharp/native/aarch64-unknown-linux-gnu
mkdir ./interop/csharp/native/x86_64-apple-darwin
cp ./artifacts/radix-engine-toolkit-uniffi-x86_64-apple-darwin/libradix_engine_toolkit_uniffi.dylib ./interop/csharp/native/x86_64-apple-darwin
mkdir ./interop/csharp/native/aarch64-apple-darwin
cp ./artifacts/radix-engine-toolkit-uniffi-aarch64-apple-darwin/libradix_engine_toolkit_uniffi.dylib ./interop/csharp/native/aarch64-apple-darwin
mkdir ./interop/csharp/native/x86_64-pc-windows-gnu
cp ./artifacts/radix-engine-toolkit-uniffi-x86_64-pc-windows-gnu/radix_engine_toolkit_uniffi.dll ./interop/csharp/native/x86_64-pc-windows-gnu
- name: NuGet Pack
working-directory: interop/csharp/
run: dotnet pack --configuration Release --output .
- name: Publish Packages
working-directory: interop/csharp/
run: dotnet nuget push RadixDlt.RadixEngineToolkit.*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ORG_API_KEY }}
publish-python-package:
needs: [build, generate-uniffi-bindings]
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Fetch secrets
uses: radixdlt/public-iac-resuable-artifacts/fetch-secrets@main
with:
role_name: ${{ secrets.PYPI_SECRET_ROLE_NAME }}
app_name: 'radix-engine-toolkit'
step_name: 'pypi-credentials'
secret_prefix: 'PYPI'
secret_name: ${{ secrets.PYPI_SECRET_NAME }}
parse_json: true
- name: Print Env
run: env
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install Dependencies
run: |
python3 -m pip install black build twine
sudo apt-get install mypy
- name: Copy bindings
run: |
mkdir ./interop/python/radix_engine_toolkit
cp \
./artifacts/uniffi-bindings/radix_engine_toolkit_uniffi.py \
./interop/python/radix_engine_toolkit/__init__.py
- name: Dynamic Library Script replacement
run: |
python3 ./interop/python/replacement.py ./interop/python/radix_engine_toolkit/__init__.py
rm ./interop/python/replacement.py
- name: Stubs generation
run: |
stubgen \
./interop/python/radix_engine_toolkit/__init__.py \
--output ./interop/python/
- name: Code Formatting
run: |
black ./interop/python/
- name: Copy Dynamic Libraries
run: |
cp \
./artifacts/radix-engine-toolkit-uniffi-aarch64-apple-darwin/libradix_engine_toolkit_uniffi.dylib \
./interop/python/radix_engine_toolkit/aarch64-apple-darwin
cp \
./artifacts/radix-engine-toolkit-uniffi-x86_64-apple-darwin/libradix_engine_toolkit_uniffi.dylib \
./interop/python/radix_engine_toolkit/x86_64-apple-darwin
cp \
./artifacts/radix-engine-toolkit-uniffi-aarch64-unknown-linux-gnu/libradix_engine_toolkit_uniffi.so \
./interop/python/radix_engine_toolkit/aarch64-unknown-linux-gnu
cp \
./artifacts/radix-engine-toolkit-uniffi-x86_64-unknown-linux-gnu/libradix_engine_toolkit_uniffi.so \
./interop/python/radix_engine_toolkit/x86_64-unknown-linux-gnu
cp \
./artifacts/radix-engine-toolkit-uniffi-x86_64-pc-windows-gnu/radix_engine_toolkit_uniffi.dll \
./interop/python/radix_engine_toolkit/x86_64-pc-windows-gnu.dll
- name: Build Package
working-directory: ./interop/python/
run: python3 -m build --wheel
- name: Check Builds
working-directory: ./interop/python/
run: |
python3 -m twine check dist/*
- name: Publish
working-directory: ./interop/python/
env:
TWINE_USERNAME: ${{ env.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ env.PYPI_PASSWORD }}
run: |
python3 -m twine upload dist/* --verbose