From fcd99c4cb6867c7502720bd81d9944af421fb046 Mon Sep 17 00:00:00 2001 From: Shuhui Luo <107524008+shuhuiluo@users.noreply.github.com> Date: Sat, 11 Jan 2025 14:57:25 -0500 Subject: [PATCH] Refactor CI workflows into a consolidated Rust CI pipeline. Merged linting and testing workflows into a unified `rust.yml` file for better organization and efficiency. Updated README with a single badge reflecting the new "Rust CI" workflow. Introduced enhanced test configurations, including feature-specific and doctest runs. --- .github/workflows/lint.yml | 37 ------------------------------ .github/workflows/rust.yml | 46 +++++++++++++++++++++++++++++--------- README.md | 3 +-- 3 files changed, 37 insertions(+), 49 deletions(-) delete mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 1ba55a2..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Rust Linting - -on: - push: - branches: - - master - pull_request: - -env: - CARGO_TERM_COLOR: always - -jobs: - lint: - name: Rust Lint Check - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Cache Cargo registry - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-registry- - - - name: Check lint - run: cargo +nightly clippy -- -D warnings - - - name: Check formatting - run: cargo +nightly fmt -- --check diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d81c09f..1170b6e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,4 +1,4 @@ -name: Rust Tests +name: Rust CI on: push: @@ -10,15 +10,14 @@ env: CARGO_TERM_COLOR: always jobs: - build: - name: Rust Tests + lint: + name: Rust Lint Check runs-on: ubuntu-latest timeout-minutes: 30 steps: - uses: actions/checkout@v4 with: submodules: recursive - - name: Cache Cargo registry uses: actions/cache@v4 with: @@ -26,15 +25,42 @@ jobs: ~/.cargo/registry ~/.cargo/git target - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }} restore-keys: | ${{ runner.os }}-cargo-registry- + - name: Install Rust toolchain via rustup + run: | + rustup component add clippy + rustup component add rustfmt + - name: Check linting + run: cargo clippy --all-targets --all-features -- -D warnings + - name: Check formatting + run: cargo fmt --all -- --check + test: + needs: lint + name: Rust Tests + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Cache Cargo registry + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- - name: Build run: cargo build - - - name: Run tests + - name: Run tests for default feature run: cargo test - - - name: Run tests with all features - run: cargo test --all-features + - name: Run tests for std feature + run: cargo test --features std + - name: Run doc tests + run: cargo test --doc --all-features diff --git a/README.md b/README.md index 5e395ee..fc39036 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Uniswap SDK Core Rust -[![Unit Tests](https://github.com/malik672/uniswap-sdk-core-rust/workflows/Rust%20Tests/badge.svg)](https://github.com/malik672/uniswap-sdk-core-rust/actions?query=workflow%3A%22Rust+Tests%22) -[![Lint](https://github.com/malik672/uniswap-sdk-core-rust/workflows/Rust%20Linting/badge.svg)](https://github.com/malik672/uniswap-sdk-core-rust/actions?query=workflow%3A%22Rust%20Linting%22) +[![Rust CI](https://github.com/malik672/uniswap-sdk-core-rust/actions/workflows/rust.yml/badge.svg)](https://github.com/malik672/uniswap-sdk-core-rust/actions/workflows/rust.yml) ![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/malik672/uniswap-sdk-core-rust?logo=rust&label=CodeRabbit&color=orange) [![docs.rs](https://img.shields.io/docsrs/uniswap-sdk-core)](https://docs.rs/uniswap-sdk-core/latest) [![crates.io](https://img.shields.io/crates/v/uniswap-sdk-core.svg)](https://crates.io/crates/uniswap-sdk-core)