Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: added release-plz and update deps #39

Merged
merged 8 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# rust-clippy is a tool that runs a bunch of lints to catch common
# mistakes in your Rust code and help improve your Rust code.
# More details at https://github.com/rust-lang/rust-clippy
# and https://rust-lang.github.io/rust-clippy/

name: rust-clippy analyze

on:
push:
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
schedule:
- cron: "29 19 * * 2"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
rust-clippy-analyze:
name: Run rust-clippy analyzing
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
steps:
- name: Checkout code
uses: actions/checkout@v4

- uses: actions/cache@v3
id: cache-cargo
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "25.1"
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run rust-clippy
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Install required cargo
run: cargo install clippy-sarif sarif-fmt

- name: Run rust-sarif
run: cargo clippy --all-features --message-format=json |
clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt

- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: rust-clippy-results.sarif
wait-for-processing: true
27 changes: 27 additions & 0 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release-plz

permissions:
pull-requests: write
contents: write

on:
push:
branches:
- main

jobs:
release-plz:
name: Release-plz
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: MarcoIeni/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
39 changes: 39 additions & 0 deletions .github/workflows/rust-fmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: rust-fmt analyze

on:
push:
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
schedule:
- cron: "29 19 * * 2"

concurrency:
# One build per PR, branch or tag
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
rust-fmt-analyze:
name: Run rust-fmt analyzing
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: cargo fmt
run: cargo fmt --all -- --check
84 changes: 73 additions & 11 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,85 @@ name: Rust

on:
push:
branches: [ "main" ]
branches: ["main"]
paths-ignore:
- "docs/**"

pull_request:
branches: [ "main" ]
branches: ["main"]
paths-ignore:
- "docs/**"

env:
CARGO_TERM_COLOR: always

jobs:
build:

code-coverage:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- name: Install deps
run: |
sudo apt-get update
sudo apt install -y libsoxr-dev libopus-dev libssl-dev libfdk-aac-dev

- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "25.1"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Running cargo test
run: cargo test --all-features --workspace
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: lcov.info
fail_ci_if_error: false
cargo-deny:
name: cargo-deny

# TODO: remove this matrix when https://github.com/EmbarkStudios/cargo-deny/issues/324 is resolved
strategy:
fail-fast: false
matrix:
platform:
- x86_64-unknown-linux-gnu
# - x86_64-unknown-linux-musl
- aarch64-unknown-linux-gnu
# - arm-unknown-linux-gnueabihf
# - armv7-unknown-linux-gnueabihf
# - mips-unknown-linux-gnu
# - mips64-unknown-linux-gnuabi64
# - mips64el-unknown-linux-gnuabi64
# - mipsel-unknown-linux-gnu
# - aarch64-unknown-linux-musl
- x86_64-apple-darwin
- aarch64-apple-darwin
# - x86_64-pc-windows-gnu
# - x86_64-pc-windows-msvc

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dev-tools
run: sudo apt-get install -y --no-install-recommends build-essential pkg-config libssl-dev
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check
log-level: error
arguments: --all-features --target ${{ matrix.platform }}
20 changes: 20 additions & 0 deletions .github/workflows/typos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Typos

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

env:
CARGO_TERM_COLOR: always

jobs:
typos:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- name: Check spelling issues
uses: crate-ci/typos@master
32 changes: 32 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,35 @@ resolver = "2"
members = [
"crates/*",
]

[workspace.dependencies]
log = "0.4"
yamux = "0.13"
futures = "0.3"
clap = "4.4"
async-trait = "0.1"
async-std = "1.12"
httparse = "1.8"
tls-parser = "0.11"
rtsp-types = "0.1"
tracing-subscriber = "0.3"
atm0s-sdn = "0.2"
serde = "1.0"
bincode = "1.3"
metrics-dashboard = "0.2"
poem = "2.0"
metrics = "0.22"
quinn = "0.11"
rustls = "0.23"
ed25519-dalek = "2.1"
rand = "0.8"
rcgen = "0.13"
url = "2.5"
base64 = "0.22"
local-ip-address = "0.6"

[profile.release]
strip = true # Automatically strip symbols from the binary.
opt-level = "z" # Optimize for size.
lto = true
codegen-units = 1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ If you find it interesting or believe it could be helpful, we welcome your contr

## Performance

Bellow is benchmarking results with Mac M1, and all nodes is running localy, it it very early version so it can be improve after finish all features:
Bellow is benchmarking results with Mac M1, and all nodes is running locally, it it very early version so it can be improve after finish all features:

- Direct http

Expand Down
3 changes: 3 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[default.extend-words]
# Don't correct the app name "wrk"
wrk = "wrk"
34 changes: 15 additions & 19 deletions crates/agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,27 @@
name = "atm0s-reverse-proxy-agent"
version = "0.1.0"
edition = "2021"
description = "Agent for reverse proxy cluster"
license = "MIT"

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

[dependencies]
async-std = { version = "1.12.0", features = ["default", "attributes", "unstable"] }
async-trait = "0.1.74"
clap = { version = "4.4.11", features = ["derive", "env"] }
futures = "0.3.4"
log = "0.4.20"
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "std"], optional = true }
yamux = "0.13.1"
bincode = "1.3.3"
serde = { version = "1.0.193", features = ["derive"] }
async-std = { workspace = true, features = ["default", "attributes", "unstable"] }
async-trait = { workspace = true }
clap = { workspace = true, features = ["derive", "env"] }
futures = { workspace = true }
log = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter", "std"], optional = true }
yamux = { workspace = true }
bincode = { workspace = true }
serde = { workspace = true, features = ["derive"] }
protocol = { path = "../protocol", package = "atm0s-reverse-proxy-protocol" }
protocol-ed25519 = { path = "../protocol_ed25519", package = "atm0s-reverse-proxy-protocol-ed25519", optional = true }
quinn = { version = "0.11", features = ["ring", "runtime-async-std", "futures-io"] }
rustls = { version = "0.23", features = ["ring", "std"] }
url = "2.5.0"
base64 = "0.22.1"

[profile.release]
strip = true # Automatically strip symbols from the binary.
opt-level = "z" # Optimize for size.
lto = true
codegen-units = 1
quinn = { workspace = true, features = ["ring", "runtime-async-std", "futures-io"] }
rustls = { workspace = true, features = ["ring", "std"] }
url = { workspace = true }
base64 = { workspace = true }

[features]
default = ["binary"]
Expand Down
2 changes: 1 addition & 1 deletion crates/agent/src/connection/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ where
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let this = self.get_mut();
match this.connection.poll_new_outbound(cx) {
Poll::Ready(stream) => return Poll::Ready(stream),
Poll::Ready(stream) => Poll::Ready(stream),
Poll::Pending => Poll::Pending,
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/agent/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async fn main() {
let server_certs = if let Some(cert) = args.custom_quic_cert_base64 {
vec![CertificateDer::from(
URL_SAFE
.decode(&cert)
.decode(cert)
.expect("Custom cert should in base64 format")
.to_vec(),
)]
Expand Down
10 changes: 6 additions & 4 deletions crates/cert_utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
[package]
name = "cert_utils"
name = "atm0s-reverse-proxy-cert-utils"
version = "0.1.0"
edition = "2021"
description = "Cert utils for atm0s-reverse proxy cluster"
license = "MIT"

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

[dependencies]
rcgen = "0.13.1"
rustls = "0.23.8"
clap = { version = "4.4.11", features = ["derive", "env"] }
rcgen = { workspace = true }
rustls = { workspace = true }
clap = { workspace = true, features = ["derive", "env"] }
Loading
Loading