Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rust/drivermgr): start rust driver_manager #416

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# 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: Build Driver SQLite (Windows)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may or may not want to integrate with the main pipeline, which will build all these artifacts once so you can just download them from other jobs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now it seems clear enough while separate. But if we rely on any more artifacts from the other build, then I think we should merge.

if: matrix.os == 'windows-latest'
working-directory: .
shell: pwsh
env:
BUILD_ALL: "0"
BUILD_DRIVER_SQLITE: "1"
ADBC_BUILD_TESTS: OFF
run: |
vcpkg --triplet x64-windows install sqlite3
$env:CMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake"
.\ci\scripts\cpp_build.ps1 $pwd $pwd\build $pwd\rust\build
"$pwd\rust\build\bin" >> $env:GITHUB_PATH
- 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"
echo "LD_LIBRARY_PATH=$(pwd)/rust/build/lib" >> $GITHUB_ENV
- name: Test
shell: bash -l {0}
run: |
# MacOS library path needs to be set within action, since it is cleared
# when new processes are created.
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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: version needs to be bumped (also, we'll have to add this to the release scripts)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I'll need to look at what needs to be done for release.

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 <[email protected]>"]
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the upcoming merger - should we target arrow2 directly if that is going to be the primary implementation?

Loading