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

(WIP) ci(bindings/go): add windows to matrix #5066

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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: 5 additions & 1 deletion .github/scripts/test_go_binding/matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ build:
goos: "darwin"
goarch: "arm64"
os: "macos-latest"
- target: "x86_64-pc-windows-msvc"
cc: "cl.exe"
goos: "windows"
goarch: "amd64"
os: "windows-latest"
service:
- "fs"

48 changes: 43 additions & 5 deletions .github/workflows/ci_bindings_go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ on:
- "core/**"
- "bindings/c/**"
- "bindings/go/**"
- ".github/scripts/test_go_binding/matrix.yaml"
- ".github/workflows/ci_bindings_go.yml"
workflow_dispatch:

Expand Down Expand Up @@ -82,10 +83,17 @@ jobs:
path: "tools"
- name: Setup Rust toolchain
uses: ./.github/actions/setup
- name: Setup Target
- name: Setup Target (Linux/Mac)
if: runner.os != 'Windows'
env:
TARGET: ${{ matrix.build.target }}
run: rustup target add $TARGET
- name: Setup Target (Windows)
if: runner.os == 'Windows'
env:
TARGET: ${{ matrix.build.target }}
run: |
rustup target add $env:TARGET
- uses: actions/setup-go@v5
with:
go-version: stable
Expand All @@ -101,19 +109,23 @@ jobs:
- name: Install dependencies (Linux)
if: ${{ matrix.build.os == 'ubuntu-latest' }}
run: sudo apt install zstd
- name: Install dependencies (macOS)
- name: Install dependencies (MacOS)
if: ${{ matrix.build.os == 'macos-latest' }}
run: brew install zstd libffi
- name: Build C Binding
- name: Install dependencies (Windows)
if: ${{ matrix.build.os == 'windows-latest' }}
uses: ilammy/msvc-dev-cmd@v1
- name: Build C Binding (Linux/MacOS)
working-directory: bindings/c
if: runner.os != 'Windows'
env:
VERSION: "latest"
SERVICE: ${{ matrix.service }}
TARGET: ${{ matrix.build.target }}
CC: ${{ matrix.build.cc }}
OS: ${{ matrix.build.os }}
run: |
cargo build --target $TARGET --release
cargo build --target $TARGET --release
DIR=$GITHUB_WORKSPACE/libopendal_c_${VERSION}_${SERVICE}_$TARGET
mkdir $DIR
if [ ${OS} == 'ubuntu-latest' ]; then
Expand All @@ -122,6 +134,21 @@ jobs:
SO=dylib
fi
zstd -19 ./target/$TARGET/release/libopendal_c.$SO -o $DIR/libopendal_c.$TARGET.$SO.zst
- name: Build and Package (Windows)
working-directory: bindings/c
if: runner.os == 'Windows'
env:
VERSION: "latest"
SERVICE: ${{ matrix.service }}
TARGET: ${{ matrix.build.target }}
CC: ${{ matrix.build.cc }}
OS: ${{ matrix.build.os }}
run: |
cargo build --target $env:TARGET --release
$DIR="$env:GITHUB_WORKSPACE\libopendal_c_${env:VERSION}_${env:SERVICE}_${env:TARGET}"
Rename-Item -Path "./target/$env:TARGET/release/opendal_c.dll" -NewName "libopendal_c.dll"
New-Item -ItemType Directory -Force -Path $DIR
zstd -19 "./target/${env:TARGET}/release/libopendal_c.dll" -o "$DIR/libopendal_c.${env:TARGET}.dll.zst"
- name: Build Go Artifact
working-directory: tools/internal/generate
env:
Expand All @@ -138,13 +165,24 @@ jobs:
go work use ..
go work use ./behavior_tests
go work use $GITHUB_WORKSPACE/$(echo $SERVICE | sed 's/-/_/g')
- name: Run tests
- name: Run tests (Linux/MacOS)
env:
OPENDAL_TEST: ${{ matrix.service }}
OPENDAL_FS_ROOT: "/tmp/opendal/"
working-directory: bindings/go/tests/behavior_tests
if: runner.os != 'Windows'
run: |
if [ ${{ matrix.build.os }} == 'macos-latest' ]; then
export DYLD_FALLBACK_LIBRARY_PATH=$DYLD_FALLBACK_LIBRARY_PATH:/opt/homebrew/opt/libffi/lib
fi
CGO_ENABLE=0 go test -v -run TestBehavior
- name: Run tests (Windows)
env:
OPENDAL_TEST: ${{ matrix.service }}
OPENDAL_FS_ROOT: "/tmp/opendal/"
working-directory: bindings/go/tests/behavior_tests
if: runner.os == 'Windows'
run: |
$env:CGO_ENABLE = "0"
go test -v -run TestBehavior

Loading