lidavidm commented on code in PR #347: URL: https://github.com/apache/arrow-adbc/pull/347#discussion_r1072192207
########## .github/workflows/integration.yml: ########## @@ -0,0 +1,197 @@ +# 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. + +name: Integration + +on: + pull_request: + branches: + - main + paths: + - "adbc.h" + - "go/**" + - "c/**" + - "glib/**" + - "python/**" + - ".github/workflows/integration.yml" + push: + paths: + - "adbc.h" + - "go/**" + - "c/**" + - "glib/**" + - "python/**" + - ".github/workflows/integration.yml" + +concurrency: + group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + cpp-conda-unix: + name: "Conda/${{ matrix.os }}" + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: ["macos-latest", "ubuntu-latest"] + env: + # Required for macOS + # https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk + CXXFLAGS: "-D_LIBCPP_DISABLE_AVAILABILITY" + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + persist-credentials: false + - name: Get Date + id: get-date + shell: bash + run: | + echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')" + - name: Cache Conda + uses: actions/cache@v3 + env: + # Increment this to reset cache manually + CACHE_NUMBER: 0 + with: + path: ~/conda_pkgs_dir + key: conda-${{ runner.os }}-${{ steps.get-date.outputs.today }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/**') }} + - uses: conda-incubator/setup-miniconda@v2 + with: + miniforge-variant: Mambaforge + miniforge-version: latest + use-mamba: true + - name: Install Dependencies + shell: bash -l {0} + run: | + mamba install -c conda-forge \ + 'arrow-c-glib>=10.0.0' \ + --file ci/conda_env_cpp.txt \ + --file ci/conda_env_docs.txt \ + --file ci/conda_env_glib.txt \ + --file ci/conda_env_python.txt + - name: Build and Install (No ASan) + id: build-install + shell: bash -l {0} + run: | + # Python and others need something that don't use the ASAN runtime + rm -rf "$(pwd)/build" + export BUILD_ALL=1 + export ADBC_BUILD_TESTS=OFF + export ADBC_USE_ASAN=OFF + export ADBC_USE_UBSAN=OFF + ./ci/scripts/cpp_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local" + echo "CACHEPATH=$HOME/local" >> $GITHUB_OUTPUT Review Comment: What we could do here is add a small CMake project that just builds the tests and links to the driver manager, using an env var to choose what driver to load. ########## go/adbc/pkg/gen/main.go: ########## @@ -0,0 +1,184 @@ +// 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 main + +import ( + "bytes" + "errors" + "flag" + "fmt" + "io/ioutil" + "log" + "os" + "os/exec" + "path/filepath" + "strings" + "text/template" + + "golang.org/x/tools/go/packages" +) + +const Ext = ".tmpl" + +func formatSource(in []byte) ([]byte, error) { + r := bytes.NewReader(in) + cmd := exec.Command("goimports") + cmd.Stdin = r + out, err := cmd.Output() + if err != nil { + var ee *exec.ExitError + if errors.As(err, &ee) { + return nil, fmt.Errorf("error running goimports: %s", string(ee.Stderr)) + } + return nil, fmt.Errorf("error running goimports: %s", string(out)) + } + + return out, nil +} + +func formatCSource(in []byte) ([]byte, error) { Review Comment: pre-commit would just take care of this for you, though I guess it requires a little setup. ########## .github/workflows/integration.yml: ########## @@ -0,0 +1,197 @@ +# 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. + +name: Integration + +on: + pull_request: + branches: + - main + paths: + - "adbc.h" + - "go/**" + - "c/**" + - "glib/**" + - "python/**" + - ".github/workflows/integration.yml" + push: + paths: + - "adbc.h" + - "go/**" + - "c/**" + - "glib/**" + - "python/**" + - ".github/workflows/integration.yml" + +concurrency: + group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + cpp-conda-unix: + name: "Conda/${{ matrix.os }}" + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: ["macos-latest", "ubuntu-latest"] + env: + # Required for macOS + # https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk + CXXFLAGS: "-D_LIBCPP_DISABLE_AVAILABILITY" + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + persist-credentials: false + - name: Get Date + id: get-date + shell: bash + run: | + echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')" + - name: Cache Conda + uses: actions/cache@v3 + env: + # Increment this to reset cache manually + CACHE_NUMBER: 0 + with: + path: ~/conda_pkgs_dir + key: conda-${{ runner.os }}-${{ steps.get-date.outputs.today }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/**') }} + - uses: conda-incubator/setup-miniconda@v2 + with: + miniforge-variant: Mambaforge + miniforge-version: latest + use-mamba: true + - name: Install Dependencies + shell: bash -l {0} + run: | + mamba install -c conda-forge \ + 'arrow-c-glib>=10.0.0' \ + --file ci/conda_env_cpp.txt \ + --file ci/conda_env_docs.txt \ + --file ci/conda_env_glib.txt \ + --file ci/conda_env_python.txt + - name: Build and Install (No ASan) + id: build-install + shell: bash -l {0} + run: | + # Python and others need something that don't use the ASAN runtime + rm -rf "$(pwd)/build" + export BUILD_ALL=1 + export ADBC_BUILD_TESTS=OFF + export ADBC_USE_ASAN=OFF + export ADBC_USE_UBSAN=OFF + ./ci/scripts/cpp_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local" + echo "CACHEPATH=$HOME/local" >> $GITHUB_OUTPUT + - name: Cache builds + uses: actions/cache/save@v3 + with: + path: ${{ steps.build-install.outputs.CACHEPATH }} + key: ${{ runner.os }}-cpp-${{ github.sha }} + + go-unix: + name: "Go/${{ matrix.os }}" + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: ["macos-latest", "ubuntu-latest"] + env: + CGO_ENABLED: "1" + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + persist-credentials: false + - uses: actions/setup-go@v3 + with: + go-version: 1.18.6 + check-latest: true + cache: true + cache-dependency-path: go/adbc/go.sum + - name: Build shared lib + id: build-shared + shell: bash -l {0} + run: | + export PATH=$RUNNER_TOOL_CACHE/go/1.18.6/x64/bin:$PATH + pushd go/adbc/pkg + make + mkdir -p $HOME/local/lib + mv lib* $HOME/local/lib/ + echo "CACHEPATH=$HOME/local" >> $GITHUB_OUTPUT + popd + - name: Cache builds + uses: actions/cache/save@v3 + with: + path: ${{ steps.build-shared.outputs.CACHEPATH }} + key: ${{ runner.os }}-go-${{ github.sha }} + + run-tests: + name: "Integration/${{ matrix.os }}" + runs-on: ${{ matrix.os }} + strategy: + matrix: # macos-latest having issues with docker? + os: ["ubuntu-latest"] + needs: [cpp-conda-unix, go-unix] + services: + dremio: + image: dremio/dremio-oss:latest + env: + DREMIO_JAVA_EXTRA_OPTS: "-Ddebug.addDefaultUser=true -Ddremio.eula.disabled=true" + options: >- + --health-cmd "curl --fail http://localhost:9047/ || exit 1" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 9047:9047 + - 32010:32010 + - 31010:31010 + - 45678:45678 + steps: + - name: Get CachePath + id: cache-path + shell: bash -l {0} + run: | + echo "CACHEPATH=$HOME/local" >> $GITHUB_OUTPUT + - name: Restore CPP build + uses: actions/cache/restore@v3 + with: + path: ${{ steps.cache-path.outputs.CACHEPATH }} + key: ${{ runner.os }}-cpp-${{ github.sha }} + - name: Restore Go build + uses: actions/cache/restore@v3 + with: + path: ${{ steps.cache-path.outputs.CACHEPATH }} + key: ${{ runner.os }}-go-${{ github.sha }} + - name: Prove it worked + shell: bash -l {0} + run: | + ls -l $HOME/local/** + + - name: Bootstrap Dremio instance + shell: bash -l {0} + id: bootstrap + run: | + LOGIN=`curl -X POST -H "Content-Type: application/json" "http://localhost:9047/apiv2/login" \ + -d '{"userName":"dremio","password":"dremio123"}'` + echo "LOGIN_RESP=$LOGIN" >> $GITHUB_OUTPUT + + - name: Print Token + shell: bash -l {0} + run: echo "_dremio${{ fromJSON(steps.bootstrap.outputs.LOGIN_RESP).token }}" Review Comment: Seems the actual test step isn't implemented yet? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
