Skip to content

Commit

Permalink
Merge submodule contents for crates/util
Browse files Browse the repository at this point in the history
  • Loading branch information
algesten committed Aug 23, 2022
2 parents 3d27878 + 3d469d5 commit 0f44b7a
Show file tree
Hide file tree
Showing 58 changed files with 10,527 additions and 0 deletions.
15 changes: 15 additions & 0 deletions crates/util/.github/actions-rs/grcov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
branch: true
ignore-not-existing: true
llvm: true
filter: covered
output-type: lcov
output-path: ./lcov.info
source-dir: .
ignore:
- "/*"
- "C:/*"
- "../*"
excl-line: "#\\[derive\\("
excl-start: "mod tests \\{"
excl-br-line: "#\\[derive\\("
excl-br-start: "mod tests \\{"
85 changes: 85 additions & 0 deletions crates/util/.github/workflows/cargo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: cargo

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
CARGO_TERM_COLOR: always

jobs:
check_and_test:
name: Check and test
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
toolchain:
- 1.56.1 # min supported version (https://github.com/webrtc-rs/webrtc/#toolchain)
- stable
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
profile: minimal
override: true
- uses: actions-rs/cargo@v1
with:
command: check
- uses: actions-rs/cargo@v1
with:
command: test

rustfmt_and_clippy:
name: Check rustfmt style and run clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: clippy, rustfmt
override: true
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
- name: Check formating
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

minimal_versions:
name: Compile and test with minimal versions
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-minimal-versions
- run: cargo minimal-versions check --workspace --all-features --ignore-private -v
- run: cargo minimal-versions build --workspace --all-features --ignore-private -v
- run: cargo minimal-versions test --workspace --all-features -v
85 changes: 85 additions & 0 deletions crates/util/.github/workflows/grcov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: coverage

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
CARGO_TERM_COLOR: always

jobs:
grcov:
name: Coverage
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
toolchain:
- nightly
cargo_flags:
- "--all-features"
steps:
- name: Checkout source code
uses: actions/checkout@v2

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true

- name: Install grcov
uses: actions-rs/[email protected]
with:
crate: grcov
version: latest
use-tool-cache: true

- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --all --no-fail-fast ${{ matrix.cargo_flags }}
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort -Cdebug-assertions=off'
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort -Cdebug-assertions=off'

- name: Generate coverage data
id: grcov
# uses: actions-rs/[email protected]
run: |
grcov target/debug/ \
--branch \
--llvm \
--source-dir . \
--output-path lcov.info \
--ignore='/**' \
--ignore='C:/**' \
--ignore='../**' \
--ignore-not-existing \
--excl-line "#\\[derive\\(" \
--excl-br-line "#\\[derive\\(" \
--excl-start "#\\[cfg\\(test\\)\\]" \
--excl-br-start "#\\[cfg\\(test\\)\\]" \
--commit-sha ${{ github.sha }} \
--service-job-id ${{ github.job }} \
--service-name "GitHub Actions" \
--service-number ${{ github.run_id }}
- name: Upload coverage as artifact
uses: actions/upload-artifact@v2
with:
name: lcov.info
# path: ${{ steps.grcov.outputs.report }}
path: lcov.info

- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v1
with:
# file: ${{ steps.grcov.outputs.report }}
file: lcov.info
fail_ci_if_error: true
11 changes: 11 additions & 0 deletions crates/util/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Generated by Cargo
# will have compiled files and executables
/target/
/.idea/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk
59 changes: 59 additions & 0 deletions crates/util/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[package]
name = "webrtc-util"
version = "0.5.4"
authors = ["Rain Liu <[email protected]>"]
edition = "2018"
description = "Utilities for WebRTC.rs stack"
license = "MIT/Apache-2.0"
documentation = "https://docs.rs/webrtc-util"
homepage = "https://webrtc.rs"
repository = "https://github.com/webrtc-rs/util"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = ["buffer", "conn", "ifaces", "vnet", "marshal", "sync"]
buffer = []
conn = ["buffer"]
ifaces = []
vnet = ["ifaces"]
marshal = []
sync = []

[dependencies]
tokio = { version = "1.19", features = ["full"] }
lazy_static = "1.4"
async-trait = "0.1.56"
ipnet = "2.5"
log = "0.4"
rand = "0.8.5"
bytes = "1"
thiserror = "~1.0.2"
parking_lot = "0.12.1"

[target.'cfg(not(windows))'.dependencies]
nix = "0.24.1"
libc = "0.2.126"

[target.'cfg(windows)'.dependencies]
bitflags = "1.3"
winapi = { version = "0.3.9", features = [
"basetsd",
"guiddef",
"ws2def",
"winerror",
"ws2ipdef",
] }

[build-dependencies]
cc = "1.0.73"

[dev-dependencies]
tokio-test = "0.4.0" # must match the min version of the `tokio` crate above
env_logger = "0.9.0"
chrono = "0.4.19"
criterion = { version = "0.3.5", features = ["stable"]}

[[bench]]
name = "bench"
harness = false
Loading

0 comments on commit 0f44b7a

Please sign in to comment.