diff --git a/.github/scripts/test_go_binding/matrix.yaml b/.github/scripts/test_go_binding/matrix.yaml index e477aea073ef..b64fa19b6a21 100644 --- a/.github/scripts/test_go_binding/matrix.yaml +++ b/.github/scripts/test_go_binding/matrix.yaml @@ -15,12 +15,17 @@ # specific language governing permissions and limitations # under the License. -os: ["ubuntu-latest"] build: - target: "x86_64-unknown-linux-gnu" cc: "gcc" goos: "linux" goarch: "amd64" + os: "ubuntu-latest" + - target: "aarch64-apple-darwin" + cc: "clang" + goos: "darwin" + goarch: "arm64" + os: "macos-latest" service: - "fs" diff --git a/.github/workflows/ci_bindings_go.yml b/.github/workflows/ci_bindings_go.yml index e4c4df73653a..2264e18fa9e6 100644 --- a/.github/workflows/ci_bindings_go.yml +++ b/.github/workflows/ci_bindings_go.yml @@ -70,7 +70,7 @@ jobs: echo "matrix=$MATRIX" >> $GITHUB_OUTPUT test: needs: [ matrix ] - runs-on: ${{ matrix.os }} + runs-on: ${{ matrix.build.os }} strategy: fail-fast: false matrix: ${{ fromJson(needs.matrix.outputs.matrix) }} @@ -98,6 +98,12 @@ jobs: run: | python -m pip install toml python tools/.github/scripts/setup_features.py + - name: Install dependencies (Linux) + if: ${{ matrix.build.os == 'ubuntu-latest' }} + run: sudo apt install zstd + - name: Install dependencies (macOS) + if: ${{ matrix.build.os == 'macos-latest' }} + run: brew install zstd libffi - name: Build C Binding working-directory: bindings/c env: @@ -105,16 +111,21 @@ jobs: SERVICE: ${{ matrix.service }} TARGET: ${{ matrix.build.target }} CC: ${{ matrix.build.cc }} + OS: ${{ matrix.build.os }} run: | cargo build --target $TARGET --release - sudo apt install zstd DIR=$GITHUB_WORKSPACE/libopendal_c_${VERSION}_${SERVICE}_$TARGET mkdir $DIR - zstd -22 ./target/$TARGET/release/libopendal_c.so -o $DIR/libopendal_c.$TARGET.so.zst + if [ ${OS} == 'ubuntu-latest' ]; then + SO=so + else + SO=dylib + fi + zstd -19 ./target/$TARGET/release/libopendal_c.$SO -o $DIR/libopendal_c.$TARGET.$SO.zst - name: Build Go Artifact working-directory: tools/internal/generate env: - MATRIX: ${{ needs.matrix.outputs.matrix }} + MATRIX: '{"build": [${{ toJson(matrix.build) }}], "service": ["${{ matrix.service }}"]}' VERSION: "latest" run: | go run generate.go @@ -132,4 +143,8 @@ jobs: OPENDAL_TEST: ${{ matrix.service }} OPENDAL_FS_ROOT: "/tmp/opendal/" working-directory: bindings/go/tests/behavior_tests - run: CGO_ENABLE=0 go test -v -run TestBehavior + 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 diff --git a/bindings/go/tests/behavior_tests/go.mod b/bindings/go/tests/behavior_tests/go.mod index dae1477ff169..fcaba00ec69c 100644 --- a/bindings/go/tests/behavior_tests/go.mod +++ b/bindings/go/tests/behavior_tests/go.mod @@ -21,7 +21,6 @@ go 1.22.5 require ( github.com/apache/opendal-go-services/fs v0.1.3 - github.com/apache/opendal-go-services/memory v0.1.3 github.com/apache/opendal/bindings/go v0.0.0-20240719044908-d9d4279b3a24 github.com/google/uuid v1.6.0 github.com/stretchr/testify v1.9.0 diff --git a/bindings/go/tests/behavior_tests/opendal_test.go b/bindings/go/tests/behavior_tests/opendal_test.go index 8991f971a3ec..c421885b4d3d 100644 --- a/bindings/go/tests/behavior_tests/opendal_test.go +++ b/bindings/go/tests/behavior_tests/opendal_test.go @@ -31,7 +31,6 @@ import ( "testing" "github.com/apache/opendal-go-services/fs" - "github.com/apache/opendal-go-services/memory" opendal "github.com/apache/opendal/bindings/go" "github.com/google/uuid" "github.com/stretchr/testify/require" @@ -39,7 +38,6 @@ import ( // Add more schemes for behavior tests here. var schemes = []opendal.Scheme{ - memory.Scheme, fs.Scheme, }