# This is executable Markdown that's tested on CI.
# How is that possible? See https://gist.github.com/bwoods/1c25cb7723a06a076c2152a2781d4d49
set -o errexit -o nounset -o xtrace
alias ~~~=":<<'~~~sh'";:<<'~~~sh'
This repo includes:
- 🧱 Latest version of Bazel and dependencies
- 📦 Curated bazelrc flags via [bazelrc-preset.bzl]
- 🧰 Developer environment setup with [bazel_env.bzl]
- 🎨
shfmtandshellcheck, using rules_lint - ✅ Pre-commit hooks for automatic linting and formatting
First, setup the developer environment by running direnv allow and follow any prompts.
This ensures that tools we call in the following steps will be on the PATH.
direnv allow .Write a simple Bash executable:
>hello.sh cat <<'EOF'
#!/usr/bin/env bash
echo "Hello from Bash"
EOF
chmod u+x hello.shWe should be able to generate BUILD files, see .aspect/gazelle/shell.axl for the logic used
bazel run gazelle || trueNow we verify that running the Bash program produces the expected output.
output="$(bazel run :hello)"
[ "${output}" = "Hello from Bash" ] || {
echo >&2 "Wanted output 'Hello from Bash' but got '${output}'"
exit 1
}Run shellcheck on the code:
aspect lint