diff --git a/.github/workflows/test-csharp-bindings.yml b/.github/workflows/test-csharp-bindings.yml index b57e305e..1f1d32fb 100644 --- a/.github/workflows/test-csharp-bindings.yml +++ b/.github/workflows/test-csharp-bindings.yml @@ -24,6 +24,12 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@stable + - name: Setup Zig + uses: goto-bus-stop/setup-zig@v2 + + - name: Add zigbuild + run: cargo install cargo-zigbuild + - name: Run compile script run: ./scripts/compile.sh csharp shell: bash diff --git a/.github/workflows/test-golang-bindings.yml b/.github/workflows/test-golang-bindings.yml index 95fe0593..9615f46f 100644 --- a/.github/workflows/test-golang-bindings.yml +++ b/.github/workflows/test-golang-bindings.yml @@ -24,6 +24,12 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@stable + - name: Setup Zig + uses: goto-bus-stop/setup-zig@v2 + + - name: Add zigbuild + run: cargo install cargo-zigbuild + - name: Run compile script run: ./scripts/compile.sh golang shell: bash diff --git a/.github/workflows/test-java-bindings.yml b/.github/workflows/test-java-bindings.yml index cb69941b..4dc05492 100644 --- a/.github/workflows/test-java-bindings.yml +++ b/.github/workflows/test-java-bindings.yml @@ -24,6 +24,12 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@stable + - name: Setup Zig + uses: goto-bus-stop/setup-zig@v2 + + - name: Add zigbuild + run: cargo install cargo-zigbuild + - name: Run compile script run: ./scripts/compile.sh java shell: bash diff --git a/.github/workflows/test-nim-bindings.yml b/.github/workflows/test-nim-bindings.yml index 03bf9eab..be645aed 100644 --- a/.github/workflows/test-nim-bindings.yml +++ b/.github/workflows/test-nim-bindings.yml @@ -9,36 +9,65 @@ on: - master workflow_dispatch: +env: + NIM_CC: vcc + jobs: build-and-test: runs-on: ${{ matrix.os }} strategy: matrix: - # TODO: Add back windows-latest - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, windows-latest, macos-latest] steps: - name: Checkout repository uses: actions/checkout@v3 + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v2 + if: runner.os == 'Windows' + - name: Set up Rust uses: dtolnay/rust-toolchain@stable + # - name: Setup Zig + # uses: goto-bus-stop/setup-zig@v2 + + # - name: Add zigbuild + # run: cargo install cargo-zigbuild + - name: Run compile script run: ./scripts/compile.sh nim shell: bash - - name: Setup Nim - uses: jiro4989/setup-nim-action@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - nim-version: '2.0.4' - + - name: Install Nim (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + Invoke-WebRequest -Uri https://nim-lang.org/download/nim-2.0.4_x64.zip -OutFile nim.zip + Expand-Archive -Path nim.zip -DestinationPath . + Move-Item -Path nim-2.0.4 -Destination "$env:USERPROFILE\.choosenim\toolchains\nim-2.0.4" + echo "$env:USERPROFILE\.nimble\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + echo "$env:USERPROFILE\.choosenim\toolchains\nim-2.0.4\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.nimble\bin" + Copy-Item "$env:USERPROFILE\.choosenim\toolchains\nim-2.0.4\bin\*" -Destination "$env:USERPROFILE\.nimble\bin" -Recurse -Force + + - name: Install Nim (Unix) + if: runner.os != 'Windows' + shell: bash + run: | + curl https://nim-lang.org/choosenim/init.sh -sSf | sh -s -- -y + echo "$HOME/.nimble/bin" >> $GITHUB_PATH + choosenim stable + + - name: Set NIM_CC to vcc on Windows + if: runner.os == 'Windows' + run: echo "NIM_CC=vcc" >> $env:GITHUB_ENV - name: Install Nimble dependencies working-directory: bindings/nim/nim_code run: nimble install -Y - name: Test Nim project working-directory: bindings/nim/nim_code - run: nimble test -Y + run: nimble test -Y --verbose diff --git a/bindings/nim/nim_code/nim_peerdas_kzg/bindings.nim b/bindings/nim/nim_code/nim_peerdas_kzg/bindings.nim index acc42057..2c2952bd 100644 --- a/bindings/nim/nim_code/nim_peerdas_kzg/bindings.nim +++ b/bindings/nim/nim_code/nim_peerdas_kzg/bindings.nim @@ -7,7 +7,7 @@ export header when defined(windows): # For gnu toolchain, the extension is .a since it uses the linux toolchain # This will need to be changed if we switch to the msvc toolchain - const libName = "libc_peerdas_kzg.a" + const libName = "c_peerdas_kzg.lib" else: const libName = "libc_peerdas_kzg.a" diff --git a/bindings/nim/nim_code/nim_peerdas_kzg/build_utils.nim b/bindings/nim/nim_code/nim_peerdas_kzg/build_utils.nim index 642cd732..11113db4 100644 --- a/bindings/nim/nim_code/nim_peerdas_kzg/build_utils.nim +++ b/bindings/nim/nim_code/nim_peerdas_kzg/build_utils.nim @@ -3,7 +3,7 @@ import os const buildDir = "build" universalAppleDarwin {.used.} = buildDir / "universal-apple-darwin" - x86_64PcWindowsGnu {.used.} = buildDir / "x86_64-pc-windows-gnu" + x86_64PcWindowsMsvc {.used.} = buildDir / "x86_64-pc-windows-msvc" x86_64UnknownLinuxGnu {.used.} = buildDir / "x86_64-unknown-linux-gnu" aarch64UnknownLinuxGnu {.used.} = buildDir / "aarch64-unknown-linux-gnu" @@ -15,7 +15,7 @@ proc getInstallDir*(): string = raise newException(ValueError, "Unsupported architecture on macOS") elif defined(windows): when defined(amd64): - return x86_64PcWindowsGnu + return x86_64PcWindowsMsvc else: raise newException(ValueError, "Unsupported architecture on Windows") elif defined(linux): diff --git a/bls12_381/Cargo.toml b/bls12_381/Cargo.toml index 4a61424a..678ce231 100644 --- a/bls12_381/Cargo.toml +++ b/bls12_381/Cargo.toml @@ -13,7 +13,7 @@ repository = { workspace = true } [dependencies] rayon = { workspace = true } -blst = { version = "0.3.1", default-features = false } +blst = { version = "0.3.12", default-features = false, features = ["portable"] } # __private_bench feature is used to allow us to access the base field blstrs = { version = "0.7.1", features = ["__private_bench"] } diff --git a/scripts/compile_to_native.sh b/scripts/compile_to_native.sh index 9dd82462..876f41aa 100755 --- a/scripts/compile_to_native.sh +++ b/scripts/compile_to_native.sh @@ -122,8 +122,8 @@ case "$OS" in # Github runners will return MINGW64_NT-10.0-20348 # so we add a wildcard to match the prefix MINGW64_NT-*|CYGWIN_NT-*|"Windows") - TARGET_NAME="x86_64-pc-windows-gnu" - STATIC_LIB_NAME="lib${LIB_NAME}.a" + TARGET_NAME="x86_64-pc-windows-msvc" + STATIC_LIB_NAME="${LIB_NAME}.lib" DYNAMIC_LIB_NAME="${LIB_NAME}.dll" ;; *)