-
Notifications
You must be signed in to change notification settings - Fork 116
174 lines (156 loc) · 6.07 KB
/
rust.yaml
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
RUST_BACKTRACE: 1
jobs:
test:
name: Test ${{ matrix.target }}
strategy:
fail-fast: true
matrix:
include:
- { target: x86_64-pc-windows-msvc, os: windows-latest, duckdb: libduckdb-windows-amd64.zip }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, duckdb: libduckdb-linux-amd64.zip }
#- { 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 }}
components: 'rustfmt, clippy'
# download libduckdb
- uses: robinraju/release-downloader@v1.4
name: Download duckdb
with:
repository: "duckdb/duckdb"
tag: "v1.1.1"
fileName: ${{ matrix.duckdb }}
out-file-path: .
# For Linux
- name: Linux extract duckdb
if: matrix.os == 'ubuntu-latest'
uses: ihiroky/extract-action@v1
with:
file_path: ${{ github.workspace }}/${{ matrix.duckdb }}
extract_dir: libduckdb
- run: cargo fmt --all -- --check
if: matrix.os == 'ubuntu-latest'
# TODO: remove
- name: Workaround for https://github.com/pola-rs/polars/issues/19063
run: |
cargo update indexmap@2.6.0 --precise 2.5.0
- name: run cargo clippy
if: matrix.os == 'ubuntu-latest'
env:
DUCKDB_LIB_DIR: ${{ github.workspace }}/libduckdb
DUCKDB_INCLUDE_DIR: ${{ github.workspace }}/libduckdb
LD_LIBRARY_PATH: ${{ github.workspace }}/libduckdb
run: |
cargo clippy --all-targets --workspace --all-features -- -D warnings -A clippy::redundant-closure
- name: Run cargo-tarpaulin
if: matrix.os == 'ubuntu-latest'
uses: actions-rs/tarpaulin@v0.1
with:
# Intentionally omit time feature until we're on time 0.3, at which
# point it should be added to `bundled-full`.
args: '--features "buildtime_bindgen modern-full vtab-full vtab-loadable" --avoid-cfg-tarpaulin' # TODO restore to normal (https://github.com/xd009642/tarpaulin/issues/756#issuecomment-838769320)
version: 0.22.0
env:
DUCKDB_LIB_DIR: ${{ github.workspace }}/libduckdb
DUCKDB_INCLUDE_DIR: ${{ github.workspace }}/libduckdb
LD_LIBRARY_PATH: ${{ github.workspace }}/libduckdb
- name: Upload to codecov.io
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v1
# For windows
- name: Windows extract duckdb
if: matrix.os == 'windows-latest'
uses: DuckSoft/extract-7z-action@v1.0
with:
pathSource: D:\a\duckdb-rs\duckdb-rs\${{ matrix.duckdb }}
pathTarget: ${{ github.workspace }}/libduckdb
- name: Add path to PATH environment variable
if: matrix.os == 'windows-latest'
uses: myci-actions/export-env-var-powershell@1
with:
name: PATH
value: $env:PATH;${{ github.workspace }}/libduckdb
- name: Run cargo-test
if: matrix.os == 'windows-latest'
run: cargo test --features "modern-full vtab-full vtab-loadable"
env:
DUCKDB_LIB_DIR: ${{ github.workspace }}/libduckdb
DUCKDB_INCLUDE_DIR: ${{ github.workspace }}/libduckdb
- name: Build loadable extension
run: cargo build --example hello-ext --features="vtab-loadable"
env:
DUCKDB_LIB_DIR: ${{ github.workspace }}/libduckdb
DUCKDB_INCLUDE_DIR: ${{ github.workspace }}/libduckdb
LD_LIBRARY_PATH: ${{ github.workspace }}/libduckdb
- name: Build loadable extension
run: cargo build --example hello-ext-capi --features="vtab-loadable loadable-extension"
env:
DUCKDB_LIB_DIR: ${{ github.workspace }}/libduckdb
DUCKDB_INCLUDE_DIR: ${{ github.workspace }}/libduckdb
LD_LIBRARY_PATH: ${{ github.workspace }}/libduckdb
Windows:
name: Windows build from source
needs: test
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v3
with:
path: ~/.cargo/registry/index
key: index-${{ runner.os }}-${{ github.run_number }}
restore-keys: |
index-${{ runner.os }}-
- uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
targets: x86_64-pc-windows-msvc
- run: cargo install cargo-examples
Sanitizer:
name: Address Sanitizer
needs: test
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 -C debuginfo=0
RUSTDOCFLAGS: -Zsanitizer=address
ASAN_OPTIONS: "detect_stack_use_after_return=1:detect_leaks=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"
run: |
# TODO switch back to modern-full once polars is fixed
cargo -Z build-std test --features "chrono serde_json url r2d2 uuid extensions-full" --target x86_64-unknown-linux-gnu --package duckdb
- name: publish crates --dry-run
uses: katyo/publish-crates@v2
with:
path: './'
args: --allow-dirty --all-features
dry-run: true
ignore-unpublished-changes: true