diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ff8f6ef2..60ab7c91 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,15 +20,25 @@ on: type: string required: true description: The version to use for the C# package + ref: + type: string + default: "main" + description: The branch, tag, or sha to checkout - default to "main". push: + # TODO: Remove! # Temporary due to workflow dispatch restrictions env: CARGO_TERM_COLOR: always + # TODO: Remove! + # Temporary due to workflow dispatch restrictions + INPUT_REF: chore/restructure jobs: build-schemas-and-test-kit: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ env.INPUT_REF }} - name: Install Rust Toolchain uses: actions-rs/toolchain@v1 with: @@ -37,6 +47,8 @@ jobs: profile: minimal - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 + - name: Whats here + run: ls -lah - name: Generate Test Kit run: cargo run env: @@ -48,4 +60,128 @@ jobs: uses: actions/upload-artifact@v3 with: name: "schemas-and-test-kit" - path: "crates/generator/output" \ No newline at end of file + path: "crates/generator/output" + 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: + - uses: actions/checkout@v4 + with: + ref: ${{ env.INPUT_REF }} + - name: Install Rust Toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2023-11-24 + override: true + profile: minimal + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.3 + + # 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: crate/${{ matrix.build-target.crate }} + env: + # The minumum iOS version of the iOS builds - has no effect outside + # iOS builds. + IPHONEOS_DEPLOYMENT_TARGET: "11.0" + # Enable sccache + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" + run: | + echo $IPHONEOS_DEPLOYMENT_TARGET + cargo build \ + --target ${{ matrix.build-target.target-triple }} \ + --release \ No newline at end of file