add test setup scripts

This commit is contained in:
gmega 2026-06-10 21:14:47 -03:00
parent 8d8866d724
commit 17eb342fa0
No known key found for this signature in database
GPG Key ID: 6290D34EAD824B18
5 changed files with 136 additions and 0 deletions

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# Logos Storage Modules E2E Tests
End-to-end testing harness for running UI tests on the Logos Storage module stack.

23
run-tests.sh Normal file
View File

@ -0,0 +1,23 @@
#!/usr/bin/bash
source "./scripts/logos.sh"
source "./scripts/github.sh"
LOGOS_QT_MCP_REPO="${LOGOS_QT_MCP_REPO:-logos-co/logos-qt-mcp}"
gh_clone "logos-co/logos-basecamp" "${BASECAMP_RELEASE_OR_BRANCH:-latest}"
gh_clone "logos-co/logos-storage-module" "${CORE_RELEASE_OR_BRANCH:-latest}"
gh_clone "logos-co/logos-storage-ui" "${UI_RELEASE_OR_BRANCH:-latest}"
# Allows overriding LOGOS_QT_MCP with a custom repo/tag/branch.
LOGOS_QT_MCP=$(gh_clone "${LOGOS_QT_MCP_REPO}" "${LOGOS_QT_MCP_RELEASE_OR_BRANCH:-latest}")
BASECAMP_BINARY=$(lg_build_local_basecamp)
STORAGE_CORE_LGX=$(lg_build_local_lgx "logos-storage-module")
STORAGE_UI_LGX=$(lg_build_storage_ui_lgx "logos-storage-ui")
export LOGOS_QT_MCP
export STORAGE_CORE_LGX
export STORAGE_UI_LGX
node tests/logos-ui-module-tests.mjs --ci "${BASECAMP_BINARY}" --xvfb

3
scripts/common.sh Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
echoerr() { echo "$@" >&2; }

45
scripts/github.sh Normal file
View File

@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -euo pipefail
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SOURCE_DIR}/common.sh"
gh_latest_release() {
local repo_slug="$1"
local api_url="https://api.github.com/repos/${repo_slug}"
local latest_release
latest_release=$(curl -fsSL "${api_url}/releases/latest" | jq -r '.tag_name')
if [[ -z "${latest_release}" || "${latest_release}" == "null" ]]; then
echoerr "Error: could not determine latest release for ${repo_slug}" >&2
return 1
fi
echoerr "Latest release of ${repo_slug}: ${latest_release}"
echo "${latest_release}"
}
gh_clone() {
local repo_slug="$1"
local branch_or_tag="$2"
local repo_name="${repo_slug##*/}"
local api_url="https://api.github.com/repos/${repo_slug}"
local dest="${LOGOS_BASE}/${repo_name}"
if [[ -z "${branch_or_tag}" || "${branch_or_tag}" == "latest" ]]; then
branch_or_tag=$(gh_latest_release "${repo_slug}") || return 1
fi
echoerr "Cloning ${repo_slug}: ${branch_or_tag}"
if [[ -d "${dest}" ]]; then
echoerr "Removing existing ${dest}"
rm -rf "${dest}"
fi
mkdir -p "$(dirname "${dest}")"
git clone --depth 1 --branch "${branch_or_tag}" \
"https://github.com/${repo_slug}.git" "${dest}"
echoerr "Cloned ${repo_slug}@${branch_or_tag} into ${dest}"
echo "${dest}"
}

62
scripts/logos.sh Normal file
View File

@ -0,0 +1,62 @@
#!/usr/bin/env bash
set -euo pipefail
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SOURCE_DIR}/common.sh"
LOGOS_BASE="$(cd "${SOURCE_DIR}/.." && pwd)/logos"
export LOGOS_BASE
mkdir -p "${LOGOS_BASE}"
_find_lgx() {
local matches
mapfile -t matches < <(find -L ./ -type f -name "*.lgx")
if (( ${#matches[@]} != 1 )); then
echoerr "Expected exactly 1 LGX file, found ${#matches[@]}"
return 1
fi
realpath "${matches[0]}"
}
lg_build_local_basecamp() {
if [[ -z "${LOGOS_QT_MCP:-}" ]]; then
echoerr "LOGOS_QT_MCP is not set"
return 1
fi
cd "${LOGOS_BASE}/logos-basecamp" || return 1
nix build --override-input logos-qt-mcp "path:${LOGOS_QT_MCP}" '.#app' || return 1
if [ -e ./result/bin/LogosBasecamp ]; then
echo "${PWD}/result/bin/LogosBasecamp"
else
echoerr "No output found"
return 1
fi
}
lg_build_local_lgx() {
local lgx module
module="$1"
cd "${LOGOS_BASE}/${module}" || return 1
nix bundle --bundler github:logos-co/nix-bundle-lgx ".#lib" || return 1
lgx=$(_find_lgx)
echoerr "LGX generated at ${lgx}"
echo "${lgx}"
}
lg_build_storage_ui_lgx() {
local lgx
cd "${LOGOS_BASE}/logos-storage-ui" || return 1
nix build '.#lgx' || return 1
lgx=$(_find_lgx)
echoerr "LGX generated at ${lgx}"
echo "${lgx}"
}
lg_start_basecamp() {
local basecamp
basecamp=$(lg_build_local_basecamp) || return 1
"${basecamp}" &
}