2020-02-19 02:49:43 +08:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-04-12 12:13:09 +08:00
|
|
|
schedule:
|
2021-06-03 03:07:56 +08:00
|
|
|
- cron: "00 01 * * *"
|
2020-04-16 13:06:51 +08:00
|
|
|
env:
|
2022-01-05 13:34:04 +08:00
|
|
|
RUST_BACKTRACE: short
|
|
|
|
# CI builds don't benefit very much from this.
|
|
|
|
CARGO_INCREMENTAL: 0
|
|
|
|
# We can't use a debugger in CI, and this makes builds faster and the cache
|
|
|
|
# smaller. (TODO: use -Cdebuginfo=0 if it doesn't make backtraces useless)
|
|
|
|
RUSTFLAGS: -Cdebuginfo=1
|
|
|
|
|
2020-02-19 02:49:43 +08:00
|
|
|
jobs:
|
|
|
|
test:
|
2020-10-05 03:52:52 +08:00
|
|
|
name: Test ${{ matrix.target }}
|
2020-02-19 02:49:43 +08:00
|
|
|
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
|
|
|
|
matrix:
|
2020-10-05 03:52:52 +08:00
|
|
|
include:
|
2020-02-19 02:49:43 +08:00
|
|
|
- { target: x86_64-pc-windows-msvc, os: windows-latest }
|
2020-04-07 01:43:43 +08:00
|
|
|
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
|
2020-04-12 12:31:29 +08:00
|
|
|
- { target: x86_64-apple-darwin, os: macos-latest }
|
2022-01-05 13:34:04 +08:00
|
|
|
- target: x86_64-pc-windows-gnu
|
|
|
|
os: windows-latest
|
|
|
|
host: -x86_64-pc-windows-gnu
|
2020-02-19 02:49:43 +08:00
|
|
|
|
2020-10-05 03:52:52 +08:00
|
|
|
runs-on: ${{ matrix.os }}
|
2020-02-19 02:49:43 +08:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2020-04-12 11:55:58 +08:00
|
|
|
# This has a matcher for test panics, so we use it even though elsewhere
|
|
|
|
# we use actions-rs/toolchain.
|
|
|
|
- uses: hecrj/setup-rust-action@v1
|
2020-02-19 02:49:43 +08:00
|
|
|
with:
|
2020-10-05 03:52:52 +08:00
|
|
|
rust-version: stable${{ matrix.host }}
|
|
|
|
targets: ${{ matrix.target }}
|
2022-01-07 14:41:33 +08:00
|
|
|
# The `{ sharedKey: ... }` allows different actions to share the cache.
|
|
|
|
# We're using a `fullBuild` key mostly as a "this needs to do the
|
|
|
|
# complete" that needs to do the complete build (that is, including
|
|
|
|
# `--features 'bundled-full session buildtime_bindgen`), which is very
|
|
|
|
# slow, and has several deps.
|
2022-01-05 13:34:04 +08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2022-01-07 14:41:33 +08:00
|
|
|
with: { sharedKey: fullBuild }
|
2020-04-08 00:02:44 +08:00
|
|
|
|
2020-10-05 03:52:52 +08:00
|
|
|
- run: cargo build --features bundled --workspace --all-targets --verbose
|
|
|
|
- run: cargo test --features bundled --workspace --all-targets --verbose
|
|
|
|
- run: cargo test --features bundled --workspace --doc --verbose
|
2020-04-08 05:42:29 +08:00
|
|
|
|
2022-01-06 17:45:59 +08:00
|
|
|
- name: Add llvm path on Windows
|
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
run: echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
|
|
|
|
|
|
- run: cargo test --features 'bundled-full session buildtime_bindgen' --all-targets --workspace --verbose
|
|
|
|
- run: cargo test --features 'bundled-full session buildtime_bindgen' --doc --workspace --verbose
|
2020-04-08 00:02:44 +08:00
|
|
|
|
2022-01-05 13:34:04 +08:00
|
|
|
# TODO: move into own action for better caching
|
2020-02-19 04:17:37 +08:00
|
|
|
- name: Static build
|
2020-04-16 16:57:29 +08:00
|
|
|
# Do we expect this to work / should we test with gnu toolchain?
|
2020-10-05 03:52:52 +08:00
|
|
|
if: matrix.os == 'x86_64-pc-windows-msvc'
|
|
|
|
env:
|
2022-01-05 13:34:04 +08:00
|
|
|
RUSTFLAGS: -Ctarget-feature=+crt-static -Cdebuginfo=1
|
2020-10-05 03:52:52 +08:00
|
|
|
run: cargo build --features bundled
|
2020-04-07 01:43:43 +08:00
|
|
|
|
2021-06-03 03:07:56 +08:00
|
|
|
test-sqlcipher-bundled:
|
|
|
|
name: Test ${{ matrix.os }} (bundled SQLcipher + OpenSSL)
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macos-latest]
|
|
|
|
# TODO: find a way to test this on windows :(
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
# This has a matcher for test panics, so we use it even though elsewhere
|
|
|
|
# we use actions-rs/toolchain.
|
|
|
|
- uses: hecrj/setup-rust-action@v1
|
|
|
|
with:
|
|
|
|
rust-version: stable${{ matrix.host }}
|
|
|
|
targets: ${{ matrix.target }}
|
2022-01-05 13:34:04 +08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2022-01-07 14:41:33 +08:00
|
|
|
with: { sharedKey: fullBuild }
|
2021-06-03 03:07:56 +08:00
|
|
|
|
|
|
|
- run: cargo test --features 'bundled-sqlcipher' --workspace --all-targets --verbose
|
|
|
|
- run: cargo test --features 'bundled-sqlcipher' --workspace --doc --verbose
|
|
|
|
|
|
|
|
- run: cargo test --features 'modern-full bundled-sqlcipher' --workspace --all-targets --verbose
|
|
|
|
- run: cargo test --features 'modern-full bundled-sqlcipher' --workspace --doc --verbose
|
|
|
|
|
|
|
|
- run: cargo test --features 'bundled-sqlcipher-vendored-openssl' --workspace --all-targets --verbose
|
|
|
|
- run: cargo test --features 'bundled-sqlcipher-vendored-openssl' --workspace --doc --verbose
|
|
|
|
|
|
|
|
- run: cargo test --features 'modern-full bundled-sqlcipher-vendored-openssl' --all-targets --workspace --verbose
|
|
|
|
- run: cargo test --features 'modern-full bundled-sqlcipher-vendored-openssl' --doc --workspace --verbose
|
|
|
|
|
2022-01-06 17:45:59 +08:00
|
|
|
- name: Add llvm path on Windows
|
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
run: echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
|
|
|
|
|
|
- run: cargo test --features 'bundled-full session buildtime_bindgen' --all-targets --workspace --verbose
|
|
|
|
- run: cargo test --features 'bundled-full session buildtime_bindgen' --doc --workspace --verbose
|
2021-06-03 03:07:56 +08:00
|
|
|
|
2020-10-05 04:19:14 +08:00
|
|
|
winsqlite3:
|
|
|
|
name: Test with winsqlite3
|
|
|
|
runs-on: windows-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: hecrj/setup-rust-action@v1
|
2022-01-05 13:34:04 +08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2020-10-05 04:19:14 +08:00
|
|
|
# TODO: Should this test GNU toolchain? What about +crt-static?
|
|
|
|
# TODO: Is it worth testing other features?
|
|
|
|
- run: cargo build --features winsqlite3 --workspace --all-targets --verbose
|
|
|
|
- run: cargo test --features winsqlite3 --workspace --all-targets --verbose
|
|
|
|
|
|
|
|
sqlcipher:
|
|
|
|
name: Test with sqlcipher
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: hecrj/setup-rust-action@v1
|
2022-01-05 13:34:04 +08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2020-10-05 04:19:14 +08:00
|
|
|
- run: sudo apt-get install sqlcipher libsqlcipher-dev
|
|
|
|
- run: sqlcipher --version
|
|
|
|
# TODO: Is it worth testing other features?
|
|
|
|
- run: cargo build --features sqlcipher --workspace --all-targets --verbose
|
|
|
|
- run: cargo test --features sqlcipher --workspace --all-targets --verbose
|
|
|
|
|
2020-04-16 17:38:40 +08:00
|
|
|
sanitizer:
|
|
|
|
name: Address Sanitizer
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
# Need nightly rust.
|
2020-10-05 03:52:52 +08:00
|
|
|
- uses: hecrj/setup-rust-action@v1
|
2020-04-16 17:38:40 +08:00
|
|
|
with:
|
2020-10-05 03:52:52 +08:00
|
|
|
rust-version: nightly
|
2020-04-16 17:38:40 +08:00
|
|
|
components: rust-src
|
2022-01-05 13:34:04 +08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2020-04-16 17:38:40 +08:00
|
|
|
- name: Tests with asan
|
|
|
|
env:
|
2022-01-05 13:34:04 +08:00
|
|
|
RUSTFLAGS: -Zsanitizer=address -Cdebuginfo=0
|
2020-04-16 17:38:40 +08:00
|
|
|
RUSTDOCFLAGS: -Zsanitizer=address
|
2021-06-03 03:07:56 +08:00
|
|
|
ASAN_OPTIONS: "detect_stack_use_after_return=1:detect_leaks=0"
|
2020-06-05 14:42:26 +08:00
|
|
|
# Work around https://github.com/rust-lang/rust/issues/59125 by
|
|
|
|
# disabling backtraces. In an ideal world we'd probably suppress the
|
|
|
|
# leak sanitization, but we don't care about backtraces here, so long
|
|
|
|
# as the other tests have them.
|
2021-06-03 03:07:56 +08:00
|
|
|
RUST_BACKTRACE: "0"
|
2021-06-12 01:59:09 +08:00
|
|
|
run: cargo -Z build-std test --features 'bundled-full session buildtime_bindgen with-asan' --target x86_64-unknown-linux-gnu
|
2020-04-16 17:38:40 +08:00
|
|
|
|
2020-04-07 01:43:43 +08:00
|
|
|
# Ensure clippy doesn't complain.
|
|
|
|
clippy:
|
|
|
|
name: Clippy
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2020-04-12 11:31:42 +08:00
|
|
|
- uses: actions/checkout@v2
|
2020-10-05 03:52:52 +08:00
|
|
|
- uses: hecrj/setup-rust-action@v1
|
2020-04-08 00:02:44 +08:00
|
|
|
with:
|
2020-10-05 03:52:52 +08:00
|
|
|
components: clippy
|
2022-01-05 13:34:04 +08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2020-10-05 03:52:52 +08:00
|
|
|
- run: cargo clippy --all-targets --workspace --features bundled -- -D warnings
|
|
|
|
# Clippy with all non-conflicting features
|
2021-06-12 01:59:09 +08:00
|
|
|
- run: cargo clippy --all-targets --workspace --features 'bundled-full session buildtime_bindgen' -- -D warnings
|
2020-04-07 01:43:43 +08:00
|
|
|
|
|
|
|
# Ensure patch is formatted.
|
|
|
|
fmt:
|
|
|
|
name: Format
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2020-04-12 11:31:42 +08:00
|
|
|
- uses: actions/checkout@v2
|
2020-04-12 11:55:58 +08:00
|
|
|
- uses: hecrj/setup-rust-action@v1
|
2020-04-07 01:43:43 +08:00
|
|
|
with:
|
2020-04-12 11:55:58 +08:00
|
|
|
components: rustfmt
|
2020-10-05 03:52:52 +08:00
|
|
|
- run: cargo fmt --all -- --check
|
2020-04-07 01:43:43 +08:00
|
|
|
|
|
|
|
# Detect cases where documentation links don't resolve and such.
|
|
|
|
doc:
|
|
|
|
name: Docs
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2020-04-12 11:53:01 +08:00
|
|
|
- uses: actions/checkout@v2
|
2020-10-05 03:52:52 +08:00
|
|
|
- uses: hecrj/setup-rust-action@v1
|
2022-01-07 14:36:09 +08:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
2022-01-07 14:41:33 +08:00
|
|
|
with: { sharedKey: fullBuild }
|
2022-01-07 14:36:09 +08:00
|
|
|
- run: cargo doc --features 'bundled-full session buildtime_bindgen' --no-deps
|
|
|
|
env: { RUSTDOCFLAGS: -Dwarnings }
|
2020-04-16 13:06:51 +08:00
|
|
|
|
|
|
|
codecov:
|
|
|
|
name: Generate code coverage
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-01-05 19:12:47 +08:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
2020-04-16 13:06:51 +08:00
|
|
|
with:
|
2023-01-05 19:12:47 +08:00
|
|
|
components: 'llvm-tools-preview'
|
|
|
|
- uses: taiki-e/install-action@main
|
|
|
|
with:
|
|
|
|
tool: grcov
|
|
|
|
- name: Run tests for coverage
|
|
|
|
run: |
|
|
|
|
cargo test --verbose
|
|
|
|
cargo test --features="bundled-full" --verbose
|
|
|
|
cargo test --features="bundled-full session buildtime_bindgen" --verbose
|
|
|
|
cargo test --features="bundled-sqlcipher-vendored-openssl" --verbose
|
|
|
|
env:
|
|
|
|
RUSTFLAGS: -Cinstrument-coverage
|
|
|
|
RUSTDOCFLAGS: -Cinstrument-coverage
|
|
|
|
LLVM_PROFILE_FILE: rusqlite-%p-%m.profraw
|
|
|
|
- name: Produce coverage info
|
|
|
|
run: |
|
|
|
|
grcov $(find . -name "rusqlite-*.profraw" -print) \
|
|
|
|
-s . \
|
|
|
|
--branch \
|
|
|
|
--ignore-not-existing \
|
|
|
|
--ignore='target/*' \
|
|
|
|
--ignore='benches/*' \
|
|
|
|
--ignore='/*' \
|
|
|
|
--binary-path ./target/debug/ \
|
|
|
|
--excl-line='#\[derive' \
|
|
|
|
-t lcov \
|
|
|
|
-o lcov.info
|
2020-04-16 13:06:51 +08:00
|
|
|
- name: Upload to codecov.io
|
2023-01-05 19:12:47 +08:00
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
|
|
|
files: lcov.info
|
|
|
|
fail_ci_if_error: true
|