rusqlite/.github/workflows/main.yml

182 lines
5.6 KiB
YAML
Raw Normal View History

2020-02-19 02:49:43 +08:00
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: '00 01 * * *'
2020-04-16 13:06:51 +08:00
env:
RUST_BACKTRACE: 1
2020-02-19 02:49:43 +08:00
jobs:
test:
name: Test
strategy:
fail-fast: false
matrix:
platform:
- { target: x86_64-pc-windows-msvc, os: windows-latest }
- { 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 }
2020-04-16 16:57:29 +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
runs-on: ${{ matrix.platform.os }}
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
2020-02-19 02:49:43 +08:00
with:
2020-04-16 16:57:29 +08:00
rust-version: stable${{ matrix.platform.host }}
targets: ${{ matrix.platform.target }}
- uses: actions-rs/cargo@v1
with:
command: build
args: --features bundled --workspace --all-targets
- uses: actions-rs/cargo@v1
with:
command: test
args: --features bundled --workspace --all-targets
- name: "cargo test --features 'bundled-full session buildtime_bindgen'"
# TODO: clang is installed on these -- but `bindgen` can't find it...
if: matrix.platform.os != 'windows-latest'
uses: actions-rs/cargo@v1
with:
command: test
args: --features 'bundled-full session buildtime_bindgen' --all-targets --workspace
- name: "cargo test --doc --features 'bundled-full session buildtime_bindgen'"
# TODO: clang is installed on these -- but `bindgen` can't find it...
if: matrix.platform.os != 'windows-latest'
uses: actions-rs/cargo@v1
with:
command: test
args: --features 'bundled-full session buildtime_bindgen' --doc --workspace
- name: "cargo test --features bundled-full"
uses: actions-rs/cargo@v1
with:
command: test
args: --features bundled-full --all-targets --workspace
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?
if: matrix.platform.os == 'x86_64-pc-windows-msvc'
2020-02-19 04:17:37 +08:00
shell: cmd
run: |
set RUSTFLAGS=-Ctarget-feature=+crt-static
cargo build --features bundled
2020-04-16 17:38:40 +08:00
sanitizer:
name: Address Sanitizer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Need nightly rust.
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rust-src
- name: Tests with asan
env:
RUSTFLAGS: -Zsanitizer=address
RUSTDOCFLAGS: -Zsanitizer=address
ASAN_OPTIONS: 'detect_stack_use_after_return=1'
# 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.
RUST_BACKTRACE: '0'
2020-04-16 17:38:40 +08:00
run: cargo -Z build-std test --features 'bundled-full session buildtime_bindgen with-asan' --target x86_64-unknown-linux-gnu
# Ensure clippy doesn't complain.
clippy:
name: Clippy
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
2020-04-12 11:31:42 +08:00
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
# clippy with just bundled
args: --all-targets --workspace --features bundled -- -D warnings
- uses: actions-rs/cargo@v1
with:
command: clippy
# Clippy with all non-conflicting features
args: --all-targets --workspace --features 'bundled-full session buildtime_bindgen' -- -D warnings
# Ensure patch is formatted.
fmt:
name: Format
runs-on: ubuntu-latest
steps:
2020-04-12 11:31:42 +08:00
- uses: actions/checkout@v2
# This has a matcher for rustfmt errors, so we use it even though
# elsewhere we use actions-rs/toolchain.
- uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
components: rustfmt
- 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:
2020-04-12 11:53:01 +08:00
- uses: actions/checkout@v2
- 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
with:
2020-04-12 11:54:38 +08:00
# Need to use `cargo rustdoc` to actually get it to respect -D
# warnings... Note: this also requires nightly.
command: rustdoc
args: --features 'bundled-full session buildtime_bindgen' -- -D warnings
2020-04-16 13:06:51 +08:00
codecov:
name: Generate code coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Run cargo-tarpaulin
uses: actions-rs/tarpaulin@v0.1
with:
args: '--features "bundled-full session buildtime_bindgen"'
- name: Upload to codecov.io
uses: codecov/codecov-action@v1