Files
yutu/CONTRIBUTING.md
T

1.4 KiB
Raw Blame History

Contributing

yutu is a cli tool built using the cobra. Feel free to contribute to the project under these conventions:

  • Commit messages should follow the gitmoji convention.
  • Follow the existing naming and project structure.

Here are some commands which may useful.

# upgrade all dependencies
❯ go get -u ./...

# run tests
## unit tests
❯ go test ./... -coverprofile=./cover.out -coverpkg="$(go list || go list -m | head -1)/pkg/..."
❯ go tool cover -html=cover.out -o=cover.html 
## or with bazel
❯ bazel test //...
❯ bazel coverage //...
❯ genhtml -o genhtml "$(bazel info output_path)/_coverage/_coverage_report.dat"
## verify binary commands, detect shorthands conflicts, etc.
❯ ./scripts/command-test.sh

# build the binary
## install goreleaser: https://goreleaser.com/install
❯ GITHUB_REPOSITORY=eat-pray-ai/yutu goreleaser build --clean --auto-snapshot
# or with bazel
❯ bazel mod tidy
❯ bazel run //:gazelle  # (re)generate BUILD files
## update go.mod, go.sum, and use_repo in MODULE.bazel
❯ bazel run @rules_go//go -- mod tidy -v
❯ bazel build //:yutu   # build the binary for the current platform
❯ bazel build //...     # build all targets
❯ bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //:yutu

# script to install yutu
❯ ./scripts/install.sh