name: Validate Plasmoid
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]
# A newer push supersedes this run: on a branch or PR the run in
# progress is cancelled; on master it finishes, and only a run still
# waiting is replaced.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate plasmoid structure
run: |
echo "🔍 Validating plasmoid structure..."
# Check required files
required_files=("metadata.json" "contents/ui/main.qml")
missing_files=()
for file in "${required_files[@]}"; do
if [[ ! -f "$file" ]]; then
missing_files+=("$file")
fi
done
if [[ ${#missing_files[@]} -gt 0 ]]; then
echo "❌ Missing required files:"
printf '%s\n' "${missing_files[@]}"
exit 1
fi
echo "✅ All required files present"
- name: Validate metadata.json
run: |
echo "🔍 Validating metadata.json..."
# Check if metadata.json is valid JSON
if ! jq empty metadata.json 2>/dev/null; then
echo "❌ metadata.json is not valid JSON"
exit 1
fi
# Check required fields
required_fields=("KPlugin.Id" "KPlugin.Name" "KPlugin.Version" "KPlugin.Authors")
for field in "${required_fields[@]}"; do
if [[ $(jq -r ".$field // empty" metadata.json) == "" ]]; then
echo "❌ Missing required field: $field"
exit 1
fi
done
echo "✅ metadata.json is valid"
# Display current metadata
echo "📋 Current metadata:"
jq . metadata.json
- name: Check QML syntax
run: |
echo "🔍 Checking QML files..."
# Install Qt6 QML tools (and rsync, for the package step below —
# the forge runner's image doesn't ship it)
sudo apt-get update
sudo apt-get install -y qt6-declarative-dev-tools rsync
# Debian/Ubuntu install the Qt 6 tools here, not on PATH.
qtbin=/usr/lib/qt6/bin
# qmlformat parses without resolving imports, so it fails on a
# genuine syntax error and nothing else — that's the gate.
# qmllint goes further but can't see the Plasma/Kirigami modules
# on this runner, so its findings are printed, not enforced.
failed=0
while read -r qml_file; do
echo "Checking: $qml_file"
if ! "$qtbin/qmlformat" "$qml_file" >/dev/null; then
echo "❌ QML syntax error in: $qml_file"
failed=1
fi
"$qtbin/qmllint" "$qml_file" || true
done < <(find . -name "*.qml" -type f -not -path './.git/*')
if [[ $failed -ne 0 ]]; then
exit 1
fi
echo "✅ QML syntax check completed"
- name: Create test package
run: |
echo "📦 Creating test package..."
# Create a temporary directory for packaging
mkdir -p /tmp/test-package
# Copy all necessary files
rsync -av --exclude='.git' --exclude='.github' --exclude='*.swp' --exclude='*~' . /tmp/test-package/
# Test packaging
cd /tmp
tar -czf test-plasmoid.tar.gz test-package/
# Check package size (warn if > 10MB)
size=$(stat -c%s test-plasmoid.tar.gz)
size_mb=$((size / 1024 / 1024))
echo "📏 Package size: ${size_mb}MB"
if [[ $size_mb -gt 10 ]]; then
echo "⚠️ Package is larger than 10MB. Consider optimizing."
fi
echo "✅ Test package created successfully"
neiam
/home-assistant-plasmoid
Home Assistant Plasmoid
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
3.9 KiB · text
History
cfb03ed