Skip to content

Commit

Permalink
ci(bindings/go): add windows to matrix
Browse files Browse the repository at this point in the history
Signed-off-by: Zhangjian He <[email protected]>
  • Loading branch information
hezhangjian committed Jan 13, 2025
1 parent 41c72d8 commit f0ea5c1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
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"

35 changes: 31 additions & 4 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 Down

0 comments on commit f0ea5c1

Please sign in to comment.