This repository has been archived on 2026-11-08. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
qqq-orb/tests/test_cli_ci_behavior.sh
james.maesandClaude Fable 5.1 06c86a93f7
QRun-IO/ci-policy: ci / fork-guard (push) Skipped
QRun-IO/ci-policy: ci / gradle-0 (push) Skipped
QRun-IO/ci-policy: ci / java-docker-1 (push) Skipped
QRun-IO/ci-policy: ci / java-maven-2 (push) Skipped
QRun-IO/ci-policy: ci / node-3 (push) Skipped
QRun-IO/ci-policy: ci / node-4 (push) Skipped
QRun-IO/ci-policy: ci / not-enrolled (push) Skipped
QRun-IO/ci-policy: Shared source and config CI / verify (push) Successful in 12s
QRun-IO/ci-policy: Shared source and config CI / secrets (push) Successful in 17s
QRun-IO/ci-policy: Shared source and config CI / gate (push) Successful in 13s
QRun-IO/ci-policy: ci / source-config-5 (push) Successful in 23m31s
QRun-IO/ci-policy: ci / ci-result (push) Successful in 5s
feat: publish qqq-core and add opt-in CLI platform lanes (#165)
The cli profile publishes @qrun-io/qqq-core between the client and the conformance package, shares one npm dist-tag across the four packages (latest only when every version is final, else rc), accepts an optional platforms: [macos-arm64, windows-x64] manifest key that adds cli_platform lanes, runs npm run lint in cli_verify.sh, diffs operations.ts in the drift check, and moves the Node image to cimg/node:22.23.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-01 04:13:21 -06:00

95 lines
4.3 KiB
Bash

#!/bin/bash
# Stub package commands and HTTP: no package publication or external network.
set -euo pipefail
scripts=$(cd "$(dirname "${BASH_SOURCE[0]}")/../src/scripts" && pwd)
scratch=$(mktemp -d)
trap 'rm -rf "$scratch"' EXIT
cd "$scratch"
mkdir -p bin node_modules/.bin packages/{ui-api-client,core,conformance,cli}/src
export CLI_LOG="$scratch/commands" PRISM_PID_FILE="$scratch/prism-pid" CONFIG_PATH_FILE="$scratch/npm-config-path"
cat > bin/npm <<'STUB'
#!/bin/bash
printf '%s\n' "$*" >> "$CLI_LOG"
if [[ "$1" == whoami ]]; then
[[ "${FAIL_AUTH:-false}" != true ]] || exit 42
grep -Fq '${NODE_AUTH_TOKEN}' "$NPM_CONFIG_USERCONFIG" || exit 43
printf '%s' "$NPM_CONFIG_USERCONFIG" > "$CONFIG_PATH_FILE"
fi
if [[ "$1" == test && "${FAIL_TEST:-false}" == true ]]; then exit 44; fi
STUB
cat > bin/git <<'STUB'
#!/bin/bash
[[ "${FAIL_DRIFT:-false}" != true ]]
STUB
cat > bin/curl <<'STUB'
#!/bin/bash
if [[ "$*" == *authentication* && "${FAIL_SMOKE:-false}" == true ]]; then exit 45; fi
exit 0
STUB
cat > node_modules/.bin/prism <<'STUB'
#!/bin/bash
printf '%s' "$$" > "$PRISM_PID_FILE"
exec sleep 60
STUB
chmod +x bin/* node_modules/.bin/prism
export PATH="$scratch/bin:$PATH"
: > "$CLI_LOG"
bash "$scripts/cli_verify.sh"
[[ "$(cat "$CLI_LOG")" == $'run generate\nrun build\ntest\nrun lint' ]]
if [[ -e "$PRISM_PID_FILE" ]] && kill -0 "$(cat "$PRISM_PID_FILE")" 2>/dev/null; then
echo 'Prism process survived cleanup' >&2
exit 1
fi
: > "$CLI_LOG"
if FAIL_DRIFT=true bash "$scripts/cli_verify.sh"; then exit 1; fi
[[ "$(cat "$CLI_LOG")" == 'run generate' ]]
: > "$CLI_LOG"
if FAIL_TEST=true bash "$scripts/cli_verify.sh"; then exit 1; fi
[[ "$(grep -c '^test$' "$CLI_LOG")" -eq 1 ]]
if FAIL_SMOKE=true bash "$scripts/cli_verify.sh"; then exit 1; fi
if [[ -e "$PRISM_PID_FILE" ]] && kill -0 "$(cat "$PRISM_PID_FILE")" 2>/dev/null; then
echo 'Prism process survived cleanup' >&2
exit 1
fi
write_packages() {
local core_version=$1 core_dependency=$2 client_version=${3:-1.6.0-rc.1} cli_version=${4:-0.1.0-rc.1} item dir name version
for item in "ui-api-client qqq-ui-api-client $client_version" "core qqq-core $core_version" "conformance qqq-ui-api-conformance $client_version" "cli qqq-cli $cli_version"; do
read -r dir name version <<< "$item"
printf '{"name":"@qrun-io/%s","version":"%s","publishConfig":{"registry":"https://npm.pkg.github.com"},"dependencies":{"@qrun-io/qqq-core":"%s"}}\n' "$name" "$version" "$core_dependency" > "packages/$dir/package.json"
done
}
write_packages 0.1.0-rc.1 0.1.0-rc.1
export CIRCLE_TAG=v1.6.0-rc.1 GITHUB_TOKEN=test-not-a-credential
: > "$CLI_LOG"
bash "$scripts/cli_publish.sh"
[[ "$(grep '^publish ' "$CLI_LOG" | cut -d' ' -f3)" == $'@qrun-io/qqq-ui-api-client\n@qrun-io/qqq-core\n@qrun-io/qqq-ui-api-conformance\n@qrun-io/qqq-cli' ]]
[[ $(grep -c -- '--tag rc$' "$CLI_LOG") -eq 4 ]]
# Final versions publish as latest; any prerelease among the four keeps rc.
write_packages 1.0.0 1.0.0 1.6.0 1.0.0
: > "$CLI_LOG"
CIRCLE_TAG=v1.6.0 bash "$scripts/cli_publish.sh"
[[ $(grep -c -- '--tag latest$' "$CLI_LOG") -eq 4 ]]
[[ $(grep -c '^publish ' "$CLI_LOG") -eq 4 ]]
write_packages 1.0.0 1.0.0 1.6.0-rc.3 1.0.0
: > "$CLI_LOG"
CIRCLE_TAG=v1.6.0-rc.3 bash "$scripts/cli_publish.sh"
[[ $(grep -c -- '--tag rc$' "$CLI_LOG") -eq 4 ]]
[[ $(grep -c '^test$' "$CLI_LOG" || true) -eq 0 ]]
[[ ! -e "$(cat "$CONFIG_PATH_FILE")" ]]
for condition in wrong-tag missing-token denied-auth core-version core-dependency; do
: > "$CLI_LOG"
write_packages 0.1.0-rc.1 0.1.0-rc.1
case "$condition" in
core-version) write_packages 0.1.0-rc.2 0.1.0-rc.2; if bash "$scripts/cli_publish.sh" >/dev/null 2>&1; then exit 1; fi ;;
core-dependency) write_packages 0.1.0-rc.1 0.1.0-rc.0; if bash "$scripts/cli_publish.sh" >/dev/null 2>&1; then exit 1; fi ;;
wrong-tag) if CIRCLE_TAG=v0.1.0 bash "$scripts/cli_publish.sh" >/dev/null 2>&1; then exit 1; fi ;;
missing-token) if GITHUB_TOKEN='' bash "$scripts/cli_publish.sh" >/dev/null 2>&1; then exit 1; fi ;;
denied-auth) if FAIL_AUTH=true bash "$scripts/cli_publish.sh" >/dev/null 2>&1; then exit 1; fi ;;
esac
if grep -q '^publish ' "$CLI_LOG"; then
echo "Publication occurred despite $condition" >&2
exit 1
fi
done
printf 'PASS: CLI validation once, drift/test/smoke failures, cleanup, tag/core-version/auth checks and four rc/latest publishes (stubbed)\n'