From 25a6d29d239dd49a9bce7e57ea2957469f109cb4 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Fri, 28 Jun 2024 15:17:53 +0100 Subject: [PATCH 01/12] update to 0.0.8 --- bindings/java/java_code/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/java/java_code/build.gradle b/bindings/java/java_code/build.gradle index ec08cf56..7e477cfd 100644 --- a/bindings/java/java_code/build.gradle +++ b/bindings/java/java_code/build.gradle @@ -8,7 +8,7 @@ plugins { } group = 'io.github.crate-crypto' -version = '0.0.7' // x-release-please-version +version = '0.0.8' // x-release-please-version java { From abe935a8d4d1d48dc817d551b9d979e456835ff0 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Mon, 8 Jul 2024 10:16:59 +0100 Subject: [PATCH 02/12] Update bindings/java/java_code/build.gradle --- bindings/java/java_code/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/java/java_code/build.gradle b/bindings/java/java_code/build.gradle index 7e477cfd..4d2eb7dd 100644 --- a/bindings/java/java_code/build.gradle +++ b/bindings/java/java_code/build.gradle @@ -8,7 +8,7 @@ plugins { } group = 'io.github.crate-crypto' -version = '0.0.8' // x-release-please-version +version = '0.0.9' // x-release-please-version java { From ce0de06be49bd626d679ebeaa8be7269d4eae5cf Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 29 Jul 2024 10:01:33 +1000 Subject: [PATCH 03/12] add sha2 --- Cargo.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.lock b/Cargo.lock index a9c8827e..e3531bd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -354,6 +354,7 @@ dependencies = [ "hex", "rand", "rayon", + "sha2", ] [[package]] From ecc9b8321c3275221896c0c526ef1cb909ea9b90 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Mon, 29 Jul 2024 12:38:20 +1000 Subject: [PATCH 04/12] Update bindings/java/java_code/build.gradle --- bindings/java/java_code/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/java/java_code/build.gradle b/bindings/java/java_code/build.gradle index 4b2b31e3..607a340d 100644 --- a/bindings/java/java_code/build.gradle +++ b/bindings/java/java_code/build.gradle @@ -8,7 +8,7 @@ plugins { } group = 'io.github.crate-crypto' -version = '0.0.9' // x-release-please-version +version = '0.0.10' // x-release-please-version java { From 01a29418f7dc85c5f19dbd7649a02907ecf84ee2 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Mon, 29 Jul 2024 10:29:16 +1000 Subject: [PATCH 05/12] switch to nim-action v2 (#118) --- .github/workflows/test-nim-bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-nim-bindings.yml b/.github/workflows/test-nim-bindings.yml index 54f2f304..13bef522 100644 --- a/.github/workflows/test-nim-bindings.yml +++ b/.github/workflows/test-nim-bindings.yml @@ -33,7 +33,7 @@ jobs: shell: bash - name: Setup Nim - uses: jiro4989/setup-nim-action@v1 + uses: jiro4989/setup-nim-action@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} nim-version: 'stable' From 4ecd62c93f03493f6d5e7a4da0f069a415615d71 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Mon, 29 Jul 2024 10:57:32 +1000 Subject: [PATCH 06/12] chore: Test workflow calls the release workflow as a dry-run for node (#107) * call the release file * modify workflow to work on pull requests * remove default value * rename workflow * use publish workflow only when release is set from a workflow dispatch * modify workflow name --- .github/workflows/release-node-bindings.yml | 14 +++++--- .github/workflows/test-node-bindings.yml | 37 --------------------- 2 files changed, 9 insertions(+), 42 deletions(-) delete mode 100644 .github/workflows/test-node-bindings.yml diff --git a/.github/workflows/release-node-bindings.yml b/.github/workflows/release-node-bindings.yml index 6e64cd86..bcc8ce26 100644 --- a/.github/workflows/release-node-bindings.yml +++ b/.github/workflows/release-node-bindings.yml @@ -1,4 +1,4 @@ -name: Node Napi Cross compile testing +name: Node Bindings env: DEBUG: napi:* APP_NAME: node-eth-kzg @@ -12,11 +12,15 @@ concurrency: cancel-in-progress: true on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] workflow_dispatch: inputs: ref: description: The reference (branch/tag/commit) to checkout - required: true + required: false release-type: type: choice required: false @@ -51,7 +55,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: ${{ inputs.ref }} + ref: ${{ inputs.ref || github.ref }} - name: Setup node uses: actions/setup-node@v4 with: @@ -132,7 +136,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: ${{ inputs.ref }} + ref: ${{ inputs.ref || github.ref }} - name: Setup node uses: actions/setup-node@v4 with: @@ -230,7 +234,7 @@ jobs: - name: Move artifacts run: yarn artifacts - name: Publish - if: ${{ inputs.release-type != 'none' }} + if: ${{ inputs.release-type != 'none' && github.event_name == 'workflow_dispatch' }} run: | # TODO: We could remove the yarnpkg registry and set the npmregistry # TODO: globally, by doing: yarn config set registry diff --git a/.github/workflows/test-node-bindings.yml b/.github/workflows/test-node-bindings.yml deleted file mode 100644 index 3573fa8f..00000000 --- a/.github/workflows/test-node-bindings.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Test Node bindings - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build-and-test: - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: '20' - - - name: Build - working-directory: bindings/node - run: yarn && yarn install && yarn build - - - name: Run tests - working-directory: bindings/node - run: yarn test From 5c1bf0a679a35d74e8f02eecd495ca21c1e11c70 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Mon, 29 Jul 2024 10:59:59 +1000 Subject: [PATCH 07/12] chore: cleanup java workflow names and remove redundant java test workflow (#116) * remove test-java bindings * rename java workflow * rename * use compile_all_targets_java.sh --- .github/scripts/compile_all_targets_java.sh | 41 ++++++++++++---- .../scripts/compile_all_targets_java_new.sh | 39 --------------- .github/workflows/release-java-bindings.yml | 6 +-- .github/workflows/test-java-bindings.yml | 47 ------------------- 4 files changed, 35 insertions(+), 98 deletions(-) delete mode 100755 .github/scripts/compile_all_targets_java_new.sh delete mode 100644 .github/workflows/test-java-bindings.yml diff --git a/.github/scripts/compile_all_targets_java.sh b/.github/scripts/compile_all_targets_java.sh index 21313f15..9ee2d032 100755 --- a/.github/scripts/compile_all_targets_java.sh +++ b/.github/scripts/compile_all_targets_java.sh @@ -2,15 +2,38 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" - -# Compile dynamic libraries for all relevant targets -# and place them in the `./bindings/java/java_code/src/main/resources` directory - OUT_DIR="$PROJECT_ROOT/bindings/java/java_code/src/main/resources" LIB_TYPE="dynamic" LIB_NAME="java_eth_kzg" -$PROJECT_ROOT/scripts/compile_to_native.sh Darwin arm64 $LIB_NAME $LIB_TYPE $OUT_DIR -$PROJECT_ROOT/scripts/compile_to_native.sh Darwin x86_64 $LIB_NAME $LIB_TYPE $OUT_DIR -$PROJECT_ROOT/scripts/compile_to_native.sh Windows x86_64 $LIB_NAME $LIB_TYPE $OUT_DIR -$PROJECT_ROOT/scripts/compile_to_native.sh Linux x86_64 $LIB_NAME $LIB_TYPE $OUT_DIR -$PROJECT_ROOT/scripts/compile_to_native.sh Linux arm64 $LIB_NAME $LIB_TYPE $OUT_DIR \ No newline at end of file + +# Check if a target is provided +if [ $# -eq 0 ]; then + echo "Please provide a target architecture." + echo "Supported targets: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, aarch64-apple-darwin, x86_64-apple-darwin, x86_64-pc-windows-gnu" + exit 1 +fi + +TARGET=$1 + +case $TARGET in + "x86_64-unknown-linux-gnu") + $PROJECT_ROOT/scripts/compile_to_native.sh Linux x86_64 $LIB_NAME $LIB_TYPE $OUT_DIR zigbuild + ;; + "aarch64-unknown-linux-gnu") + $PROJECT_ROOT/scripts/compile_to_native.sh Linux arm64 $LIB_NAME $LIB_TYPE $OUT_DIR zigbuild + ;; + "aarch64-apple-darwin") + $PROJECT_ROOT/scripts/compile_to_native.sh Darwin arm64 $LIB_NAME $LIB_TYPE $OUT_DIR zigbuild + ;; + "x86_64-apple-darwin") + $PROJECT_ROOT/scripts/compile_to_native.sh Darwin x86_64 $LIB_NAME $LIB_TYPE $OUT_DIR zigbuild + ;; + "x86_64-pc-windows-gnu") + $PROJECT_ROOT/scripts/compile_to_native.sh Windows x86_64 $LIB_NAME $LIB_TYPE $OUT_DIR + ;; + *) + echo "Unsupported target: $TARGET" + echo "Supported targets: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, aarch64-apple-darwin, x86_64-apple-darwin, x86_64-pc-windows-gnu" + exit 1 + ;; +esac \ No newline at end of file diff --git a/.github/scripts/compile_all_targets_java_new.sh b/.github/scripts/compile_all_targets_java_new.sh deleted file mode 100755 index 9ee2d032..00000000 --- a/.github/scripts/compile_all_targets_java_new.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" -OUT_DIR="$PROJECT_ROOT/bindings/java/java_code/src/main/resources" -LIB_TYPE="dynamic" -LIB_NAME="java_eth_kzg" - -# Check if a target is provided -if [ $# -eq 0 ]; then - echo "Please provide a target architecture." - echo "Supported targets: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, aarch64-apple-darwin, x86_64-apple-darwin, x86_64-pc-windows-gnu" - exit 1 -fi - -TARGET=$1 - -case $TARGET in - "x86_64-unknown-linux-gnu") - $PROJECT_ROOT/scripts/compile_to_native.sh Linux x86_64 $LIB_NAME $LIB_TYPE $OUT_DIR zigbuild - ;; - "aarch64-unknown-linux-gnu") - $PROJECT_ROOT/scripts/compile_to_native.sh Linux arm64 $LIB_NAME $LIB_TYPE $OUT_DIR zigbuild - ;; - "aarch64-apple-darwin") - $PROJECT_ROOT/scripts/compile_to_native.sh Darwin arm64 $LIB_NAME $LIB_TYPE $OUT_DIR zigbuild - ;; - "x86_64-apple-darwin") - $PROJECT_ROOT/scripts/compile_to_native.sh Darwin x86_64 $LIB_NAME $LIB_TYPE $OUT_DIR zigbuild - ;; - "x86_64-pc-windows-gnu") - $PROJECT_ROOT/scripts/compile_to_native.sh Windows x86_64 $LIB_NAME $LIB_TYPE $OUT_DIR - ;; - *) - echo "Unsupported target: $TARGET" - echo "Supported targets: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, aarch64-apple-darwin, x86_64-apple-darwin, x86_64-pc-windows-gnu" - exit 1 - ;; -esac \ No newline at end of file diff --git a/.github/workflows/release-java-bindings.yml b/.github/workflows/release-java-bindings.yml index 15c1a5bd..0a218388 100644 --- a/.github/workflows/release-java-bindings.yml +++ b/.github/workflows/release-java-bindings.yml @@ -1,4 +1,4 @@ -name: Java Cross-platform Build and Test +name: Java Bindings on: push: @@ -59,8 +59,8 @@ jobs: run: cargo binstall --no-confirm cargo-zigbuild - name: Run compile script run: | - chmod +x .github/scripts/compile_all_targets_java_new.sh - .github/scripts/compile_all_targets_java_new.sh ${{ matrix.target }} + chmod +x .github/scripts/compile_all_targets_java.sh + .github/scripts/compile_all_targets_java.sh ${{ matrix.target }} shell: bash - name: Upload dynamic libs uses: actions/upload-artifact@v4 diff --git a/.github/workflows/test-java-bindings.yml b/.github/workflows/test-java-bindings.yml deleted file mode 100644 index ebc5b8db..00000000 --- a/.github/workflows/test-java-bindings.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Test Java bindings - -on: - push: - branches: - - master - pull_request: - branches: - - master - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build-and-test: - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Rust - uses: dtolnay/rust-toolchain@stable - - - name: Run compile script - run: ./scripts/compile.sh java - shell: bash - - - name: Set up JDK - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '17' - - - name: Build with Gradle (no tests) - run: ./gradlew build -x test - working-directory: bindings/java/java_code - - - name: Run Gradle tests - run: ./gradlew test --scan - working-directory: bindings/java/java_code From 8aeb948edacd4efbfd488d89ace7c607457e2d51 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Mon, 29 Jul 2024 11:33:07 +1000 Subject: [PATCH 08/12] use arm64 (#119) --- bindings/nim/nim_code/nim_eth_kzg/build_utils.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/nim/nim_code/nim_eth_kzg/build_utils.nim b/bindings/nim/nim_code/nim_eth_kzg/build_utils.nim index 642cd732..a917b90a 100644 --- a/bindings/nim/nim_code/nim_eth_kzg/build_utils.nim +++ b/bindings/nim/nim_code/nim_eth_kzg/build_utils.nim @@ -9,7 +9,7 @@ const proc getInstallDir*(): string = when defined(macosx): - when defined(aarch64) or defined(amd64): + when defined(aarch64) or defined(amd64) or defined(arm64): return universalAppleDarwin else: raise newException(ValueError, "Unsupported architecture on macOS") @@ -21,7 +21,7 @@ proc getInstallDir*(): string = elif defined(linux): when defined(amd64): return x86_64UnknownLinuxGnu - elif defined(aarch64): + elif defined(aarch64) or defined(arm64): return aarch64UnknownLinuxGnu else: raise newException(ValueError, "Unsupported architecture on Linux") From a057ecfc3c9054ae53f978f2c3d2257b4424e3df Mon Sep 17 00:00:00 2001 From: kevaundray Date: Mon, 29 Jul 2024 12:33:16 +1000 Subject: [PATCH 09/12] chore: cross compile macos on ubuntu for Node (#117) * cross compile mac * update * empty message * use == false --- .github/workflows/release-node-bindings.yml | 32 +++++++++------------ 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release-node-bindings.yml b/.github/workflows/release-node-bindings.yml index bcc8ce26..1a756f48 100644 --- a/.github/workflows/release-node-bindings.yml +++ b/.github/workflows/release-node-bindings.yml @@ -37,9 +37,9 @@ jobs: fail-fast: false matrix: settings: - - host: macos-13 + - host: ubuntu-latest target: x86_64-apple-darwin - - host: macos-14 + - host: ubuntu-latest target: aarch64-apple-darwin - host: ubuntu-latest target: x86_64-unknown-linux-gnu @@ -72,37 +72,31 @@ jobs: - name: Install dependencies run: yarn install working-directory: bindings/node - - name: Setup Zig (Linux only) + - name: Setup Zig uses: goto-bus-stop/setup-zig@v2 with: version: 0.13.0 - # Binstall is only needed for install cross-compilation - # tools on linux - - name: Install Binstall (Linux only) - if: runner.os == 'Linux' + - name: Install Binstall uses: cargo-bins/cargo-binstall@main - - name: Install cargo-zigbuild (Linux only) - if: runner.os == 'Linux' + - name: Install cargo-zigbuild run: cargo binstall cargo-zigbuild -y + - name: Install cargo-xwin (Windows on Linux only) - if: runner.os == 'Linux' && contains(matrix.settings.target, 'windows') + if: contains(matrix.settings.target, 'windows') run: cargo binstall cargo-xwin -y - - name: Build (macOS) - if: runner.os == 'macOS' - run: | - rustup target add ${{ matrix.settings.target }} - yarn build --release --target ${{ matrix.settings.target }} - working-directory: bindings/node - - name: Build (Linux) - if: runner.os == 'Linux' && !contains(matrix.settings.target, 'windows') + + - name: Build (Mac and Linux) + if: contains(matrix.settings.target, 'windows') == false run: yarn build --zig --release --target ${{ matrix.settings.target }} working-directory: bindings/node + - name: Build (Windows on Linux) - if: runner.os == 'Linux' && contains(matrix.settings.target, 'windows') + if: contains(matrix.settings.target, 'windows') run: yarn build --release --target ${{ matrix.settings.target }} working-directory: bindings/node + - name: Upload artifact uses: actions/upload-artifact@v4 with: From 9ea8a02ab2655e4c12517c13730e047056115daa Mon Sep 17 00:00:00 2001 From: kevaundray Date: Mon, 29 Jul 2024 12:35:31 +1000 Subject: [PATCH 10/12] make workflow name consistent (#120) --- .github/workflows/release-java-bindings.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-java-bindings.yml b/.github/workflows/release-java-bindings.yml index 0a218388..53175575 100644 --- a/.github/workflows/release-java-bindings.yml +++ b/.github/workflows/release-java-bindings.yml @@ -24,7 +24,7 @@ env: jobs: build: - name: Build for ${{ matrix.target }} + name: Build - ${{ matrix.target }} runs-on: ${{ matrix.os }} strategy: matrix: @@ -69,7 +69,7 @@ jobs: path: bindings/java/java_code/src/main/resources/${{ matrix.target }} test: - name: Test on ${{ matrix.target }} + name: Test - ${{ matrix.target }} needs: build strategy: matrix: From 71ff84dffae8ab8e6f261cef979661b54218f27a Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 29 Jul 2024 12:42:28 +1000 Subject: [PATCH 11/12] update cargo.lock --- Cargo.lock | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b14298d2..a7264090 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -351,15 +351,6 @@ dependencies = [ "sha2", ] -[[package]] -name = "crc32fast" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if", -] - [[package]] name = "criterion" version = "0.5.1" @@ -1590,4 +1581,4 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.71", -] +] \ No newline at end of file From ea3f0f8808e4c47b50c4b09c1872466e388bc20e Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 5 Aug 2024 03:13:45 -0700 Subject: [PATCH 12/12] update java version --- bindings/java/java_code/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/java/java_code/build.gradle b/bindings/java/java_code/build.gradle index 607a340d..d854449e 100644 --- a/bindings/java/java_code/build.gradle +++ b/bindings/java/java_code/build.gradle @@ -8,7 +8,7 @@ plugins { } group = 'io.github.crate-crypto' -version = '0.0.10' // x-release-please-version +version = '0.0.11' // x-release-please-version java {