add missing packages to pnpm workspace #77
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: | |
| ci_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: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| cache-dependency-path: renamify-core/pnpm-lock.yaml | |
| - name: Install renamify-core dependencies | |
| run: | | |
| cd renamify-core | |
| pnpm install | |
| - name: Cache dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Check formatting | |
| if: runner.os != 'Windows' | |
| run: cargo fmt --all -- --check | |
| - name: Check whitespace | |
| if: runner.os != 'Windows' | |
| run: ./scripts/check-whitespace.sh | |
| - name: Run clippy | |
| if: runner.os != 'Windows' | |
| run: cargo clippy --all-targets --all-features | |
| - name: Run tests | |
| run: cargo test --verbose | |
| - name: Build release binary | |
| run: cargo build --release --verbose | |
| - name: Upload release binary (Linux) | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: renamify-linux-x64 | |
| path: target/release/renamify | |
| - name: Upload release binary (macOS) | |
| if: runner.os == 'macOS' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: renamify-macos-x64 | |
| path: target/release/renamify | |
| - name: Upload release binary (Windows) | |
| if: runner.os == 'Windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: renamify-windows-x64 | |
| path: target/release/renamify.exe | |
| ci_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 --workspace --lcov --output-path lcov.info | |
| - name: Check coverage threshold | |
| run: | | |
| COVERAGE_THRESHOLD=85 | |
| # Run coverage and capture output | |
| COVERAGE_OUTPUT=$(cargo llvm-cov --workspace 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 --workspace --html | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: coverage-report | |
| path: target/llvm-cov/html/ | |
| ci_msrv: | |
| name: Check MSRV | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust 1.80.1 | |
| uses: dtolnay/rust-toolchain@1.80.1 | |
| - name: Cache dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Check MSRV | |
| run: | | |
| # Downgrade half package for MSRV compatibility | |
| cargo update half@2.6.0 --precise 2.4.1 || true | |
| cargo check --all-targets |