Files
status-app/scripts/validate-qml.sh
T
Siddarth Kumar c4e0dbeae7 ci: serialise linux and macos jobs and build from system nim
- in linux jobs we serialise `tests-ui`, `tests-nim` and  appImage
`package` into a single workflow.
- in macos job we serialise `iOS`, `MacOS` builds into a single
workflow.
- we use system `nim` for all jobs and dont have to build nim from
nimbus build system each time.
  - installed `nim 2.2.10` on `windows` and `macos` hosts.
  - upgraded nim in Docker images and bumped the harbour tags for
`linux` and `android`.

This will help us avoid checkout and `deps` stage for these jobs and we
can free up slots for other jobs.
This way we can do more work in parallel.

Because of this we save:
- `12` minutes of build time in `linux` job.
- `10` minutes of build time in `macos` job.
- `21` minutes of `nim` compile time in `windows` job.
2026-08-26 15:41:03 +05:30

72 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
set -eo pipefail
SCRIPT_DIR=$(dirname "$(realpath "$0")")
ROOT_DIR=$(realpath "$SCRIPT_DIR/..")
QT_QML_PATH="${QT_QML_PATH:-${QTDIR}/qml}"
QMLLINT="${QTDIR}/bin/qmllint"
[[ ! -x "$QMLLINT" ]] && QMLLINT="${QTDIR}/libexec/qmllint"
if [[ ! -x "$QMLLINT" ]]; then
echo "Error: qmllint not found. Set QTDIR to your Qt installation path."
exit 1
fi
# Check for jq
if ! command -v jq &> /dev/null; then
echo "Error: jq is required but not installed."
exit 1
fi
echo "qmllint: $QMLLINT"
echo "Qt modules: $QT_QML_PATH"
echo ""
# Collect all QML files. Skip build trees: CMake drops third-party sources
mapfile -d '' QML_FILES < <(find "$ROOT_DIR/ui" -type d -name build -prune -o -name "*.qml" -print0)
echo "Checking ${#QML_FILES[@]} files..."
# Run qmllint with JSON output for precise filtering
JSON_OUTPUT=$("$QMLLINT" \
--json - \
-I "$ROOT_DIR/ui" \
-I "$ROOT_DIR/ui/imports" \
-I "$ROOT_DIR/ui/app" \
-I "$ROOT_DIR/ui/StatusQ/src" \
-I "$QT_QML_PATH" \
"${QML_FILES[@]}" 2>/dev/null) || true
# Filter JSON for real errors only:
# 1. "Failed to import Qt*" - Missing Qt modules (runtime crash)
# 2. "duplicated-name" warnings - Duplicate symbols (runtime crash)
#
# Excluded (not errors):
# - QtWebEngine/QtWebChannel - disabled on mobile intentionally
# - QtModelsToolkit - third-party C++ plugin
# - qmldir missing files, cascading errors, etc.
ERRORS=$(echo "$JSON_OUTPUT" | jq -r '
.files[]
| .filename as $file
| .warnings[]
| select(
(.id == "duplicated-name") or
((.id == "import") and (.message | test("Failed to import Qt(?!(ModelsToolkit|WebEngine|WebChannel))")))
)
| "\($file):\(.line):\(.column): \(.message)"
' 2>/dev/null || true)
if [[ -n "$ERRORS" ]]; then
echo ""
echo "ERRORS:"
echo "$ERRORS"
echo ""
ERROR_COUNT=$(echo "$ERRORS" | wc -l | tr -d ' ')
echo "Total: $ERROR_COUNT"
exit 1
fi
echo "OK"
exit 0