added case study about renaming refaktor to renamify #28
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 | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| test: | |
| name: Test on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - macos-latest | |
| # - windows-latest | |
| rust: [stable] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| components: rustfmt, clippy | |
| - name: Cache dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| - name: Run clippy | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| - name: Build | |
| run: cargo build --verbose | |
| - name: Run tests | |
| run: cargo test --verbose | |
| 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: Cache dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install cargo-llvm-cov | |
| run: | | |
| # Install compatible version for Rust 1.80.1 | |
| cargo install cargo-llvm-cov --version 0.6.15 | |
| - name: Generate code coverage | |
| run: cargo llvm-cov --package renamify-core --lcov --output-path lcov.info | |
| - name: Check coverage threshold | |
| run: | | |
| COVERAGE_THRESHOLD=85 | |
| # Run coverage and capture output | |
| COVERAGE_OUTPUT=$(cargo llvm-cov --package renamify-core 2>&1) | |
| echo "$COVERAGE_OUTPUT" | |
| # Extract coverage percentage from the TOTAL line | |
| COVERAGE=$(echo "$COVERAGE_OUTPUT" | grep "^TOTAL" | awk '{print $10}' | sed 's/%//') | |
| echo "Coverage: ${COVERAGE}%" | |
| # Check if coverage meets the threshold | |
| if (( $(echo "${COVERAGE} < ${COVERAGE_THRESHOLD}.00" | bc -l) )); then | |
| echo "Coverage is below ${COVERAGE_THRESHOLD}% threshold: ${COVERAGE}%" | |
| exit 1 | |
| fi | |
| echo "Coverage meets ${COVERAGE_THRESHOLD}% threshold: ${COVERAGE}%" | |
| - name: Generate HTML report | |
| run: cargo llvm-cov --package renamify-core --html | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: coverage-report | |
| path: target/llvm-cov/html/ | |
| check-msrv: | |
| name: Check MSRV | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust 1.80.1 | |
| uses: dtolnay/[email protected] | |
| - name: Cache dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Check MSRV | |
| run: | | |
| # Downgrade half package for MSRV compatibility | |
| cargo update [email protected] --precise 2.4.1 || true | |
| cargo check --all-targets |