This is an automated email from the ASF dual-hosted git repository.
lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git
The following commit(s) were added to refs/heads/main by this push:
new fb09dec [Go] fix runs-on for go.yml workflow (#112)
fb09dec is described below
commit fb09decd8e38fc4d3e191a8d2d186568e2640d69
Author: Matt Topol <[email protected]>
AuthorDate: Thu Sep 8 13:55:30 2022 -0400
[Go] fix runs-on for go.yml workflow (#112)
* fix runs-on for go.yml workflow
* fix dirs and no asan
* cgo doesn't work with windows cl, fix order of operations
* move package doc to doc.go so there's at least one Go file in the dir
without cgo.
* add build constraint on the test
* trim trailing whitespace
* extra end of file line
* why does macos hate me?
* figure out macos path
* dump macos env to figure out solution
* let's be explicit and see if that makes macos happy
* wrong arg
* trim whitespace
* almost there, i almost have you macos
* and maybe.....
* don't run staticcheck on macos
* single quotes
* ld paths
* conda prefix?
* forgot the target install
* i'm so confused by it hitting the wrong version of libstdc++
* maybe this...
* try with conda prefix?
* use tmate to debug
* fix macos stuff, hopefully
* fix yaml lint, try again
* fix path
* fix CGO_LDFLAGS
* try `-exec env`
* i think it finally works
* bit by trailing whitespace
---
.github/workflows/go.yml | 100 ++++++++++++-------------------
go/adbc/drivermgr/doc.go | 22 +++++++
go/adbc/drivermgr/wrapper.go | 4 --
go/adbc/drivermgr/wrapper_sqlite_test.go | 11 +++-
4 files changed, 70 insertions(+), 67 deletions(-)
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
index ca4f968..1cdadb3 100644
--- a/.github/workflows/go.yml
+++ b/.github/workflows/go.yml
@@ -39,7 +39,7 @@ concurrency:
jobs:
go-no-cgo:
- name: "Go/${{ matrix.os}} - No CGO"
+ name: "${{ matrix.os}} - No CGO"
env:
CGO_ENABLED: "0"
runs-on: ${{ matrix.os }}
@@ -60,14 +60,24 @@ jobs:
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Go Build
- run: go build -v ./go/adbc/...
+ run: |
+ pushd go/adbc
+ go build -v ./...
+ popd
- name: Run Staticcheck
- run: staticcheck -f stylish ./go/adbc/...
+ run: |
+ pushd go/adbc
+ staticcheck -f stylish ./...
+ popd
- name: Go Test
- run: go test -v ./go/adbc/...
+ run: |
+ pushd go/adbc
+ go test -v ./...
+ popd
go-driver-mgr-unix:
- name: "Go/${{ matrix.os }} - CGO driver mgr"
+ name: "${{ matrix.os }} - CGO driver mgr"
+ runs-on: ${{ matrix.os }}
env:
CGO_ENABLED: "1"
strategy:
@@ -80,12 +90,10 @@ jobs:
persist-credentials: false
- uses: actions/setup-go@v3
with:
- go-version-file: 'go/adbc/go.mod'
+ go-version: 1.18.6
check-latest: true
cache: true
cache-dependency-path: go/adbc/go.sum
- - name: Install staticcheck
- run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Get Date
id: get-date
shell: bash
@@ -112,21 +120,34 @@ jobs:
mamba install --file ci/conda_env_cpp.txt --file
ci/conda_env_python.txt
- name: Build SQLite3 Driver
shell: bash -l {0}
- id: sqlite
run: |
mkdir -p build/driver_sqlite
pushd build/driver_sqlite
- cmake ../../c/drivers/sqlite -DADBC_BUILD_TESTS=OFF
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
-DADBC_BUILD_SHARED=ON -DADBC_BUILD_STATIC=OFF -DADBC_USE_ASAN=ON
-DADBC_USE_UBSAN=ON
- cmake --build .
- echo "::set-output name=path::$(pwd)"
+ cmake ../../c/drivers/sqlite \
+ -DADBC_BUILD_SHARED=ON \
+ -DADBC_BUILD_STATIC=OFF \
+ -DADBC_BUILD_TESTS=OFF \
+ -DCMAKE_BUILD_TYPE=Debug \
+ -DCMAKE_INSTALL_LIBDIR=lib \
+ -DCMAKE_INSTALL_PREFIX=$HOME/local \
+ -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
+ cmake --build . --target install
popd
+ - name: Install staticcheck
+ shell: bash -l {0}
+ if: ${{ !contains('macos-latest', matrix.os) }}
+ run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Go Build
shell: bash -l {0}
run: |
pushd go/adbc
- LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ steps.sqlite.outputs.path }} go
build -v ./...
+ export PATH=$RUNNER_TOOL_CACHE/go/1.18.6/x64/bin:$PATH
+ export LD_LIBRARY_PATH=$HOME/local/lib
+ export DYLD_LIBRARY_PATH=$HOME/local/lib
+ go build -v ./...
popd
- name: Run Staticcheck
+ if: ${{ !contains('macos-latest', matrix.os) }}
shell: bash -l {0}
run: |
pushd go/adbc
@@ -136,53 +157,8 @@ jobs:
shell: bash -l {0}
run: |
pushd go/adbc
- LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ steps.sqlite.outputs.path }} go
test -v ./...
+ export PATH=$RUNNER_TOOL_CACHE/go/1.18.6/x64/bin:$PATH
+ export LD_LIBRARY_PATH=$HOME/local/lib
+ export DYLD_LIBRARY_PATH=$HOME/local/lib
+ go test -exec "env DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH" -v ./...
popd
-
- go-driver-mgr-windows:
- name: "Go/${{ matrix.os }} - CGO driver mgr"
- env:
- - CGO_ENABLED: "1"
- strategy:
- matrix:
- os: ["windows-latest"]
- steps:
- - uses: actions/checkout@v3
- with:
- fetch-depth: 0
- persist-credentials: false
- - uses: actions/setup-go@v3
- with:
- go-version-file: 'go/adbc/go.mod'
- check-latest: true
- cache: true
- cache-dependency-path: go/adbc/go.sum
- - uses: conda-incubator/setup-miniconda@v2
- with:
- miniforge-variant: Mambaforge
- miniforge-version: latest
- use-mamba: true
- # Required for caching
- use-only-tar-bz2: true
- - name: Install Dependencies
- shell: cmd /C call {0}
- run: |
- mamba install --file ci/conda_env_cpp.txt
- - name: Build SQLite3 Driver
- shell: cmd /C call {0}
- run: |
- mkdir build\driver_sqlite
- cd build\driver_sqlite
- cmake -GNinja ..\..\c\drivers\sqlite -DADBC_BUILD_TESTS=OFF
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=%CONDA_PREFIX%
-DADBC_BUILD_SHARED=ON -DADBC_BUILD_STATIC=OFF
- if %errorlevel% neq 0 then exit /b %errorlevel%
- cmake --build .
- if %errorlevel% neq 0 then exit /b %errorlevel%
- cd ..\..
- - name: Build/Test Go
- shell: cmd /C call {0}
- run: |
- set "PATH=%cd%\build\driver_sqlite;%PATH%"
- cd go\adbc
- go build -v ./...
- go test -v ./...
- cd ..\..
diff --git a/go/adbc/drivermgr/doc.go b/go/adbc/drivermgr/doc.go
new file mode 100644
index 0000000..61c3224
--- /dev/null
+++ b/go/adbc/drivermgr/doc.go
@@ -0,0 +1,22 @@
+// 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.
+
+// Package drivermgr is a cgo wrapper for the adbc_driver_manager.
+//
+// This provides an implementation of the ADBC interfaces which
+// uses CGO to wrap a shared object implementation of adbc.h
+package drivermgr
diff --git a/go/adbc/drivermgr/wrapper.go b/go/adbc/drivermgr/wrapper.go
index 87cd081..264ee44 100644
--- a/go/adbc/drivermgr/wrapper.go
+++ b/go/adbc/drivermgr/wrapper.go
@@ -15,10 +15,6 @@
// specific language governing permissions and limitations
// under the License.
-// Package drivermgr is a cgo wrapper for the adbc_driver_manager.
-//
-// This provides an implementation of the ADBC interfaces which
-// uses CGO to wrap a shared object implementation of adbc.h
package drivermgr
// #cgo !windows LDFLAGS: -ldl
diff --git a/go/adbc/drivermgr/wrapper_sqlite_test.go
b/go/adbc/drivermgr/wrapper_sqlite_test.go
index ef5f4ca..2c89161 100644
--- a/go/adbc/drivermgr/wrapper_sqlite_test.go
+++ b/go/adbc/drivermgr/wrapper_sqlite_test.go
@@ -15,10 +15,13 @@
// specific language governing permissions and limitations
// under the License.
+//go:build cgo
+
package drivermgr_test
import (
"context"
+ "runtime"
"strings"
"testing"
@@ -214,5 +217,11 @@ func TestDriverMgrCustomInitFunc(t *testing.T) {
assert.ErrorAs(t, err, &exp)
assert.Equal(t, adbc.StatusInternal, exp.Code)
assert.Contains(t, exp.Msg, "dlsym() failed")
- assert.Contains(t, exp.Msg, "undefined symbol: ThisSymbolDoesNotExist")
+ switch runtime.GOOS {
+ case "darwin":
+ assert.Contains(t, exp.Msg, "ThisSymbolDoesNotExist): symbol
not found")
+ case "windows":
+ default:
+ assert.Contains(t, exp.Msg, "undefined symbol:
ThisSymbolDoesNotExist")
+ }
}