Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

ci: Modernize CI and resolve environment configuration issues

Maximilian Roosca19035ffc70
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2082fe822..6543cf552 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -6,53 +6,72 @@ on:
pull_request:
branches: [ main ]
+env:
+ CARGO_TERM_COLOR: always
+ RUSTFLAGS: "-C debuginfo=0"
+ RUSTDOCFLAGS: "-Dwarnings"
+
jobs:
test:
name: Test (Tier 1 shells only)
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
+ - name: πŸ“‚ Checkout code
+ uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- - name: Cache cargo registry
- uses: actions/cache@v4
+ - name: Install cargo-insta
+ uses: baptiste0928/cargo-install@v3
with:
- path: ~/.cargo/registry
- key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
+ crate: cargo-insta
- - name: Cache cargo index
- uses: actions/cache@v4
+ - name: Install cargo-nextest
+ uses: baptiste0928/cargo-install@v3
with:
- path: ~/.cargo/git
- key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
+ crate: cargo-nextest
- - name: Cache cargo build
- uses: actions/cache@v4
+ - name: πŸ’° Cache
+ uses: Swatinem/rust-cache@v2
with:
- path: target
- key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
+ prefix-key: ${{ hashFiles('Cargo.lock') }}
+ save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install Tier 1 shells (bash, zsh, fish)
run: |
sudo apt-get update
sudo apt-get install -y zsh fish
- - name: Check formatting
- run: cargo fmt --check
+ - name: 🏭 Compile
+ uses: clechasseur/rs-cargo@v4
+ with:
+ command: test
+ args: --no-run --locked
- - name: Run clippy
- run: cargo clippy --all-targets --all-features -- -D warnings
+ - name: πŸ“‹ Test
+ uses: clechasseur/rs-cargo@v4
+ with:
+ command: insta
+ args: test --test-runner=nextest
- - name: Build
- run: cargo build --verbose
+ - name: πŸ“Ž Clippy
+ uses: clechasseur/rs-cargo@v4
+ with:
+ command: clippy
+ args: --all-targets --all-features -- -D warnings
- - name: Run tests (Tier 1 shells only)
- run: cargo test --verbose
+ - name: ⌨️ Fmt
+ uses: clechasseur/rs-cargo@v4
+ with:
+ command: fmt
+ args: --all --check
- - name: Build release
- run: cargo build --release --verbose
+ - name: πŸ—’οΈ Doc
+ uses: clechasseur/rs-cargo@v4
+ with:
+ command: doc
+ args: --no-deps
diff --git a/.github/workflows/tier-2-integration-tests.yml b/.github/workflows/tier-2-integration-tests.yml
index e1a033186..f2326625f 100644
--- a/.github/workflows/tier-2-integration-tests.yml
+++ b/.github/workflows/tier-2-integration-tests.yml
@@ -6,34 +6,32 @@ on:
pull_request:
branches: [ main ]
+env:
+ CARGO_TERM_COLOR: always
+ RUSTFLAGS: "-C debuginfo=0"
+
jobs:
tier-2-tests:
name: Tier 2 Shell Integration Tests
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
+ - name: πŸ“‚ Checkout code
+ uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- - name: Cache cargo registry
- uses: actions/cache@v4
- with:
- path: ~/.cargo/registry
- key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
-
- - name: Cache cargo index
- uses: actions/cache@v4
+ - name: Install cargo-nextest
+ uses: baptiste0928/cargo-install@v3
with:
- path: ~/.cargo/git
- key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
+ crate: cargo-nextest
- - name: Cache cargo build
- uses: actions/cache@v4
+ - name: πŸ’° Cache
+ uses: Swatinem/rust-cache@v2
with:
- path: target
- key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
+ prefix-key: ${{ hashFiles('Cargo.lock') }}
+ save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install Tier 1 shells (bash, zsh, fish)
run: |
@@ -95,8 +93,14 @@ jobs:
which xonsh && xonsh --version
which oil || which osh
- - name: Run tier-2 integration tests
- run: cargo test --test integration --features tier-2-integration-tests --verbose
+ - name: πŸ“‹ Run tier-2 integration tests
+ uses: clechasseur/rs-cargo@v4
+ with:
+ command: nextest
+ args: run --test integration --features tier-2-integration-tests
- - name: Run all tests with tier-2 features
- run: cargo test --all --features tier-2-integration-tests
+ - name: πŸ“‹ Run all tests with tier-2 features
+ uses: clechasseur/rs-cargo@v4
+ with:
+ command: nextest
+ args: run --all --features tier-2-integration-tests
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
new file mode 100644
index 000000000..43e5784a1
--- /dev/null
+++ b/rust-toolchain.toml
@@ -0,0 +1,3 @@
+[toolchain]
+channel = "1.90.0"
+components = ["rustfmt", "clippy"]
diff --git a/src/commands/config.rs b/src/commands/config.rs
index cfa0733db..0e5921115 100644
--- a/src/commands/config.rs
+++ b/src/commands/config.rs
@@ -135,6 +135,17 @@ fn display_project_config() -> Result<(), GitError> {
}
fn get_global_config_path() -> Option<PathBuf> {
+ // Respect HOME environment variable for testing
+ if let Ok(home) = std::env::var("HOME") {
+ let home_path = PathBuf::from(home);
+ return Some(
+ home_path
+ .join(".config")
+ .join("worktrunk")
+ .join("config.toml"),
+ );
+ }
+
let strategy = choose_base_strategy().ok()?;
Some(strategy.config_dir().join("worktrunk").join("config.toml"))
}