diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..1b6e455 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +name: Build + +on: + push: + branches: [ "*" ] + pull_request: + branches: [ "*" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + permissions: + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install latest stable Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Cache cargo registry & build artifacts + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Build Release + run: cargo build --release --verbose \ No newline at end of file diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index b245679..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Rust - -on: - push: - branches: [ "*" ] - pull_request: - branches: [ "*" ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - name: Compile, Test, Lint - runs-on: ubuntu-latest - - permissions: - contents: read - actions: write - checks: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install latest stable Rust toolchain - uses: dtolnay/rust-toolchain@stable - with: - components: rustfmt, clippy - - - name: Cache cargo registry & build artifacts - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo- - - - name: Compile (no tests) - run: cargo check --workspace --all-features --lib --bins --verbose - - - name: Run tests (single pass) - run: cargo test --workspace --all-features --verbose - -# clippy dont fail on warnings because of active development of telemt -# and many warnings - - name: Run clippy - run: cargo clippy -- --cap-lints warn - - - name: Check for unused dependencies - run: cargo udeps || true diff --git a/.github/workflows/stress.yml b/.github/workflows/stress.yml deleted file mode 100644 index 96b9a1b..0000000 --- a/.github/workflows/stress.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Stress Tests - -on: - workflow_dispatch: - schedule: - - cron: '0 2 * * *' - pull_request: - branches: ["*"] - paths: - - src/proxy/** - - src/transport/** - - src/stream/** - - src/protocol/** - - src/tls_front/** - - Cargo.toml - - Cargo.lock - -env: - CARGO_TERM_COLOR: always - -jobs: - quota-lock-stress: - name: Quota-lock stress loop - runs-on: ubuntu-latest - - permissions: - contents: read - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install latest stable Rust toolchain - uses: dtolnay/rust-toolchain@stable - - - name: Cache cargo registry and build artifacts - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-cargo-stress-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-stress- - ${{ runner.os }}-cargo- - - - name: Run quota-lock stress suites - env: - RUST_TEST_THREADS: 16 - run: | - set -euo pipefail - for i in $(seq 1 12); do - echo "[quota-lock-stress] iteration ${i}/12" - cargo test quota_lock_ --bin telemt -- --nocapture --test-threads 16 - cargo test relay_quota_wake --bin telemt -- --nocapture --test-threads 16 - done diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d8f7a64 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,56 @@ +name: Test + +on: + push: + branches: [ "*" ] + pull_request: + branches: [ "*" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + test: + name: Test / Lint / Analysis + runs-on: ubuntu-latest + + permissions: + contents: read + actions: write + checks: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install latest stable Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + + - name: Cache cargo registry & build artifacts + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Run tests + run: cargo test --verbose + + # clippy не валит билд (осознанно) + - name: Run clippy + run: cargo clippy -- --cap-lints warn + + - name: Check formatting + run: cargo fmt -- --check + + - name: Install cargo-udeps + run: cargo install cargo-udeps || true + + - name: Check for unused dependencies + run: cargo udeps || true \ No newline at end of file