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

ci(bindings/go): always test against the latest core #4913

Merged
merged 1 commit into from
Jul 20, 2024
Merged
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
26 changes: 26 additions & 0 deletions .github/scripts/test_go_binding/matrix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# 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"
service:
- "memory"

69 changes: 65 additions & 4 deletions .github/workflows/ci_bindings_go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,75 @@ permissions:
contents: read

jobs:
test:
matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
name: Setup Matrix
run: |
MATRIX=$(yq -o=json -I=0 "." .github/scripts/test_go_binding/matrix.yaml | sed 's/ //g')
echo "Matrix:"
echo "$MATRIX" | jq .
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
test:
needs: [ matrix ]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: "apache/opendal-go-services"
path: "tools"
- name: Setup Rust toolchain
uses: ./.github/actions/setup
- name: Setup Target
env:
TARGET: ${{ matrix.build.target }}
run: rustup target add $TARGET
- uses: actions/setup-go@v5

- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Setup Service
env:
OPENDAL_FEATURES: "layers-blocking,services-${{ matrix.service }}"
run: |
python -m pip install toml
python tools/.github/scripts/setup_features.py
- name: Build C Binding
working-directory: bindings/c
env:
VERSION: "latest"
SERVICE: ${{ matrix.service }}
TARGET: ${{ matrix.build.target }}
CC: ${{ matrix.build.cc }}
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
- name: Build Go Artifact
working-directory: tools/internal/generate
env:
MATRIX: ${{ needs.matrix.outputs.matrix }}
VERSION: "latest"
run: |
go run generate.go
- name: Setup Go Workspace
env:
SERVICE: ${{ matrix.service }}
working-directory: bindings/go/tests
run: |
go work use $GITHUB_WORKSPACE/$(echo $SERVICE | sed 's/-/_/g')
- name: Run tests
env:
OPENDAL_TEST: "memory"
working-directory: bindings/go
OPENDAL_TEST: ${{ matrix.service }}
working-directory: bindings/go/tests/behavior_tests
run: CGO_ENABLE=0 go test -v -run TestBehavior
4 changes: 3 additions & 1 deletion bindings/go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"fmt"
"os"

"github.com/yuchanns/opendal-go-services/memory"
"github.com/apache/opendal-go-services/memory"
opendal "github.com/apache/opendal/bindings/go"
)

Expand Down Expand Up @@ -92,6 +92,7 @@ func main() {
### Behavior Tests

```bash
cd tests/behavior_tests
# Test a specific backend
export OPENDAL_TEST=memory
# Run all tests
Expand All @@ -105,6 +106,7 @@ CGO_ENABLE=0 GOMAXPROCS=1 go test -v -run TestBehavior
### Benchmark

```bash
cd tests/behavior_tests
# Benchmark a specific backend
export OPENDAL_TEST=memory

Expand Down
10 changes: 0 additions & 10 deletions bindings/go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@ toolchain go1.22.5

require (
github.com/ebitengine/purego v0.7.1
github.com/google/uuid v1.6.0
github.com/jupiterrider/ffi v0.1.0-beta.9
github.com/stretchr/testify v1.9.0
github.com/yuchanns/opendal-go-services v0.0.1
golang.org/x/sys v0.22.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
16 changes: 0 additions & 16 deletions bindings/go/go.sum
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/ebitengine/purego v0.7.1 h1:6/55d26lG3o9VCZX8lping+bZcmShseiqlh2bnUDiPA=
github.com/ebitengine/purego v0.7.1/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/jupiterrider/ffi v0.1.0-beta.9 h1:HCeAPTsTFgwvcfavyJwy1L2ANz0c85W+ZE7LfzjZi3A=
github.com/jupiterrider/ffi v0.1.0-beta.9/go.mod h1:sOp6VJGFaYyr4APi8gwy6g20QNHv5F8Iq1CVbtC900s=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/yuchanns/opendal-go-services v0.0.1 h1:qeKv0mOhypQNm97g+u94DnijJK5bdEAp5pdjBGf8N7w=
github.com/yuchanns/opendal-go-services v0.0.1/go.mod h1:tw8QXHu3hzsLpiUCQ+pOIhGw7FJFumnh++rKF/BK96I=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion bindings/go/opendal.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
//
// import (
// "github.com/apache/opendal/bindings/go
// "github.com/yuchanns/opendal-go-services/memory
// "github.com/apache/opendal-go-services/memory
// )
//
// func main() {
Expand Down
37 changes: 37 additions & 0 deletions bindings/go/tests/behavior_tests/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

module opendal_test

go 1.22.5

require (
github.com/apache/opendal-go-services/memory v0.0.0-20240719030108-74ff217cfef9
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
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/ebitengine/purego v0.7.1 // indirect
github.com/jupiterrider/ffi v0.1.0-beta.9 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/sys v0.22.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
26 changes: 26 additions & 0 deletions bindings/go/tests/behavior_tests/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
github.com/apache/opendal-go-services/memory v0.0.0-20240719030108-74ff217cfef9 h1:tV4Xmoa5Zq2RyrygaXreayLz10C6JqTpyvMYAtdshXQ=
github.com/apache/opendal-go-services/memory v0.0.0-20240719030108-74ff217cfef9/go.mod h1:vldOQuikErKA1wfGnqvjAYB9MON/PWTuFIulMCKIQqM=
github.com/apache/opendal/bindings/go v0.0.0-20240719044908-d9d4279b3a24 h1:2fAl+WS/lZMTtP6onlrmDbb3pltf+5xNTc0Aeu9nYWE=
github.com/apache/opendal/bindings/go v0.0.0-20240719044908-d9d4279b3a24/go.mod h1:jyMN6M6h0jMDZitnjvB3KPobM+oZiESrFb3XUplLxhI=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/ebitengine/purego v0.7.1 h1:6/55d26lG3o9VCZX8lping+bZcmShseiqlh2bnUDiPA=
github.com/ebitengine/purego v0.7.1/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/jupiterrider/ffi v0.1.0-beta.9 h1:HCeAPTsTFgwvcfavyJwy1L2ANz0c85W+ZE7LfzjZi3A=
github.com/jupiterrider/ffi v0.1.0-beta.9/go.mod h1:sOp6VJGFaYyr4APi8gwy6g20QNHv5F8Iq1CVbtC900s=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/yuchanns/opendal-go-services v0.0.1 h1:qeKv0mOhypQNm97g+u94DnijJK5bdEAp5pdjBGf8N7w=
github.com/yuchanns/opendal-go-services v0.0.1/go.mod h1:tw8QXHu3hzsLpiUCQ+pOIhGw7FJFumnh++rKF/BK96I=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,14 @@ import (
"sync"
"testing"

"github.com/apache/opendal-go-services/memory"
opendal "github.com/apache/opendal/bindings/go"
"github.com/google/uuid"
"github.com/stretchr/testify/require"
"github.com/yuchanns/opendal-go-services/aliyun_drive"
"github.com/yuchanns/opendal-go-services/memory"
)

// Add more schemes for behavior tests here.
var schemes = []opendal.Scheme{
aliyun_drive.Scheme,
memory.Scheme,
}

Expand Down
6 changes: 6 additions & 0 deletions bindings/go/tests/go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
go 1.22.5

use (
..
./behavior_tests
)
Loading