Skip to content

Commit

Permalink
Merge branch 'main' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
djkoloski authored May 8, 2023
2 parents 6f5f155 + 70b49c5 commit c218075
Show file tree
Hide file tree
Showing 70 changed files with 6,957 additions and 1,655 deletions.
1,057 changes: 1,057 additions & 0 deletions .evergreen/Cargo.lock.msrv

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions .evergreen/check-clippy.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#!/bin/sh
#!/bin/bash

set -o errexit

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

cd serde-tests && cargo clippy --all-targets --all-features -p serde-tests -- -D warnings
# Pin clippy to the latest version. This should be updated when new versions of Rust are released.
CLIPPY_VERSION=1.65.0

rustup install $CLIPPY_VERSION

cargo +$CLIPPY_VERSION clippy --all-targets --all-features -p bson -- -D warnings

cd serde-tests
cargo +$CLIPPY_VERSION clippy --all-targets --all-features -p serde-tests -- -D warnings
5 changes: 3 additions & 2 deletions .evergreen/check-rustdoc.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh
#!/bin/bash

set -o errexit

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

cargo +nightly rustdoc -p bson --all-features -- --cfg docsrs -D warnings
2 changes: 1 addition & 1 deletion .evergreen/check-rustfmt.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

set -o errexit

Expand Down
7 changes: 6 additions & 1 deletion .evergreen/compile-only.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#!/bin/sh
#!/bin/bash

set -o errexit

. ~/.cargo/env
rustup update $RUST_VERSION

# pin all dependencies when checking msrv compilation
if [ "$MSRV" = "true" ]; then
cp .evergreen/Cargo.lock.msrv Cargo.lock
fi

rustup run $RUST_VERSION cargo build
53 changes: 50 additions & 3 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ functions:
working_dir: "src"
script: |
${PREPARE_SHELL}
RUST_VERSION=${RUST_VERSION} .evergreen/compile-only.sh
RUST_VERSION=${RUST_VERSION} MSRV=${MSRV} .evergreen/compile-only.sh
"check rustfmt":
- command: shell.exec
Expand All @@ -112,6 +112,17 @@ functions:
${PREPARE_SHELL}
.evergreen/check-clippy.sh
"run fuzzer":
- command: shell.exec
type: test
params:
shell: bash
working_dir: "src"
script: |
${PREPARE_SHELL}
.evergreen/install-fuzzer.sh
.evergreen/run-fuzzer.sh
"check rustdoc":
- command: shell.exec
type: test
Expand All @@ -122,6 +133,16 @@ functions:
${PREPARE_SHELL}
.evergreen/check-rustdoc.sh
"run wasm tests":
- command: shell.exec
type: test
params:
shell: bash
working_dir: "src"
script: |
${PREPARE_SHELL}
.evergreen/run-wasm-tests.sh
"init test-results":
- command: shell.exec
params:
Expand Down Expand Up @@ -162,13 +183,22 @@ tasks:
commands:
- func: "check rustdoc"

- name: "run-fuzzer"
commands:
- func: "run fuzzer"

- name: "wasm-test"
commands:
- func: "run wasm tests"

axes:
- id: "extra-rust-versions"
values:
- id: "min"
display_name: "1.48 (minimum supported version)"
display_name: "1.56 (minimum supported version)"
variables:
RUST_VERSION: "1.48.0"
RUST_VERSION: "1.56.0"
MSRV: "true"
- id: "nightly"
display_name: "nightly"
variables:
Expand All @@ -191,6 +221,7 @@ buildvariants:
- ubuntu1804-test
tasks:
- name: "compile-only"

-
name: "lint"
display_name: "Lint"
Expand All @@ -200,3 +231,19 @@ buildvariants:
- name: "check-clippy"
- name: "check-rustfmt"
- name: "check-rustdoc"

-
name: "fuzz"
display_name: "Raw BSON Fuzzer"
run_on:
- ubuntu1804-test
tasks:
- name: "run-fuzzer"

-
name: "wasm"
display_name: "WASM"
run_on:
- ubuntu1804-test
tasks:
- name: "wasm-test"
2 changes: 1 addition & 1 deletion .evergreen/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

rm -rf ~/.rustup
curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path
Expand Down
7 changes: 7 additions & 0 deletions .evergreen/install-fuzzer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -o errexit

. ~/.cargo/env

cargo install cargo-fuzz
12 changes: 12 additions & 0 deletions .evergreen/run-fuzzer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -o errexit

. ~/.cargo/env

cd fuzz

# each runs for a minute
cargo +nightly fuzz run deserialize -- -rss_limit_mb=4096 -max_total_time=60
cargo +nightly fuzz run raw_deserialize -- -rss_limit_mb=4096 -max_total_time=60
cargo +nightly fuzz run iterate -- -rss_limit_mb=4096 -max_total_time=60
5 changes: 3 additions & 2 deletions .evergreen/run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/sh
#!/bin/bash

set -o errexit

. ~/.cargo/env

RUST_BACKTRACE=1 cargo test
RUST_BACKTRACE=1 cargo test --features chrono-0_4,uuid-0_8
RUST_BACKTRACE=1 cargo test --all-features

cd serde-tests
RUST_BACKTRACE=1 cargo test
10 changes: 10 additions & 0 deletions .evergreen/run-wasm-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -o errexit

. ~/.cargo/env

curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

cd $(dirname $0)/../wasm-test
wasm-pack test --node
49 changes: 49 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

<!--
Make sure you have read CONTRIBUTING.md completely before you file a new
issue!
-->

## Versions/Environment
1. What version of Rust are you using?
2. What operating system are you using?
3. What versions of the driver and its dependencies are you using? (Run
`cargo pkgid mongodb` & `cargo pkgid bson`)
4. What version of MongoDB are you using? (Check with the MongoDB shell using `db.version()`)
5. What is your MongoDB topology (standalone, replica set, sharded cluster, serverless)?



## Describe the bug
A clear and concise description of what the bug is.

**BE SPECIFIC**:
* What is the _expected_ behavior and what is _actually_ happening?
* Do you have any particular output that demonstrates this problem?
* Do you have any ideas on _why_ this may be happening that could give us a
clue in the right direction?
* Did this issue arise out of nowhere, or after an update (of the driver,
server, and/or Rust)?
* Are there multiple ways of triggering this bug (perhaps more than one
function produce a crash)?
* If you know how to reproduce this bug, please include a code snippet here:
```
```


**To Reproduce**
Steps to reproduce the behavior:
1. First, do this.
2. Then do this.
3. After doing that, do this.
4. And then, finally, do this.
5. Bug occurs.
20 changes: 20 additions & 0 deletions .github/workflows/close_stale_issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---

name: 'Close stale issues'
on:
schedule:
- cron: '30 1 * * *'
permissions:
issues: write
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4
with:
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.'
days-before-issue-stale: 7
days-before-pr-stale: -1
days-before-close: 7
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.'
only-issue-labels: 'waiting-for-reporter'
22 changes: 22 additions & 0 deletions .github/workflows/issue_assignment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---

name: Issue assignment
on:
issues:
types: [opened]
jobs:
auto-assign:
runs-on: ubuntu-latest
steps:
- name: 'Auto-assign issue'
uses: pozil/[email protected]
with:
assignees: patrickfreed,abr-egn,isabelatkinson,kmahar
numOfAssignee: 1
add-labels:
runs-on: ubuntu-latest
steps:
- name: initial labeling
uses: andymckay/labeler@master
with:
add-labels: "triage"
16 changes: 16 additions & 0 deletions .github/workflows/remove_labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---

name: Remove Labels
on:
issue_comment:
types: [created, edited]
jobs:
remove-labels:
if: ${{ github.actor != 'Tom Selander' && github.actor != 'patrickfreed'
&& github.actor != 'abr-egn' && github.actor != 'isabelatkinson'}}
runs-on: ubuntu-latest
steps:
- name: initial labeling
uses: andymckay/labeler@master
with:
remove-labels: "waiting-for-reporter, Stale"
25 changes: 19 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[package]
name = "bson"
version = "2.0.0"
version = "2.6.0"
authors = [
"Y. T. Chung <[email protected]>",
"Kevin Yeh <[email protected]>",
"Saghm Rossi <[email protected]>",
"Patrick Freed <[email protected]>",
"Isabel Atkinson <[email protected]>",
"Abraham Egnor <[email protected]>",
]
description = "Encoding and decoding support for BSON in Rust"
license = "MIT"
Expand All @@ -33,9 +34,15 @@ exclude = [
[features]
default = []
# if enabled, include API for interfacing with chrono 0.4
chrono-0_4 = []
chrono-0_4 = ["chrono"]
# if enabled, include API for interfacing with uuid 0.8
uuid-0_8 = []
# This is commented out because Cargo implicitly adds this feature since
# uuid-0_8 is also an optional dependency.
# uuid-0_8 = []
# if enabled, include API for interfacing with uuid 1.x
uuid-1 = []
# if enabled, include API for interfacing with time 0.3
time-0_3 = []
# if enabled, include serde_with interop.
# should be used in conjunction with chrono-0_4 or uuid-0_8.
# it's commented out here because Cargo implicitly adds a feature flag for
Expand All @@ -47,17 +54,23 @@ name = "bson"

[dependencies]
ahash = "0.7.2"
chrono = { version = "0.4.15", features = ["std"], default-features = false }
chrono = { version = "0.4.15", features = ["std"], default-features = false, optional = true }
rand = "0.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
indexmap = "1.6.2"
hex = "0.4.2"
base64 = "0.13.0"
lazy_static = "1.4.0"
uuid = { version = "0.8.1", features = ["serde", "v4"] }
uuid-0_8 = { package = "uuid", version = "0.8.1", features = ["serde", "v4"], optional = true }
uuid = { version = "1.1.2", features = ["serde", "v4"] }
serde_bytes = "0.11.5"
serde_with = { version = "1", optional = true }
time = { version = "0.3.9", features = ["formatting", "parsing", "macros", "large-dates"] }
bitvec = "1.0.1"

[target.'cfg(target_arch = "wasm32")'.dependencies]
js-sys = "0.3"

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

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]
Loading

0 comments on commit c218075

Please sign in to comment.