diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c51b4b26..d18ed5c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,7 +70,22 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-latest] + steps: + - uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Cache cargo + uses: Swatinem/rust-cache@v2 + + - name: Run tests + run: cargo test --all-features + + test-windows: + name: Test (windows-latest) + runs-on: windows-latest steps: - uses: actions/checkout@v4 @@ -83,10 +98,7 @@ jobs: - name: Run tests run: cargo test --all-features env: - # Windows: link advapi32 for libgit2-sys (needed for test crates that - # don't go through build.rs) and increase stack to 8 MB (debug builds - # overflow the default 1 MB Windows stack during clap parsing) - RUSTFLAGS: ${{ matrix.os == 'windows-latest' && '-C link-arg=advapi32.lib -C link-arg=/STACK:8388608' || '' }} + RUSTFLAGS: '-C link-arg=advapi32.lib -C link-arg=/STACK:8388608' build: name: Build Release @@ -149,14 +161,16 @@ jobs: - name: Run spawn integration tests run: GR=./target/debug/gr ./tests/spawn_graceful_shutdown.sh - # Summary job for branch protection - requires all other jobs to pass + # Summary job for branch protection - requires all jobs except Windows to pass. + # Windows tests run separately (test-windows) and are visible but non-blocking, + # since they are significantly slower and should not gate PR merges. ci: name: CI runs-on: ubuntu-latest needs: [check, fmt, clippy, test, build, bench, integration] if: always() steps: - - name: Check all jobs passed + - name: Check all required jobs passed run: | if [[ "${{ needs.check.result }}" != "success" ]] || \ [[ "${{ needs.fmt.result }}" != "success" ]] || \ @@ -165,7 +179,7 @@ jobs: [[ "${{ needs.build.result }}" != "success" ]] || \ [[ "${{ needs.bench.result }}" != "success" ]] || \ [[ "${{ needs.integration.result }}" != "success" ]]; then - echo "One or more jobs failed" + echo "One or more required jobs failed" exit 1 fi - echo "All jobs passed" + echo "All required jobs passed" diff --git a/Cargo.lock b/Cargo.lock index d273c8a9..7bba51b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -826,6 +826,8 @@ dependencies = [ "futures", "git2", "gix", + "glob", + "gr2-cli", "indicatif", "octocrab", "once_cell", @@ -1586,6 +1588,23 @@ dependencies = [ "gix-validate 0.9.4", ] +[[package]] +name = "glob" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + +[[package]] +name = "gr2-cli" +version = "0.1.0" +dependencies = [ + "anyhow", + "chrono", + "clap", + "serde", + "toml", +] + [[package]] name = "h2" version = "0.4.13" diff --git a/Cargo.toml b/Cargo.toml index 4d178366..09ec58f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,9 @@ readme = "README.md" keywords = ["git", "monorepo", "workflow", "multi-repo", "cli"] categories = ["development-tools", "command-line-utilities"] +[workspace] +members = ["gr2"] + [[bin]] name = "gr" path = "src/main.rs" @@ -21,6 +24,10 @@ path = "src/main.rs" name = "gitgrip" path = "src/main.rs" +[[bin]] +name = "gr2" +path = "src/bin/gr2.rs" + [lib] name = "gitgrip" path = "src/lib.rs" @@ -40,6 +47,7 @@ release-logs = ["tracing/release_max_level_info"] max-perf = ["tracing/max_level_off"] [dependencies] +gr2_cli = { package = "gr2-cli", path = "gr2" } # Async runtime tokio = { version = "1", features = ["rt-multi-thread", "macros", "process", "time", "net", "io-util", "sync"] } uuid = { version = "1", features = ["v4"] } @@ -85,6 +93,9 @@ quick-xml = { version = "0.37", features = ["serialize"] } # TOML parsing toml = "0.8" +# Glob patterns (for linkfile/copyfile glob expansion) +glob = "0.3" + # Misc once_cell = "1" regex = "1" diff --git a/README.md b/README.md index bb5751ff..eba83f76 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,7 @@ gr sync | `gr branch [name]` | Create or list branches | | `gr checkout ` | Checkout branch across repos | | `gr checkout -b ` | Create and checkout branch in one command | +| `gr checkout add ` | Create an independent child checkout from cached repos | | `gr add [files]` | Stage changes across repos | | `gr diff` | Show diff across repos | | `gr commit -m "msg"` | Commit across repos | @@ -183,6 +184,9 @@ gr sync | `gr link` | Manage file links | | `gr run