#!/usr/bin/env bash # Check or test every workspace package: each directory under packages/ with a # gleam.toml (robot-docs/workspace-packages.md). Each builds on its own # manifest, in its own build/ directory, as its Nix derivation does. # check format check, and a build that fails on any warning (test/quick.sh) # test the package's own tests (test.sh) set -euo pipefail cd "$(dirname "$0")/.." mode="${1:-}" case "$mode" in check | test) ;; *) echo "usage: $0 check|test" >&2 exit 2 ;; esac for config in packages/*/gleam.toml; do package="$(dirname "$config")" ( cd "$package" # A git dependency fetch must not walk up into the checkout's shared .git # (see nix/devShells.nix). export GIT_CEILING_DIRECTORIES="$PWD/build${GIT_CEILING_DIRECTORIES:+:$GIT_CEILING_DIRECTORIES}" if [[ $mode == check ]]; then sources=(src) if [[ -d test ]]; then sources+=(test) fi gleam format --check "${sources[@]}" gleam build --warnings-as-errors else gleam test fi ) done