Skip to content

refactor: Refactored SQL, made the code modular, and added tests for … #10

refactor: Refactored SQL, made the code modular, and added tests for …

refactor: Refactored SQL, made the code modular, and added tests for … #10

Workflow file for this run

# 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: Native Libraries (Unix)
on:
pull_request:
branches:
- main
paths:
- "adbc.h"
- "c/**"
- "ci/**"
- "docs/**"
- "glib/**"
- "go/**"
- "python/**"
- "ruby/**"
- ".github/workflows/native-unix.yml"
push:
paths:
- "adbc.h"
- "c/**"
- "ci/**"
- "docs/**"
- "glib/**"
- "go/**"
- "python/**"
- "ruby/**"
- ".github/workflows/native-unix.yml"
concurrency:
group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
permissions:
contents: read
env:
# Increment this to reset cache manually
CACHE_NUMBER: "1"
jobs:
# ------------------------------------------------------------
# Common build (builds libraries used in GLib, Python, Ruby)
# ------------------------------------------------------------
drivers-build-conda:
name: "Common Libraries (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 "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
- name: Cache Conda
uses: actions/cache@v3
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-only-tar-bz2: false
use-mamba: true
- name: Install Dependencies
shell: bash -l {0}
run: |
mamba install -c conda-forge \
--file ci/conda_env_cpp.txt
- uses: actions/setup-go@v3
with:
go-version: 1.19.13
check-latest: true
cache: true
cache-dependency-path: go/adbc/go.sum
- name: Build and Install (No ASan)
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
export PATH=$RUNNER_TOOL_CACHE/go/1.19.13/x64/bin:$PATH
./ci/scripts/cpp_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
- name: Go Build
shell: bash -l {0}
env:
CGO_ENABLED: "1"
run: |
export PATH=$RUNNER_TOOL_CACHE/go/1.19.13/x64/bin:$PATH
./ci/scripts/go_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
- uses: actions/upload-artifact@v3
with:
name: driver-manager-${{ matrix.os }}
retention-days: 3
path: |
~/local
# ------------------------------------------------------------
# C/C++ (builds and tests)
# ------------------------------------------------------------
drivers-test-conda:
name: "C/C++ (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 "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
- name: Cache Conda
uses: actions/cache@v3
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-only-tar-bz2: false
use-mamba: true
- name: Install Dependencies
shell: bash -l {0}
run: |
mamba install -c conda-forge \
--file ci/conda_env_cpp.txt
- name: Build SQLite3 Driver
shell: bash -l {0}
run: |
env BUILD_ALL=0 BUILD_DRIVER_SQLITE=1 ./ci/scripts/cpp_build.sh "$(pwd)" "$(pwd)/build"
- name: Test SQLite3 Driver
shell: bash -l {0}
run: |
env BUILD_ALL=0 BUILD_DRIVER_SQLITE=1 ./ci/scripts/cpp_test.sh "$(pwd)/build"
- name: Build PostgreSQL Driver
shell: bash -l {0}
run: |
env BUILD_ALL=0 BUILD_DRIVER_POSTGRESQL=1 ./ci/scripts/cpp_build.sh "$(pwd)" "$(pwd)/build"
- name: Build Driver Manager
shell: bash -l {0}
run: |
env BUILD_ALL=0 BUILD_DRIVER_MANAGER=1 ./ci/scripts/cpp_build.sh "$(pwd)" "$(pwd)/build"
- name: Test Driver Manager
shell: bash -l {0}
run: |
./ci/scripts/cpp_test.sh "$(pwd)/build"
clang-tidy-conda:
name: "clang-tidy"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Get Date
id: get-date
shell: bash
run: |
echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
- name: Cache Conda
uses: actions/cache@v3
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-only-tar-bz2: false
use-mamba: true
- name: Install Dependencies
shell: bash -l {0}
run: |
mamba install -c conda-forge \
--file ci/conda_env_cpp.txt \
--file ci/conda_env_cpp_lint.txt
- name: clang-tidy
shell: bash -l {0}
run: |
./ci/scripts/cpp_clang_tidy.sh "$(pwd)" "$(pwd)/build"
# ------------------------------------------------------------
# GLib/Ruby
# ------------------------------------------------------------
glib-conda:
name: "GLib/Ruby (Conda/${{ matrix.os }})"
runs-on: ${{ matrix.os }}
needs:
- drivers-build-conda
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 "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
- name: Cache Conda
uses: actions/cache@v3
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-only-tar-bz2: false
use-mamba: true
- name: Install Dependencies
shell: bash -l {0}
run: |
mamba install -c conda-forge \
'arrow-c-glib>=10.0.1' \
--file ci/conda_env_cpp.txt \
--file ci/conda_env_glib.txt
- uses: actions/download-artifact@v3
with:
name: driver-manager-${{ matrix.os }}
path: ~/local
- name: Build GLib Driver Manager
shell: bash -l {0}
run: |
env BUILD_ALL=0 BUILD_DRIVER_MANAGER=1 ./ci/scripts/glib_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
- name: Test GLib/Ruby Driver Manager
shell: bash -l {0}
run: |
env BUILD_ALL=0 BUILD_DRIVER_MANAGER=1 ./ci/scripts/glib_test.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
# ------------------------------------------------------------
# Go
# ------------------------------------------------------------
go-no-cgo:
name: "Go (No CGO) (${{ matrix.os }})"
env:
CGO_ENABLED: "0"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["macos-latest", "ubuntu-latest", "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
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@v0.3.3
- name: Go Build
run: |
./ci/scripts/go_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
- name: Run Staticcheck
run: |
pushd go/adbc
staticcheck -f stylish ./...
popd
- name: Go Test
env:
SNOWFLAKE_DATABASE: ADBC_TESTING
SNOWFLAKE_URI: ${{ secrets.SNOWFLAKE_URI }}
run: |
./ci/scripts/go_test.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
go-conda:
name: "Go (CGO) (Conda/${{ matrix.os }})"
runs-on: ${{ matrix.os }}
needs:
- drivers-build-conda
strategy:
matrix:
os: ["macos-latest", "ubuntu-latest"]
env:
CGO_ENABLED: "1"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Get Date
id: get-date
shell: bash
run: |
echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
- name: Cache Conda
uses: actions/cache@v3
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-only-tar-bz2: false
use-mamba: true
- name: Install Dependencies
shell: bash -l {0}
run: |
mamba install -c conda-forge \
--file ci/conda_env_cpp.txt
- uses: actions/setup-go@v3
with:
go-version: 1.19.13
check-latest: true
cache: true
cache-dependency-path: go/adbc/go.sum
- name: Install staticcheck
shell: bash -l {0}
if: ${{ !contains('macos-latest', matrix.os) }}
run: go install honnef.co/go/tools/cmd/staticcheck@v0.3.3
- uses: actions/download-artifact@v3
with:
name: driver-manager-${{ matrix.os }}
path: ~/local
- name: Go Build
shell: bash -l {0}
run: |
export PATH=$RUNNER_TOOL_CACHE/go/1.19.13/x64/bin:$PATH
./ci/scripts/go_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
- name: Run Staticcheck
if: ${{ !contains('macos-latest', matrix.os) }}
shell: bash -l {0}
run: |
pushd go/adbc
staticcheck -f stylish ./...
popd
- name: Go Test
shell: bash -l {0}
env:
SNOWFLAKE_URI: ${{ secrets.SNOWFLAKE_URI }}
run: |
export PATH=$RUNNER_TOOL_CACHE/go/1.19.13/x64/bin:$PATH
./ci/scripts/go_test.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
# ------------------------------------------------------------
# Python/doctests
# ------------------------------------------------------------
python-conda:
name: "Python ${{ matrix.python }} (Conda/${{ matrix.os }})"
runs-on: ${{ matrix.os }}
needs:
- drivers-build-conda
strategy:
matrix:
os: ["macos-latest", "ubuntu-latest"]
python: ["3.9", "3.11"]
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 "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
- name: Cache Conda
uses: actions/cache@v3
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-only-tar-bz2: false
use-mamba: true
- name: Install Dependencies
shell: bash -l {0}
run: |
mamba install -c conda-forge \
python=${{ matrix.python }} \
--file ci/conda_env_cpp.txt \
--file ci/conda_env_python.txt
- uses: actions/setup-go@v3
with:
go-version: 1.19.13
check-latest: true
cache: true
cache-dependency-path: go/adbc/go.sum
- uses: actions/download-artifact@v3
with:
name: driver-manager-${{ matrix.os }}
path: ~/local
- name: Build Python Driver Manager
shell: bash -l {0}
run: |
env BUILD_ALL=0 BUILD_DRIVER_MANAGER=1 ./ci/scripts/python_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
- name: Build Panic Dummy
shell: bash -l {0}
run: |
if [[ $(uname) = "Darwin" ]]; then
make -C ./go/adbc/pkg libadbc_driver_panicdummy.dylib
else
make -C ./go/adbc/pkg libadbc_driver_panicdummy.so
fi
- name: Test Python Driver Manager
shell: bash -l {0}
run: |
if [[ $(uname) = "Darwin" ]]; then
export PANICDUMMY_LIBRARY_PATH=$(pwd)/go/adbc/pkg/libadbc_driver_panicdummy.dylib
else
export PANICDUMMY_LIBRARY_PATH=$(pwd)/go/adbc/pkg/libadbc_driver_panicdummy.so
fi
env BUILD_ALL=0 BUILD_DRIVER_MANAGER=1 ./ci/scripts/python_test.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
- name: Build Python Driver Flight SQL
shell: bash -l {0}
run: |
env BUILD_ALL=0 BUILD_DRIVER_FLIGHTSQL=1 ./ci/scripts/python_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
- name: Test Python Driver Flight SQL
shell: bash -l {0}
run: |
env BUILD_ALL=0 BUILD_DRIVER_FLIGHTSQL=1 ./ci/scripts/python_test.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
- name: Build Python Driver PostgreSQL
shell: bash -l {0}
run: |
env BUILD_ALL=0 BUILD_DRIVER_POSTGRESQL=1 ./ci/scripts/python_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
- name: Test Python Driver PostgreSQL
shell: bash -l {0}
run: |
env BUILD_ALL=0 BUILD_DRIVER_POSTGRESQL=1 ./ci/scripts/python_test.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
- name: Build Python Driver SQLite
shell: bash -l {0}
run: |
env BUILD_ALL=0 BUILD_DRIVER_SQLITE=1 ./ci/scripts/python_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
- name: Test Python Driver SQLite
shell: bash -l {0}
run: |
env BUILD_ALL=0 BUILD_DRIVER_SQLITE=1 ./ci/scripts/python_test.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
- name: Build Python Driver Snowflake
shell: bash -l {0}
run: |
env BUILD_ALL=0 BUILD_DRIVER_SNOWFLAKE=1 ./ci/scripts/python_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
- name: Test Python Driver Snowflake
shell: bash -l {0}
run: |
env BUILD_ALL=0 BUILD_DRIVER_SNOWFLAKE=1 ./ci/scripts/python_test.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
- name: Typecheck Python
shell: bash -l {0}
run: |
./ci/scripts/python_typecheck.sh "$(pwd)"
python-docs:
name: "Documentation ${{ matrix.python }} (Conda/${{ matrix.os }})"
runs-on: ${{ matrix.os }}
needs:
- drivers-build-conda
services:
postgres:
image: postgres
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: password
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
strategy:
matrix:
os: ["ubuntu-latest"]
python: ["3.11"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Get Date
id: get-date
shell: bash
run: |
echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
- name: Cache Conda
uses: actions/cache@v3
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-only-tar-bz2: false
use-mamba: true
- name: Install Dependencies
shell: bash -l {0}
run: |
mamba install -c conda-forge \
python=${{ matrix.python }} \
--file ci/conda_env_docs.txt \
--file ci/conda_env_python.txt
- uses: actions/download-artifact@v3
with:
name: driver-manager-${{ matrix.os }}
path: ~/local
- name: Build Python
shell: bash -l {0}
run: |
env BUILD_ALL=1 ./ci/scripts/python_build.sh "$(pwd)" "$(pwd)/build" "$HOME/local"
# Docs requires Python packages since it runs doctests
- name: Build Docs
shell: bash -l {0}
run: |
./ci/scripts/docs_build.sh "$(pwd)"
- name: Test Recipes (C++)
shell: bash -l {0}
run: |
./ci/scripts/cpp_recipe.sh $(pwd) ~/local build/recipe
- name: Test Recipes (Python)
shell: bash -l {0}
env:
ADBC_POSTGRESQL_TEST_URI: "postgres://localhost:5432/postgres?user=postgres&password=password"
run: |
pytest -vvs docs/source/tests/