Add a "sqlite-unbundled" feature that dynamically links to system libsqlite3.so library (#3507)

* Add a "sqlite-unbundled" feature that dynamically links to system libsqlite3.so library

* update README abouot the newly-added `sqlite-unbundled` feature

* Update README.md to make it clear with bulleted list

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>

* more cfg feature updates

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>

* update documentation in sqlx-sqlx/src/lib.rs too

and also mention possible build time increasement.

* cargo fmt

* Add "sqlite-unbundled" feature to sqlx-cli

* Add sqlite-unbundled to gituhb actions tests

* cfg(feature = "sqlite") => cfg(any(feature = "sqlite", feature = "sqlite-unbundled"))

* fix

* CI: make sqlite-unbundled tests workaround required-features

by duplicating the relevant test section

* use an internal "_sqlite" feature to do the conditional compilation

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
This commit is contained in:
依云
2024-10-03 02:55:21 +08:00
committed by GitHub
parent 68da5aefea
commit 5b8bb3b28b
20 changed files with 68 additions and 26 deletions

View File

@@ -117,6 +117,7 @@ jobs:
strategy:
matrix:
runtime: [async-std, tokio]
linking: [sqlite, sqlite-unbundled]
needs: check
steps:
- uses: actions/checkout@v4
@@ -125,7 +126,11 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
key: "${{ runner.os }}-sqlite-${{ matrix.runtime }}-${{ matrix.tls }}"
key: "${{ runner.os }}-${{ matrix.linking }}-${{ matrix.runtime }}-${{ matrix.tls }}"
- name: Install system sqlite library
if: ${{ matrix.linking == 'sqlite-unbundled' }}
run: sudo apt-get install -y libsqlite3-dev
- run: echo "using ${DATABASE_URL}"
@@ -135,7 +140,7 @@ jobs:
- run: >
cargo test
--no-default-features
--features any,macros,sqlite,_unstable-all-types,runtime-${{ matrix.runtime }}
--features any,macros,${{ matrix.linking }},_unstable-all-types,runtime-${{ matrix.runtime }}
--
--test-threads=1
env:
@@ -151,8 +156,8 @@ jobs:
- run: >
cargo build
--no-default-features
--test sqlite-macros
--features any,macros,sqlite,_unstable-all-types,runtime-${{ matrix.runtime }}
--test ${{ matrix.linking }}-macros
--features any,macros,${{ matrix.linking }},_unstable-all-types,runtime-${{ matrix.runtime }}
env:
SQLX_OFFLINE: true
SQLX_OFFLINE_DIR: .sqlx
@@ -163,8 +168,8 @@ jobs:
- run: >
cargo test
--no-default-features
--test sqlite-macros
--features any,macros,sqlite,_unstable-all-types,runtime-${{ matrix.runtime }}
--test ${{ matrix.linking }}-macros
--features any,macros,${{ matrix.linking }},_unstable-all-types,runtime-${{ matrix.runtime }}
env:
DATABASE_URL: sqlite://tests/sqlite/sqlite.db
SQLX_OFFLINE: true