blob: 261ddb5c127e868f0999d24c0cd72aafbc60dbbf [file] [log] [blame]
# 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/**"
- "glib/**"
- "go/**"
- "python/**"
- "r/**"
- "ruby/**"
- ".github/workflows/native-unix.yml"
push:
paths:
- "adbc.h"
- "c/**"
- "ci/**"
- "glib/**"
- "go/**"
- "python/**"
- "r/**"
- "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.18.6
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.18.6/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.18.6/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"
# ------------------------------------------------------------
# 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_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.18.6
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.18.6/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.18.6/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_docs.txt \
--file ci/conda_env_python.txt
- 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: Test Python Driver Manager
shell: bash -l {0}
run: |
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"
# Docs requires Python packages since it runs doctests
- name: Build Docs
shell: bash -l {0}
run: |
./ci/scripts/docs_build.sh "$(pwd)"
# ------------------------------------------------------------
# R
# ------------------------------------------------------------
r:
name: "R/${{ matrix.config.pkg }} (${{ matrix.config.os }})"
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- {os: macOS-latest, r: 'release', pkg: 'adbcdrivermanager'}
- {os: windows-latest, r: 'release', pkg: 'adbcdrivermanager'}
- {os: ubuntu-latest, r: 'release', pkg: 'adbcdrivermanager'}
- {os: macOS-latest, r: 'release', pkg: 'adbcsqlite'}
- {os: windows-latest, r: 'release', pkg: 'adbcsqlite'}
- {os: ubuntu-latest, r: 'release', pkg: 'adbcsqlite'}
- {os: macOS-latest, r: 'release', pkg: 'adbcpostgresql'}
- {os: windows-latest, r: 'release', pkg: 'adbcpostgresql'}
- {os: ubuntu-latest, r: 'release', pkg: 'adbcpostgresql'}
- {os: macOS-latest, r: 'release', pkg: 'adbcsnowflake'}
- {os: windows-latest, r: 'release', pkg: 'adbcsnowflake'}
- {os: ubuntu-latest, r: 'release', pkg: 'adbcsnowflake'}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true
- name: Set PKG_CONFIG_PATH on MacOS
if: matrix.config.pkg == 'adbcpostgresql' && runner.os == 'macOS'
run: |
PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:$(brew --prefix libpq)/lib/pkgconfig:$(brew --prefix openssl)/lib/pkgconfig"
echo "PKG_CONFIG_PATH=${PKG_CONFIG_PATH}" >> $GITHUB_ENV
- name: Prepare sources (driver manager)
if: matrix.config.pkg == 'adbcdrivermanager'
run: |
R -e 'install.packages("nanoarrow", repos = "https://cloud.r-project.org")'
R CMD INSTALL r/${{ matrix.config.pkg }}
shell: bash
- name: Prepare sources
if: matrix.config.pkg != 'adbcdrivermanager'
run: |
R -e 'install.packages("nanoarrow", repos = "https://cloud.r-project.org")'
R CMD INSTALL r/adbcdrivermanager
R CMD INSTALL r/${{ matrix.config.pkg }}
shell: bash
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck, local::../adbcdrivermanager
needs: check
working-directory: r/${{ matrix.config.pkg }}
- name: Start postgres test database
if: matrix.config.pkg == 'adbcpostgresql' && runner.os == 'Linux'
run: |
cd r/adbcpostgresql
docker compose up --detach postgres_test
ADBC_POSTGRESQL_TEST_URI="postgresql://localhost:5432/postgres?user=postgres&password=password"
echo "ADBC_POSTGRESQL_TEST_URI=${ADBC_POSTGRESQL_TEST_URI}" >> $GITHUB_ENV
- uses: r-lib/actions/check-r-package@v2
env:
ADBC_SNOWFLAKE_TEST_URI: ${{ secrets.SNOWFLAKE_URI }}
with:
upload-snapshots: true
working-directory: r/${{ matrix.config.pkg }}
- name: Stop postgres test database
if: matrix.config.pkg == 'adbcpostgresql' && runner.os == 'Linux'
run: |
cd r/adbcpostgresql
docker compose down