mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-26 03:11:36 +08:00
Improve CI test coverage (#670)
* Improve CI test coverage * Run clippy/rustfmt/rustdoc in CI * Disable warnings when building bundled sqlite
This commit is contained in:
parent
521f8dc481
commit
26c744d0c3
59
.github/workflows/main.yml
vendored
59
.github/workflows/main.yml
vendored
@ -19,7 +19,7 @@ jobs:
|
|||||||
platform:
|
platform:
|
||||||
# - { target: x86_64-pc-windows-gnu, os: windows-latest }
|
# - { target: x86_64-pc-windows-gnu, os: windows-latest }
|
||||||
- { target: x86_64-pc-windows-msvc, os: windows-latest }
|
- { target: x86_64-pc-windows-msvc, os: windows-latest }
|
||||||
# - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
|
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
|
||||||
|
|
||||||
runs-on: ${{ matrix.platform.os }}
|
runs-on: ${{ matrix.platform.os }}
|
||||||
|
|
||||||
@ -35,9 +35,66 @@ jobs:
|
|||||||
- run: cargo build --features bundled --workspace --all-targets
|
- run: cargo build --features bundled --workspace --all-targets
|
||||||
- run: cargo test --features bundled --workspace --all-targets
|
- run: cargo test --features bundled --workspace --all-targets
|
||||||
- run: cargo test --features bundled --workspace --doc
|
- run: cargo test --features bundled --workspace --doc
|
||||||
|
# We can't use --all-features.
|
||||||
|
- run: cargo test --features 'array backup blob bundled chrono collation csvtab extra_check functions hooks i128_blob limits load_extension serde_json series trace url vtab_v3 window'
|
||||||
- name: Static build
|
- name: Static build
|
||||||
if: matrix.platform.os == 'windows-latest'
|
if: matrix.platform.os == 'windows-latest'
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
set RUSTFLAGS=-Ctarget-feature=+crt-static
|
set RUSTFLAGS=-Ctarget-feature=+crt-static
|
||||||
cargo build --features bundled
|
cargo build --features bundled
|
||||||
|
|
||||||
|
# Ensure clippy doesn't complain.
|
||||||
|
clippy:
|
||||||
|
name: Clippy
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
- run: rustup component add clippy
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
env:
|
||||||
|
RUSTFLAGS: -D warnings
|
||||||
|
with:
|
||||||
|
command: clippy
|
||||||
|
args: --features 'array backup blob bundled chrono collation csvtab extra_check functions hooks i128_blob limits load_extension serde_json series trace url vtab_v3 window' -- -D warnings
|
||||||
|
|
||||||
|
# Ensure patch is formatted.
|
||||||
|
fmt:
|
||||||
|
name: Format
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
- run: rustup component add rustfmt
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: fmt
|
||||||
|
args: --all -- --check
|
||||||
|
|
||||||
|
# Detect cases where documentation links don't resolve and such.
|
||||||
|
doc:
|
||||||
|
name: Docs
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
# Docs.rs uses nightly, which allows for easier syntax for linking to functions.
|
||||||
|
toolchain: nightly
|
||||||
|
override: true
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
env:
|
||||||
|
RUSTFLAGS: -D warnings
|
||||||
|
with:
|
||||||
|
command: doc
|
||||||
|
args: --no-deps --features 'array backup blob bundled chrono collation csvtab extra_check functions hooks i128_blob limits load_extension serde_json series trace url vtab_v3 window'
|
||||||
|
@ -78,7 +78,8 @@ mod build_bundled {
|
|||||||
.flag("-DSQLITE_SOUNDEX")
|
.flag("-DSQLITE_SOUNDEX")
|
||||||
.flag("-DSQLITE_THREADSAFE=1")
|
.flag("-DSQLITE_THREADSAFE=1")
|
||||||
.flag("-DSQLITE_USE_URI")
|
.flag("-DSQLITE_USE_URI")
|
||||||
.flag("-DHAVE_USLEEP=1");
|
.flag("-DHAVE_USLEEP=1")
|
||||||
|
.warnings(false);
|
||||||
// Older versions of visual studio don't support c99 (including isnan), which
|
// Older versions of visual studio don't support c99 (including isnan), which
|
||||||
// causes a build failure when the linker fails to find the `isnan`
|
// causes a build failure when the linker fails to find the `isnan`
|
||||||
// function. `sqlite` provides its own implmentation, using the fact
|
// function. `sqlite` provides its own implmentation, using the fact
|
||||||
|
@ -118,16 +118,15 @@ impl InnerConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let callback: fn(&Connection, &str) -> Result<()> = mem::transmute(arg1);
|
let callback: fn(&Connection, &str) -> Result<()> = mem::transmute(arg1);
|
||||||
if catch_unwind(|| {
|
let res = catch_unwind(|| {
|
||||||
let conn = Connection::from_handle(arg2).unwrap();
|
let conn = Connection::from_handle(arg2).unwrap();
|
||||||
let collation_name = {
|
let collation_name = {
|
||||||
let c_slice = CStr::from_ptr(arg3).to_bytes();
|
let c_slice = CStr::from_ptr(arg3).to_bytes();
|
||||||
str::from_utf8_unchecked(c_slice)
|
str::from_utf8_unchecked(c_slice)
|
||||||
};
|
};
|
||||||
callback(&conn, collation_name)
|
callback(&conn, collation_name)
|
||||||
})
|
});
|
||||||
.is_err()
|
if res.is_err() {
|
||||||
{
|
|
||||||
return; // FIXME How ?
|
return; // FIXME How ?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user