Skip to content

Commit

Permalink
prepare crates.io publish
Browse files Browse the repository at this point in the history
  • Loading branch information
rainliu committed Dec 25, 2020
1 parent 8a25651 commit 8c65ba5
Show file tree
Hide file tree
Showing 8 changed files with 212 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .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 \\{"
47 changes: 47 additions & 0 deletions .github/workflows/cargo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Cargo

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

env:
CARGO_TERM_COLOR: always

jobs:
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose

rustfmt_and_clippy:
name: Check rustfmt style && run clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.46.0
profile: minimal
components: clippy, rustfmt
override: true
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
- name: Check formating
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
85 changes: 85 additions & 0 deletions .github/workflows/grcov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Coverage

on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 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
Expand Down
14 changes: 14 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "webrtc-rs-media"
version = "0.0.1"
authors = ["Rain Liu <[email protected]>"]
edition = "2018"
description = "A pure Rust implementation of WebRTC Media API"
license = "MIT"
documentation = "https://docs.rs/webrtc-rs-media"
homepage = "https://webrtc.rs"
repository = "https://github.com/webrtc-rs/media"

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

[dependencies]
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
# media
WebRTC Media
<h1 align="center">
<a href="https://webrtc.rs"><img src="https://github.com/webrtc-rs/webrtc/doc/webrtc.rs.png" alt="WebRTC.rs"></a>
<br>
</h1>
<p align="center">
<a href="https://github.com/webrtc-rs/media/actions">
<img src="https://github.com/webrtc-rs/media/workflows/Cargo/badge.svg">
</a>
<a href="https://codecov.io/gh/webrtc-rs/media">
<img src="https://codecov.io/gh/webrtc-rs/media/branch/main/graph/badge.svg">
</a>
<a href="https://deps.rs/repo/github/webrtc-rs/media">
<img src="https://deps.rs/repo/github/webrtc-rs/media/status.svg">
</a>
<a href="https://github.com/webrtc-rs/media/blob/master/LICENSE">
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT">
</a>
</p>
<p align="center">
A pure Rust implementation of WebRTC Media API.
</p>
22 changes: 22 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
codecov:
require_ci_to_pass: yes
max_report_age: off

coverage:
precision: 2
round: down
range: 50..90
status:
project:
default:
enabled: no
threshold: 0.2
if_not_found: success
patch:
default:
enabled: no
if_not_found: success
changes:
default:
enabled: no
if_not_found: success
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}

0 comments on commit 8c65ba5

Please sign in to comment.