update #7
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: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.rust }} | |
components: rustfmt, clippy | |
- name: Cache cargo registry | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Check formatting | |
run: cargo fmt --all -- --check | |
- name: Run clippy | |
run: cargo clippy --all-targets --all-features -- -D warnings | |
- name: Run tests | |
run: cargo test --verbose --all-features | |
- name: Run doc tests | |
run: cargo test --doc | |
coverage: | |
name: Code Coverage | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install tarpaulin | |
run: cargo install cargo-tarpaulin | |
- name: Generate code coverage | |
run: cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out xml | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: false | |
security: | |
name: Security Audit | |
runs-on: ubuntu-latest | |
steps: | |
- 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 | |
performance: | |
name: Performance Tests | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache cargo registry | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Run benchmarks | |
run: cargo bench --verbose | |
- name: Store benchmark results | |
uses: benchmark-action/github-action-benchmark@v1 | |
if: github.ref == 'refs/heads/main' | |
with: | |
name: Rust Benchmark | |
tool: 'cargo' | |
output-file-path: target/criterion/reports/index.html | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
auto-push: true | |
documentation: | |
name: Documentation | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Generate documentation | |
run: cargo doc --no-deps --all-features | |
- name: Deploy to GitHub Pages | |
if: github.ref == 'refs/heads/main' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: target/doc | |
destination_dir: docs | |
dependency-check: | |
name: Dependency Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install cargo-machete | |
run: cargo install cargo-machete | |
- name: Check for unused dependencies | |
run: cargo machete | |
integration-tests: | |
name: Integration Tests | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Run integration tests | |
run: cargo test --test '*' --verbose | |
- name: Test interactive tools | |
run: | | |
# Test that binaries compile | |
cargo build --bin problem-selector | |
cargo build --bin progress-tracker | |
cargo build --bin interview-simulator | |
echo "All interactive tools compiled successfully" | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: [test, coverage, security, performance] | |
if: github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[release]') | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Get version | |
id: get_version | |
run: | | |
VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version') | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Create release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.get_version.outputs.version }} | |
release_name: Release v${{ steps.get_version.outputs.version }} | |
body: | | |
## What's Changed | |
This release includes: | |
- LeetCode problem implementations and optimizations | |
- Performance improvements and bug fixes | |
- Enhanced documentation and analysis tools | |
## Statistics | |
- **Total Problems**: 105 unique implementations | |
- **Test Coverage**: 100% (1,430+ passing tests) | |
- **Solution Approaches**: 280+ different implementations | |
- **Interactive Tools**: Problem selector, progress tracker, interview simulator | |
## Interactive Tools | |
```bash | |
# Explore problems interactively | |
cargo run --bin problem-selector | |
# Track your progress | |
cargo run --bin progress-tracker | |
# Practice interviews | |
cargo run --bin interview-simulator | |
``` | |
Full changelog: https://github.com/${{ github.repository }}/compare/v${{ steps.get_version.outputs.version }} | |
draft: false | |
prerelease: false |