forked from rusqlite/rusqlite
-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (137 loc) · 5.2 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: '00 01 * * *'
env:
RUST_BACKTRACE: 1
jobs:
test:
name: Test ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
include:
- { target: x86_64-pc-windows-msvc, os: windows-latest }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
- { target: x86_64-apple-darwin, os: macos-latest }
- { target: x86_64-pc-windows-gnu, os: windows-latest, host: -x86_64-pc-windows-gnu }
runs-on: ${{ matrix.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
with:
rust-version: stable${{ matrix.host }}
targets: ${{ matrix.target }}
- 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
- name: Test Features
# TODO: clang is installed on these -- but `bindgen` can't find it...
if: matrix.os != 'windows-latest'
run: |
cargo test --features 'bundled-full session buildtime_bindgen time' --all-targets --workspace --verbose
cargo test --features 'bundled-full session buildtime_bindgen time' --doc --workspace --verbose
- name: Static build
# Do we expect this to work / should we test with gnu toolchain?
if: matrix.os == 'x86_64-pc-windows-msvc'
env:
RUSTFLAGS: -Ctarget-feature=+crt-static
run: cargo build --features bundled
winsqlite3:
name: Test with winsqlite3
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: hecrj/setup-rust-action@v1
# 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
- 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
sanitizer:
name: Address Sanitizer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Need nightly rust.
- uses: hecrj/setup-rust-action@v1
with:
rust-version: nightly
components: rust-src
- name: Tests with asan
env:
RUSTFLAGS: -Zsanitizer=address
RUSTDOCFLAGS: -Zsanitizer=address
ASAN_OPTIONS: 'detect_stack_use_after_return=1:detect_leaks=0'
# 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'
run: cargo -Z build-std test --features 'bundled-full session buildtime_bindgen time with-asan' --target x86_64-unknown-linux-gnu
# Ensure clippy doesn't complain.
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: hecrj/setup-rust-action@v1
with:
components: clippy
- run: cargo clippy --all-targets --workspace --features bundled -- -D warnings
# Clippy with all non-conflicting features
- run: cargo clippy --all-targets --workspace --features 'bundled-full session buildtime_bindgen time' -- -D warnings
# Ensure patch is formatted.
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: hecrj/setup-rust-action@v1
with:
components: rustfmt
- run: cargo fmt --all -- --check
# Detect cases where documentation links don't resolve and such.
doc:
name: Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: hecrj/setup-rust-action@v1
with:
rust-version: nightly
# Need to use `cargo rustdoc` to actually get it to respect -D
# warnings... Note: this also requires nightly.
- run: cargo rustdoc --features 'bundled-full session buildtime_bindgen time' -- -D warnings
codecov:
name: Generate code coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: hecrj/setup-rust-action@v1
- name: Run cargo-tarpaulin
uses: actions-rs/[email protected]
with:
# Intentionally omit time feature until we're on time 0.3, at which
# point it should be added to `bundled-full`.
args: '--features "bundled-full session buildtime_bindgen"'
- name: Upload to codecov.io
uses: codecov/codecov-action@v1