diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 1c98339480..3994102608 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -13,6 +13,12 @@ jobs: build: runs-on: ubuntu-latest steps: + - name: Install Go + uses: actions/setup-go@v4 + + - name: Set up GCC + uses: egor-tensin/setup-gcc@v1 + - name: Checkout repository uses: actions/checkout@v3 @@ -36,6 +42,12 @@ jobs: acceptanceTest: runs-on: ubuntu-latest steps: + - name: Install Go + uses: actions/setup-go@v4 + + - name: Set up GCC + uses: egor-tensin/setup-gcc@v1 + - name: Checkout repository uses: actions/checkout@v3 @@ -54,9 +66,39 @@ jobs: if: always() uses: actions/upload-artifact@v3 with: - name: test-report + name: acceptance-test-report path: acceptance-tests/build/reports/tests/ + libCompressTest: + runs-on: ubuntu-latest + steps: + - name: Install Go + uses: actions/setup-go@v4 + + - name: Set up GCC + uses: egor-tensin/setup-gcc@v1 + + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + + - name: Run libcompress JNI tests + run: ./gradlew :native:compress:test + env: + JAVA_OPTS: -Dorg.gradle.daemon=false + + - name: Upload test report + if: always() + uses: actions/upload-artifact@v3 + with: + name: compress-test-report + path: compress/build/reports/tests/ + tests: runs-on: ubuntu-latest steps: @@ -65,7 +107,6 @@ jobs: ssh-private-key: | ${{ secrets.CONSTRAINTS_SSH_KEY }} - - name: Checkout repository uses: actions/checkout@v3 with: @@ -103,8 +144,8 @@ jobs: - name: Upload test report uses: actions/upload-artifact@v3 with: - name: test-report - path: build/reports/tests/ + name: unit-test-report + path: arithmetization/build/reports/tests/ spotless: runs-on: ubuntu-latest diff --git a/README.md b/README.md index a0f2622b78..011374f725 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,10 @@ an [existing implementation in Go](https://github.com/Consensys/zk-evm/). brew install openjdk@17 ``` +### Install the relevant CGo compiler for your platform + +### Install the Go toolchain + ### Install Rust ``` diff --git a/native/build.sh b/native/build.sh index 459201c52b..85be58c7b1 100755 --- a/native/build.sh +++ b/native/build.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # Initialize external vars - need this to get around unbound variable errors SKIP_GRADLE="$SKIP_GRADLE" @@ -9,71 +9,25 @@ set -o nounset # Exit script if a statement returns a non-true return value. set -o errexit -# Use the error status of the first failure, rather than that of the last item in a pipeline. -set -o pipefail - -# Resolve the directory that contains this script. We have to jump through a few -# hoops for this because the usual one-liners for this don't work if the script -# is a symlink -SOURCE="${BASH_SOURCE[0]}" -while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink - DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located -done -SCRIPTDIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" - -# Determine core count for parallel make -if [[ "$OSTYPE" == "linux-gnu" ]]; then - CORE_COUNT=$(nproc) - OSARCH=${OSTYPE%%[0-9.]*}-`arch` -fi - -if [[ "$OSTYPE" == "darwin"* ]]; then - CORE_COUNT=$(sysctl -n hw.ncpu) - if [[ "`machine`" == "arm"* ]]; then - arch_name="aarch64" - export CFLAGS="-arch arm64" - else - arch_name="x86-64" - export CFLAGS="-arch x86_64" - fi - OSARCH="darwin-$arch_name" +SCRIPTDIR=$(dirname -- "$( readlink -f -- "$0")") +OSTYPE=$(uname -o) + +# delete old build dir, if exists +rm -rf "$SCRIPTDIR/compress/build/native" || true +mkdir -p "$SCRIPTDIR/compress/build/native" + +if [ x"$OSTYPE" = x"msys" ]; then + LIBRARY_EXTENSION=dll +elif [ x"$OSTYPE" = x"GNU/Linux" ]; then + LIBRARY_EXTENSION=so +elif [ x"$OSTYPE" = x"Darwin" ]; then + LIBRARY_EXTENSION=dylib +else + echo "*** Unknown OS: $OSTYPE" + exit 1 fi -# add to path cargo -[ -f $HOME/.cargo/env ] && . $HOME/.cargo/env - -# add to path brew -[ -f $HOME/.zprofile ] && . $HOME/.zprofile - -build_compress() { - cat <