Skip to content

Commit

Permalink
Merge pull request #52 from radixdlt/release/rcnet-v1
Browse files Browse the repository at this point in the history
Merge Release/rcnet v1
  • Loading branch information
0xOmarA authored Mar 31, 2023
2 parents 295c8d1 + ef27344 commit 43bcc9e
Show file tree
Hide file tree
Showing 210 changed files with 46,923 additions and 21,250 deletions.
151 changes: 121 additions & 30 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ name: Build

on:
push:

branches:
- release/rcnet-v1
- develop
- main
pull_request:
branches:
- release/rcnet-v1
- develop
- main

Expand All @@ -21,75 +25,82 @@ jobs:
custom-linker: ""
custom-compiler: /usr/local/opt/llvm/bin/clang
custom-archiver: /usr/local/opt/llvm/bin/llvm-ar
features: "jni"
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: x86_64-apple-ios
custom-linker: ""
custom-compiler: /usr/local/opt/llvm/bin/clang
custom-archiver: /usr/local/opt/llvm/bin/llvm-ar
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: x86_64-apple-darwin
custom-linker: ""
custom-compiler: /usr/local/opt/llvm/bin/clang
custom-archiver: /usr/local/opt/llvm/bin/llvm-ar
features: "jni"
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: aarch64-apple-ios
custom-linker: ""
custom-compiler: /usr/local/opt/llvm/bin/clang
custom-archiver: /usr/local/opt/llvm/bin/llvm-ar
features: "jni"
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: aarch64-apple-ios-sim
custom-linker: ""
custom-compiler: /usr/local/opt/llvm/bin/clang
custom-archiver: /usr/local/opt/llvm/bin/llvm-ar
features: "jni"
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: x86_64-pc-windows-gnu
custom-linker: ""
custom-compiler: x86_64-w64-mingw32-gcc
custom-archiver: x86_64-w64-mingw32-ar
features: "jni"
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: x86_64-unknown-linux-gnu
custom-linker: x86_64-unknown-linux-gnu-gcc
custom-compiler: /usr/local/opt/llvm/bin/clang
custom-archiver: /usr/local/opt/llvm/bin/llvm-ar
features: "jni"
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: aarch64-unknown-linux-gnu
custom-linker: aarch64-unknown-linux-gnu-gcc
custom-compiler: aarch64-unknown-linux-gnu-gcc
custom-archiver: aarch64-unknown-linux-gnu-gcc-ar
features: "jni"
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: i686-unknown-linux-gnu
custom-linker: i686-unknown-linux-gnu-gcc
custom-compiler: i686-unknown-linux-gnu-gcc
custom-archiver: i686-unknown-linux-gnu-gcc-ar
features: "jni"
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: wasm32-unknown-unknown
custom-linker: ""
custom-compiler: /usr/local/opt/llvm/bin/clang
custom-archiver: /usr/local/opt/llvm/bin/llvm-ar
features: "jni"
features: ""
- crate: native-json-interface
target-triple: aarch64-linux-android
custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang
custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang
custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ar
features: "jni"
custom-linker: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang
custom-compiler: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang
custom-archiver: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: armv7-linux-androideabi
custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang
custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang
custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar
features: "jni"
custom-linker: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang
custom-compiler: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang
custom-archiver: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar
features: "jni,radix-engine"
- crate: native-json-interface
target-triple: i686-linux-android
custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang
custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang
custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android-ar
features: "jni"
custom-linker: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang
custom-compiler: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang
custom-archiver: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar
features: "jni,radix-engine"

steps:
- uses: FranzDiebold/github-env-vars-action@v2
- name: Checkout
uses: actions/checkout@v3

Expand All @@ -99,13 +110,11 @@ jobs:
brew install llvm
brew install x86_64-unknown-linux-gnu
brew install mingw-w64
brew install --cask android-ndk
brew tap messense/macos-cross-toolchains
brew install aarch64-unknown-linux-gnu
brew install i686-unknown-linux-gnu
wget https://dl.google.com/android/repository/android-ndk-r22b-darwin-x86_64.zip
unzip -q android-ndk-r22b-darwin-x86_64.zip -d $HOME/android-ndk
- name: Install Rust Toolchain
run: |
Expand Down Expand Up @@ -136,12 +145,23 @@ jobs:
export CC=${{ matrix.build-target.custom-compiler }}
export AR=${{ matrix.build-target.custom-archiver }}
export features=$${{ matrix.build-target.features }}
export features=${features:="default"}
if [ -z "${{ matrix.build-target.features }}" ];
then
echo "No special feature handling"
export features=""
else
export features="--features ${{ matrix.build-target.features }}"
echo "Special feature handling"
echo $features
fi
cargo build \
cargo +nightly build \
-Z build-std=std,panic_abort \
-Z build-std-features=panic_immediate_abort \
--target ${{ matrix.build-target.target-triple }} \
--release
--no-default-features \
--release $features
unset $LINKER_ENVIRONMENT_VARIABLE
export CC="/usr/local/opt/llvm/bin/clang"
Expand Down Expand Up @@ -177,6 +197,76 @@ jobs:
name: "${{ matrix.build-target.crate }}-${{ matrix.build-target.target-triple }}.tar.gz"
path: "./${{matrix.build-target.crate}}/target/${{ matrix.build-target.target-triple }}/release/${{ matrix.build-target.target-triple }}.tar.gz"

build-xc-framework:
needs: [build]
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Extract Artifacts
working-directory: artifacts
run: |
mkdir native
for d in native-json-interface-*.tar.gz; do
mv ./$d/* ./native/
done
cd native
for f in *.tar.gz; do
fn=`echo "$f" | cut -d'.' -f 1`
mkdir "$fn"
tar -xvzf "$f" --directory="$fn";
done
- name: Building XCFramework
working-directory: artifacts
run: |
cd native
# The name of the crate that we are building
CRATE_NAME="native-json-interface"
# Creating the two directories where the temporary FAT libraries will be stored
mkdir ./macos-arm64_x86_64/
mkdir ./ios-simulator-arm64_x86_64
# Creating the fat libraries
lipo -create \
"./aarch64-apple-darwin/libradix_engine_toolkit.a" \
"./x86_64-apple-darwin/libradix_engine_toolkit.a" \
-o "./macos-arm64_x86_64/libradix_engine_toolkit.a"
lipo -create \
"./aarch64-apple-ios-sim/libradix_engine_toolkit.a" \
"./x86_64-apple-ios/libradix_engine_toolkit.a" \
-o "./ios-simulator-arm64_x86_64/libradix_engine_toolkit.a"
# Copying the "include" directory from its origin into the fat library directory
cp -r ./aarch64-apple-darwin/include ./macos-arm64_x86_64/
cp -r ./aarch64-apple-ios-sim/include ./ios-simulator-arm64_x86_64/
# Creating the XC Framework
xcodebuild -create-xcframework \
-library "./aarch64-apple-ios/libradix_engine_toolkit.a" \
-headers "./aarch64-apple-ios/include" \
-library "./macos-arm64_x86_64/libradix_engine_toolkit.a" \
-headers "./macos-arm64_x86_64/include" \
-library "./ios-simulator-arm64_x86_64/libradix_engine_toolkit.a" \
-headers "./ios-simulator-arm64_x86_64/include" \
-output "./RadixEngineToolkit.xcframework"
tar -czf "./RadixEngineToolkit.xcframework.tar.gz" ./RadixEngineToolkit.xcframework
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: "RadixEngineToolkit.xcframework.tar.gz"
path: "./artifacts/native/RadixEngineToolkit.xcframework.tar.gz"

publish-csharp-nuget:
needs: [build]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -208,10 +298,11 @@ jobs:
dotnet-version: 7.0.x
- name: Configure Version
run: |
CI_RUN_NUMBER=${{ github.run_number }}
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's/\//-/g')
GIT_COMMIT=$(git log -1 --format=%h )
CORE_VERSION=$(cat radix-engine-toolkit/Cargo.toml | grep -e '^version' | cut -d'"' -f 2)
VERSION_SUFFIX=${GIT_BRANCH}-${GIT_COMMIT}
VERSION_SUFFIX=build.${CI_RUN_NUMBER}
VERSION=${CORE_VERSION}-${VERSION_SUFFIX}
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ jobs:
for filename in $(find ./out/schema -type f -name "*.json" -exec basename {} \;);
do
cmp --quiet out/schema/$filename ./old-out/schema/$filename && exit 0 || exit 1
done
done
exit 0
28 changes: 28 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"rust-analyzer.linkedProjects": [
"Cargo.toml",
"native-json-interface/Cargo.toml",
"cli-json-interface/Cargo.toml",
"benches/Cargo.toml",
],
"cSpell.words": [
"bech",
"Decompilation",
"decompile",
"decompiled",
"eddsa",
"instantiatable",
"Instrumenter",
"persistable",
"repr",
"Sbor",
"Scrypto",
"Secp",
"Substate",
"substates",
"Untimed",
"virtualizable",
"Wasmer",
"Wasmi"
]
}
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
members = [
"radix-engine-toolkit",
"schema",
"serializable",
"toolkit-derive",
]
30 changes: 30 additions & 0 deletions benches/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "benches"
version = "0.1.0"
edition = "2021"
build = "build.rs"

[workspace]
members = []

[dependencies]
serde = "1.0.159"
serde_json = "1.0.95"

radix-engine-toolkit = { path = "../radix-engine-toolkit" }

[dev-dependencies]
scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148" }
native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148", package = "transaction" }
criterion = "0.4.0"
hex = "0.4.3"

[profile.bench]
debug = true
# lto = true
# codegen-units = 1
# opt-level = 3

[[bench]]
name = "decompilation_benchmark"
harness = false
Loading

0 comments on commit 43bcc9e

Please sign in to comment.