version: '3'
tasks:
setup:
desc: "Setup development environment"
silent: true
status:
- rustup target list --installed | grep -q x86_64-apple-darwin
- rustup target list --installed | grep -q aarch64-apple-darwin
cmds:
- rustup target add x86_64-apple-darwin
- rustup target add aarch64-apple-darwin
test:
desc: "Run all tests"
cmds:
- cargo clippy --all-targets --all-features -- -D warnings
- cargo test --all-features
run:simple:
desc: "Run commitbot in simple mode (no model, debug) using cargo run"
cmds:
- cargo run -- -vv
run:ask:
desc: "Run commitbot in interactive ask mode (no model, debug)"
cmds:
- cargo run -- --ask
run:ask:real:
desc: "Run commitbot in interactive ask mode using real model"
env:
OPENAI_API_KEY: '{{.OPENAI_API_KEY | default .DEFAULT_OPENAI_API_KEY}}'
cmds:
- |
if [ -z "$OPENAI_API_KEY" ]; then
echo "OPENAI_API_KEY is not set. Set it or pass via env when running task."
exit 1
fi
cargo run -- --ask
install:
desc: "Install commitbot binary locally via cargo install --path ."
cmds:
- cargo install --path . --force
build:release:
desc: "Build optimized release binary for the host"
silent: true
cmds:
- cargo build --release
- du -h target/release/commitbot
build:release:*:
desc: "Build release binaries for all targets and package into dist/"
vars:
VERSION: '{{index .MATCH 0}}'
silent: true
cmds:
- mkdir -p dist
- rm -f dist/commitbot-*.tar.gz
- |
set -euo pipefail
echo "Building release binaries..."
cargo build --release --target aarch64-apple-darwin
cargo build --release --target x86_64-apple-darwin
du -h target/aarch64-apple-darwin/release/commitbot
du -h target/x86_64-apple-darwin/release/commitbot
echo "Packaging into dist with version {{.VERSION}}..."
tar -C target/aarch64-apple-darwin/release \
-czf dist/commitbot-{{.VERSION}}-aarch64-apple-darwin.tar.gz \
commitbot
tar -C target/x86_64-apple-darwin/release \
-czf dist/commitbot-{{.VERSION}}-x86_64-apple-darwin.tar.gz \
commitbot
echo "Artifacts created:"
ls -lh dist
release:*:
desc: "Create a release by building and publishing to crates.io (requires VERSION arg)"
vars:
VERSION: '{{index .MATCH 0}}'
interactive: true
cmds:
- task: test
- sh devops/release.sh {{.VERSION}}
- task: publish:dry
- task: publish
- cd ../homebrew-tap && gh workflow run update-formula.yml -f formula=commitbot -f repo=mikegarde/commitbot -f version={{.VERSION}}
publish:dry:
desc: "Dry-run crates.io publish to verify packaging"
cmds:
- cargo publish --dry-run
publish:
desc: "Publish crate to crates.io"
cmds:
- cargo publish