Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): add back nim build for windows #23

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/test-csharp-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/test-golang-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/test-java-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
47 changes: 38 additions & 9 deletions .github/workflows/test-nim-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion bindings/nim/nim_code/nim_peerdas_kzg/bindings.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions bindings/nim/nim_code/nim_peerdas_kzg/build_utils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion bls12_381/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
4 changes: 2 additions & 2 deletions scripts/compile_to_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
;;
*)
Expand Down
Loading