#!/usr/bin/env bash # Lumbridge CI. # # scripts/ci.sh headless and UI # scripts/ci.sh --headless everything except the GPUI product # scripts/ci.sh --ui only the GPUI product and its fixture # # The split exists because the UI crates pull GPUI's dependency tree — several # hundred packages and a large target directory — while the headless crates # build in seconds. A contributor changing lumbridge-core should not wait for a # window toolkit, and a CI runner that cannot carry the UI job can still gate # everything else. set -euo pipefail run_headless=1 run_ui=1 case "${1:-}" in --headless) run_ui=0 ;; --ui) run_headless=0 ;; "") ;; *) echo "usage: $0 [--headless|--ui]" >&2; exit 2 ;; esac # The UI crates. Excluded from the headless pass by name so a new crate is # headless by default rather than silently joining the slow job. ui_packages=(lumbridge lumbridge-ui-fixture) cargo fmt --all --check # The product's licence closure. Graduating GPUI into the workspace made this # the product's problem rather than a spike's; deny.toml records which licences # were reviewed and why. Skipped rather than failed when the tool is absent, so # a contributor without it is not blocked. if command -v cargo-deny >/dev/null 2>&1; then cargo deny check licenses else echo "cargo-deny not installed; skipping the licence gate (cargo install cargo-deny)" >&2 fi test_runner() { if command -v cargo-nextest >/dev/null 2>&1; then cargo nextest run "$@" --all-features --profile "${NEXTEST_PROFILE:-default}" else echo "cargo-nextest not installed; using cargo test" >&2 cargo test "$@" --all-features fi } if [ "$run_headless" = 1 ]; then exclusions=() for package in "${ui_packages[@]}"; do exclusions+=(--exclude "$package") done cargo clippy --workspace "${exclusions[@]}" --all-targets --all-features -- -D warnings test_runner --workspace "${exclusions[@]}" # nextest deliberately does not run doctests on stable Rust. cargo test --workspace "${exclusions[@]}" --all-features --doc fi if [ "$run_ui" = 1 ]; then # shellcheck source=/dev/null . "$(dirname "$0")/native-libs.sh" selections=() for package in "${ui_packages[@]}"; do selections+=(-p "$package") done cargo clippy "${selections[@]}" --all-targets --all-features -- -D warnings test_runner "${selections[@]}" cargo test "${selections[@]}" --all-features --doc fi