sweep-cli 0.1.0

Fast system cleaner for macOS — clean caches, uninstall apps, optimize system. Single binary, no dependencies.
name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

env:
  CARGO_TERM_COLOR: always
  FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
  build:
    strategy:
      matrix:
        include:
          - os: macos-latest
            target: aarch64-apple-darwin
          - os: macos-13
            target: x86_64-apple-darwin
    runs-on: ${{ matrix.os }}

    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Cache cargo
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}

      - name: Build
        run: cargo build --release --target ${{ matrix.target }}

      - name: Run tests
        run: cargo test --target ${{ matrix.target }}

      - name: Check formatting
        run: cargo fmt --check

      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: sweep-${{ matrix.target }}
          path: target/${{ matrix.target }}/release/sweep

  release:
    needs: build
    if: startsWith(github.ref, 'refs/tags/v')
    runs-on: macos-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v4

      - name: Download arm64 artifact
        uses: actions/download-artifact@v4
        with:
          name: sweep-aarch64-apple-darwin
          path: artifacts/arm64

      - name: Download x86_64 artifact
        uses: actions/download-artifact@v4
        with:
          name: sweep-x86_64-apple-darwin
          path: artifacts/x86_64

      - name: Prepare release binaries
        run: |
          chmod +x artifacts/arm64/sweep artifacts/x86_64/sweep
          mv artifacts/arm64/sweep sweep-macos-arm64
          mv artifacts/x86_64/sweep sweep-macos-x86_64

      - name: Create Release
        uses: softprops/action-gh-release@v2
        with:
          files: |
            sweep-macos-arm64
            sweep-macos-x86_64
          generate_release_notes: true