Skip to content

Commit

Permalink
wip: write rust driver_manager
Browse files Browse the repository at this point in the history
  • Loading branch information
wjones127 committed Feb 9, 2023
1 parent 631f068 commit 747b9e2
Show file tree
Hide file tree
Showing 10 changed files with 3,042 additions and 0 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# 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: Rust

on:
pull_request:
branches:
- main
paths:
- "rust/**"
- ".github/workflows/rust.yml"
push:
paths:
- "rust/**"
- ".github/workflows/rust.yml"

concurrency:
group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

permissions:
contents: read

defaults:
run:
working-directory: rust

jobs:
rust:
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
name: "Rust ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: default
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- name: Check format
run: cargo fmt -- --check
- name: Clippy
run: cargo clippy --tests
- name: Install sqlite (Windows)
if: matrix.os == 'windows-latest'
shell: cmd
run: |
choco install sqlite
cd /D C:\ProgramData\chocolatey\lib\SQLite\tools
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsx64.bat"
lib /machine:x64 /def:sqlite3.def /out:sqlite3.lib
echo "C:\ProgramData\chocolatey\lib\SQLite\tools" >> $GITHUB_PATH
- name: Build Driver SQLite (Windows)
if: matrix.os == 'windows-latest'
working-directory: .
shell: pwsh
env:
BUILD_ALL: "0"
BUILD_DRIVER_SQLITE: "1"
ADBC_BUILD_TESTS: OFF
run: |
.\ci\scripts\cpp_build.ps1 $pwd $pwd\build $pwd\rust\build
- name: Build Driver SQLite (Unix)
if: matrix.os != 'windows-latest'
working-directory: .
shell: bash -l {0}
env:
BUILD_ALL: "0"
BUILD_DRIVER_SQLITE: "1"
run: |
./ci/scripts/cpp_build.sh "$(pwd)" "$(pwd)/build" "$(pwd)/rust/build"
- name: Test
run: |
export LD_LIBRARY_PATH=$(pwd)/build/lib
export DYLD_LIBRARY_PATH=$(pwd)/build/lib
cargo test
- name: Check docs
run: cargo doc
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,16 @@ $ pytest -vvx

The Ruby libraries are bindings around the GLib libraries.

### Rust

The Rust components are a standard Rust project.

```shell
$ cd rust
# Build and run tests
$ cargo test
```

## Opening a Pull Request

Before opening a pull request, please run the static checks, which are
Expand Down
18 changes: 18 additions & 0 deletions rust/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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.

Cargo.lock
36 changes: 36 additions & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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]
name = "arrow-adbc"
version = "0.1.0"
edition = "2021"
rust-version = "1.62"
description = "Rust implementation of Arrow Database Connectivity (ADBC)"
homepage = "https://arrow.apache.org/adbc/"
repository = "https://github.com/apache/arrow-adbc"
authors = ["Apache Arrow <dev@arrow.apache.org>"]
license = "Apache-2.0"
keywords = ["arrow", "database", "sql"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
arrow = { version = "32.0.0", features = ["ffi"], default_features = false}
libloading = "0.7"

# TODO: support arrow2 with a non-default feature.
Loading

0 comments on commit 747b9e2

Please sign in to comment.