ci: add install script workflow (#7159)

* ci: add install script workflow

Add GitHub Actions workflow to test install.sh script.

This prevents regressions like the one reported in issue #7133 where
changes to the install script broke the recommended installation method.

The workflow includes:
- shellcheck for script linting (temporarily excludes SC3045)
- Integration test using curl piped to sh as documented on starship.rs

Signed-off-by: cappyzawa <cappyzawa@gmail.com>

* fixup! ci: add install script workflow

Signed-off-by: cappyzawa <cappyzawa@gmail.com>

* fixup! ci: add install script workflow

Signed-off-by: cappyzawa <cappyzawa@gmail.com>

* ci: add shfmt check and format install scripts

Add shfmt job to install-script workflow for consistent shell script
formatting. Apply shfmt to all scripts under install/ directory.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>

---------

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
This commit is contained in:
Shu Kutsuzawa
2025-12-29 05:19:25 +09:00
committed by GitHub
parent 74e13d1e59
commit 6e6664dea6
6 changed files with 482 additions and 433 deletions
@@ -9,45 +9,45 @@ set -euo pipefail
# it is being run from within a starship repository if $1 is not provided.
usage() {
echo "Builds a component package for macOS."
echo "Assumes that the following items already exist:"
echo " - A starship binary which has already been notarized"
echo " - Documentation created by \`npm run build\`, usually in a dist"
echo " directory at <repo>/docs/.vitepress/dist"
echo "Usage: $0 <path-to-starship-binary> <path-to-dist-directory>"
echo "Builds a component package for macOS."
echo "Assumes that the following items already exist:"
echo " - A starship binary which has already been notarized"
echo " - Documentation created by \`npm run build\`, usually in a dist"
echo " directory at <repo>/docs/.vitepress/dist"
echo "Usage: $0 <path-to-starship-binary> <path-to-dist-directory>"
}
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
source "$script_dir/common.sh"
cleanup_server() {
if [[ -n "${server_pid-}" ]]; then
echo "Killing HTTP server ($server_pid) to clean up."
kill "$server_pid"
rm "x86_64-apple-darwin-simple-http-server"
else
echo "No server found, exiting normally."
fi
if [[ -n "${server_pid-}" ]]; then
echo "Killing HTTP server ($server_pid) to clean up."
kill "$server_pid"
rm "x86_64-apple-darwin-simple-http-server"
else
echo "No server found, exiting normally."
fi
}
if [[ "$OSTYPE" != 'darwin'* ]]; then
error "This script only works on MacOS"
error "This script only works on MacOS"
fi
if [[ "${2-undefined}" = "undefined" ]]; then
usage
exit 1
usage
exit 1
fi
starship_program_file="$1"
starship_documentation_dir="$2"
if [ ! -f "$starship_program_file" ]; then
error "Could not find starship binary at $starship_program_file"
error "Could not find starship binary at $starship_program_file"
fi
if [ ! -d "$starship_documentation_dir" ]; then
error "Could not find starship documentation at $starship_documentation_dir"
error "Could not find starship documentation at $starship_documentation_dir"
fi
pkgdir="$(mktemp -d)"