Skip to content

Commit c218075

Browse files
authored
Merge branch 'main' into master
2 parents 6f5f155 + 70b49c5 commit c218075

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+6957
-1655
lines changed

.evergreen/Cargo.lock.msrv

Lines changed: 1057 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.evergreen/check-clippy.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

33
set -o errexit
44

55
. ~/.cargo/env
6-
cargo clippy --all-targets --all-features -p bson -- -D warnings
76

8-
cd serde-tests && cargo clippy --all-targets --all-features -p serde-tests -- -D warnings
7+
# Pin clippy to the latest version. This should be updated when new versions of Rust are released.
8+
CLIPPY_VERSION=1.65.0
9+
10+
rustup install $CLIPPY_VERSION
11+
12+
cargo +$CLIPPY_VERSION clippy --all-targets --all-features -p bson -- -D warnings
13+
14+
cd serde-tests
15+
cargo +$CLIPPY_VERSION clippy --all-targets --all-features -p serde-tests -- -D warnings

.evergreen/check-rustdoc.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

33
set -o errexit
44

55
. ~/.cargo/env
6-
cargo +nightly rustdoc -p bson --all-features -- --cfg docsrs -D warnings
6+
7+
cargo +nightly rustdoc -p bson --all-features -- --cfg docsrs -D warnings

.evergreen/check-rustfmt.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

33
set -o errexit
44

.evergreen/compile-only.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

33
set -o errexit
44

55
. ~/.cargo/env
66
rustup update $RUST_VERSION
77

8+
# pin all dependencies when checking msrv compilation
9+
if [ "$MSRV" = "true" ]; then
10+
cp .evergreen/Cargo.lock.msrv Cargo.lock
11+
fi
12+
813
rustup run $RUST_VERSION cargo build

.evergreen/config.yml

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ functions:
9090
working_dir: "src"
9191
script: |
9292
${PREPARE_SHELL}
93-
RUST_VERSION=${RUST_VERSION} .evergreen/compile-only.sh
93+
RUST_VERSION=${RUST_VERSION} MSRV=${MSRV} .evergreen/compile-only.sh
9494
9595
"check rustfmt":
9696
- command: shell.exec
@@ -112,6 +112,17 @@ functions:
112112
${PREPARE_SHELL}
113113
.evergreen/check-clippy.sh
114114
115+
"run fuzzer":
116+
- command: shell.exec
117+
type: test
118+
params:
119+
shell: bash
120+
working_dir: "src"
121+
script: |
122+
${PREPARE_SHELL}
123+
.evergreen/install-fuzzer.sh
124+
.evergreen/run-fuzzer.sh
125+
115126
"check rustdoc":
116127
- command: shell.exec
117128
type: test
@@ -122,6 +133,16 @@ functions:
122133
${PREPARE_SHELL}
123134
.evergreen/check-rustdoc.sh
124135
136+
"run wasm tests":
137+
- command: shell.exec
138+
type: test
139+
params:
140+
shell: bash
141+
working_dir: "src"
142+
script: |
143+
${PREPARE_SHELL}
144+
.evergreen/run-wasm-tests.sh
145+
125146
"init test-results":
126147
- command: shell.exec
127148
params:
@@ -162,13 +183,22 @@ tasks:
162183
commands:
163184
- func: "check rustdoc"
164185

186+
- name: "run-fuzzer"
187+
commands:
188+
- func: "run fuzzer"
189+
190+
- name: "wasm-test"
191+
commands:
192+
- func: "run wasm tests"
193+
165194
axes:
166195
- id: "extra-rust-versions"
167196
values:
168197
- id: "min"
169-
display_name: "1.48 (minimum supported version)"
198+
display_name: "1.56 (minimum supported version)"
170199
variables:
171-
RUST_VERSION: "1.48.0"
200+
RUST_VERSION: "1.56.0"
201+
MSRV: "true"
172202
- id: "nightly"
173203
display_name: "nightly"
174204
variables:
@@ -191,6 +221,7 @@ buildvariants:
191221
- ubuntu1804-test
192222
tasks:
193223
- name: "compile-only"
224+
194225
-
195226
name: "lint"
196227
display_name: "Lint"
@@ -200,3 +231,19 @@ buildvariants:
200231
- name: "check-clippy"
201232
- name: "check-rustfmt"
202233
- name: "check-rustdoc"
234+
235+
-
236+
name: "fuzz"
237+
display_name: "Raw BSON Fuzzer"
238+
run_on:
239+
- ubuntu1804-test
240+
tasks:
241+
- name: "run-fuzzer"
242+
243+
-
244+
name: "wasm"
245+
display_name: "WASM"
246+
run_on:
247+
- ubuntu1804-test
248+
tasks:
249+
- name: "wasm-test"

.evergreen/install-dependencies.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

33
rm -rf ~/.rustup
44
curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path

.evergreen/install-fuzzer.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
5+
. ~/.cargo/env
6+
7+
cargo install cargo-fuzz

.evergreen/run-fuzzer.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
5+
. ~/.cargo/env
6+
7+
cd fuzz
8+
9+
# each runs for a minute
10+
cargo +nightly fuzz run deserialize -- -rss_limit_mb=4096 -max_total_time=60
11+
cargo +nightly fuzz run raw_deserialize -- -rss_limit_mb=4096 -max_total_time=60
12+
cargo +nightly fuzz run iterate -- -rss_limit_mb=4096 -max_total_time=60

.evergreen/run-tests.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

33
set -o errexit
44

55
. ~/.cargo/env
6+
67
RUST_BACKTRACE=1 cargo test
7-
RUST_BACKTRACE=1 cargo test --features chrono-0_4,uuid-0_8
8+
RUST_BACKTRACE=1 cargo test --all-features
89

910
cd serde-tests
1011
RUST_BACKTRACE=1 cargo test

.evergreen/run-wasm-tests.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
5+
. ~/.cargo/env
6+
7+
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
8+
9+
cd $(dirname $0)/../wasm-test
10+
wasm-pack test --node

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
<!--
11+
Make sure you have read CONTRIBUTING.md completely before you file a new
12+
issue!
13+
-->
14+
15+
## Versions/Environment
16+
1. What version of Rust are you using?
17+
2. What operating system are you using?
18+
3. What versions of the driver and its dependencies are you using? (Run
19+
`cargo pkgid mongodb` & `cargo pkgid bson`)
20+
4. What version of MongoDB are you using? (Check with the MongoDB shell using `db.version()`)
21+
5. What is your MongoDB topology (standalone, replica set, sharded cluster, serverless)?
22+
23+
24+
25+
## Describe the bug
26+
A clear and concise description of what the bug is.
27+
28+
**BE SPECIFIC**:
29+
* What is the _expected_ behavior and what is _actually_ happening?
30+
* Do you have any particular output that demonstrates this problem?
31+
* Do you have any ideas on _why_ this may be happening that could give us a
32+
clue in the right direction?
33+
* Did this issue arise out of nowhere, or after an update (of the driver,
34+
server, and/or Rust)?
35+
* Are there multiple ways of triggering this bug (perhaps more than one
36+
function produce a crash)?
37+
* If you know how to reproduce this bug, please include a code snippet here:
38+
```
39+
40+
```
41+
42+
43+
**To Reproduce**
44+
Steps to reproduce the behavior:
45+
1. First, do this.
46+
2. Then do this.
47+
3. After doing that, do this.
48+
4. And then, finally, do this.
49+
5. Bug occurs.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
3+
name: 'Close stale issues'
4+
on:
5+
schedule:
6+
- cron: '30 1 * * *'
7+
permissions:
8+
issues: write
9+
jobs:
10+
stale:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/stale@v4
14+
with:
15+
stale-issue-message: 'There has not been any recent activity on this ticket, so we are marking it as stale. If we do not hear anything further from you, this issue will be automatically closed in one week.'
16+
days-before-issue-stale: 7
17+
days-before-pr-stale: -1
18+
days-before-close: 7
19+
close-issue-message: 'There has not been any recent activity on this ticket, so we are closing it. Thanks for reaching out and please feel free to file a new issue if you have further questions.'
20+
only-issue-labels: 'waiting-for-reporter'
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
3+
name: Issue assignment
4+
on:
5+
issues:
6+
types: [opened]
7+
jobs:
8+
auto-assign:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: 'Auto-assign issue'
12+
uses: pozil/[email protected]
13+
with:
14+
assignees: patrickfreed,abr-egn,isabelatkinson,kmahar
15+
numOfAssignee: 1
16+
add-labels:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: initial labeling
20+
uses: andymckay/labeler@master
21+
with:
22+
add-labels: "triage"

.github/workflows/remove_labels.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
3+
name: Remove Labels
4+
on:
5+
issue_comment:
6+
types: [created, edited]
7+
jobs:
8+
remove-labels:
9+
if: ${{ github.actor != 'Tom Selander' && github.actor != 'patrickfreed'
10+
&& github.actor != 'abr-egn' && github.actor != 'isabelatkinson'}}
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: initial labeling
14+
uses: andymckay/labeler@master
15+
with:
16+
remove-labels: "waiting-for-reporter, Stale"

Cargo.toml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
[package]
22
name = "bson"
3-
version = "2.0.0"
3+
version = "2.6.0"
44
authors = [
55
"Y. T. Chung <[email protected]>",
66
"Kevin Yeh <[email protected]>",
77
"Saghm Rossi <[email protected]>",
88
"Patrick Freed <[email protected]>",
99
"Isabel Atkinson <[email protected]>",
10+
"Abraham Egnor <[email protected]>",
1011
]
1112
description = "Encoding and decoding support for BSON in Rust"
1213
license = "MIT"
@@ -33,9 +34,15 @@ exclude = [
3334
[features]
3435
default = []
3536
# if enabled, include API for interfacing with chrono 0.4
36-
chrono-0_4 = []
37+
chrono-0_4 = ["chrono"]
3738
# if enabled, include API for interfacing with uuid 0.8
38-
uuid-0_8 = []
39+
# This is commented out because Cargo implicitly adds this feature since
40+
# uuid-0_8 is also an optional dependency.
41+
# uuid-0_8 = []
42+
# if enabled, include API for interfacing with uuid 1.x
43+
uuid-1 = []
44+
# if enabled, include API for interfacing with time 0.3
45+
time-0_3 = []
3946
# if enabled, include serde_with interop.
4047
# should be used in conjunction with chrono-0_4 or uuid-0_8.
4148
# it's commented out here because Cargo implicitly adds a feature flag for
@@ -47,17 +54,23 @@ name = "bson"
4754

4855
[dependencies]
4956
ahash = "0.7.2"
50-
chrono = { version = "0.4.15", features = ["std"], default-features = false }
57+
chrono = { version = "0.4.15", features = ["std"], default-features = false, optional = true }
5158
rand = "0.8"
5259
serde = { version = "1.0", features = ["derive"] }
5360
serde_json = { version = "1.0", features = ["preserve_order"] }
5461
indexmap = "1.6.2"
5562
hex = "0.4.2"
5663
base64 = "0.13.0"
5764
lazy_static = "1.4.0"
58-
uuid = { version = "0.8.1", features = ["serde", "v4"] }
65+
uuid-0_8 = { package = "uuid", version = "0.8.1", features = ["serde", "v4"], optional = true }
66+
uuid = { version = "1.1.2", features = ["serde", "v4"] }
5967
serde_bytes = "0.11.5"
6068
serde_with = { version = "1", optional = true }
69+
time = { version = "0.3.9", features = ["formatting", "parsing", "macros", "large-dates"] }
70+
bitvec = "1.0.1"
71+
72+
[target.'cfg(target_arch = "wasm32")'.dependencies]
73+
js-sys = "0.3"
6174

6275
[dev-dependencies]
6376
assert_matches = "1.2"
@@ -69,4 +82,4 @@ chrono = { version = "0.4", features = ["serde", "clock", "std"], default-featur
6982

7083
[package.metadata.docs.rs]
7184
all-features = true
72-
rustdoc-args = ["--cfg", "docsrs"]
85+
rustdoc-args = ["--cfg", "docsrs"]

0 commit comments

Comments
 (0)