Update README.md #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 🦀 CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| test: | |
| name: 🧪 Test Suite | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| rust: | |
| - stable | |
| - beta | |
| - nightly | |
| steps: | |
| - name: 📥 Checkout code | |
| uses: actions/checkout@v4 | |
| - name: 🦀 Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| components: rustfmt, clippy | |
| - name: 📦 Cache dependencies | |
| 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: 🔍 Check formatting | |
| run: cargo fmt --all -- --check | |
| - name: 📋 Lint with Clippy | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| - name: 🏗️ Build | |
| run: cargo build --verbose | |
| - name: 🧪 Run tests | |
| run: cargo test --verbose | |
| - name: 📊 Run doctests | |
| run: cargo test --doc | |
| coverage: | |
| name: 📊 Code Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 📥 Checkout code | |
| uses: actions/checkout@v4 | |
| - name: 🦀 Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: llvm-tools-preview | |
| - name: 📦 Install cargo-llvm-cov | |
| uses: taiki-e/install-action@cargo-llvm-cov | |
| - 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@v3 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: lcov.info | |
| fail_ci_if_error: true | |
| security: | |
| name: 🔒 Security Audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 📥 Checkout code | |
| uses: actions/checkout@v4 | |
| - name: 🦀 Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: 📦 Install cargo-audit | |
| run: cargo install cargo-audit | |
| - name: 🔍 Run security audit | |
| run: cargo audit | |
| benchmark: | |
| name: ⚡ Performance Benchmarks | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - name: 📥 Checkout code | |
| uses: actions/checkout@v4 | |
| - name: 🦀 Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: 📦 Cache dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-bench-${{ hashFiles('**/Cargo.lock') }} | |
| - name: ⚡ Run benchmarks | |
| run: cargo bench | |
| release: | |
| name: 🚀 Create Release | |
| runs-on: ubuntu-latest | |
| needs: [test, coverage, security] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[release]') | |
| steps: | |
| - name: 📥 Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: 🦀 Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: 🏗️ Build release | |
| run: cargo build --release | |
| - name: 📦 Create release artifacts | |
| run: | | |
| mkdir -p artifacts | |
| cp target/release/rust-route artifacts/ | |
| cp README.md USER_MANUAL.md LICENSE artifacts/ | |
| tar -czf artifacts/rust-route-linux-x64.tar.gz -C artifacts . | |
| - name: 🏷️ Create release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ github.run_number }} | |
| name: Release v${{ github.run_number }} | |
| draft: false | |
| prerelease: false | |
| files: artifacts/rust-route-linux-x64.tar.gz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |