Skip to content

Optimize playlist handling #247

Optimize playlist handling

Optimize playlist handling #247

Workflow file for this run

name: Test
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Perl
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: '5.36'
- name: Clone LMS Server Repository for Testing
run: |
# Clone LMS server repository to get actual modules
git clone --depth 1 --branch public/9.0 https://github.com/LMS-Community/slimserver.git /home/runner/lms-server
- name: Validate XML files
run: |
# Install xmllint for validation
sudo apt-get update
sudo apt-get install -y libxml2-utils
# Validate install.xml
xmllint --noout Plugins/SiriusXM/install.xml
echo "✓ install.xml is well-formed"
# Validate repo.xml
xmllint --noout repo.xml
echo "✓ repo.xml is well-formed"
- name: Test plugin structure validation
run: |
# Validate plugin structure with access to LMS modules
perl -e '
use strict;
use warnings;
# Add LMS modules to path
unshift @INC, "/home/runner/lms-server";
unshift @INC, "/home/runner/lms-server/CPAN";
unshift @INC, "/home/runner/lms-server/lib";
# Check that all Perl modules have proper package declarations
my @modules = glob("Plugins/SiriusXM/*.pm");
foreach my $module (@modules) {
open(my $fh, "<", $module) or die "Cannot open $module: $!";
my $content = do { local $/; <$fh> };
close($fh);
# Check for package declaration
if ($content =~ /^package\s+Plugins::SiriusXM::\w+;/m) {
print "✓ $module has proper package declaration\n";
} else {
die "✗ $module missing proper package declaration\n";
}
# Check for use strict and warnings
if ($content =~ /use strict;/ && $content =~ /use warnings;/) {
print "✓ $module has strict and warnings\n";
} else {
die "✗ $module missing strict/warnings pragmas\n";
}
}
print "All modules passed structure validation\n";
'
- name: Test SXM Proxy
id: sxmproxy
run: |
unset PERL5LIB; perl -I/home/runner/lms-server Plugins/SiriusXM/Bin/sxm.pl --lmsroot /home/runner/lms-server d_startup --help 2>&1 | tee output.txt
if grep -q "Show this help message" output.txt; then
echo "✓ sxm proxy started ok"
else
echo "✗ sxm Proxy Error"
exit 1
fi
- name: Validate directory structure
run: |
# Ensure required directories exist
test -d Plugins/SiriusXM
test -d Plugins/SiriusXM/HTML/EN/plugins/SiriusXM/settings
test -d .github/workflows
# Ensure required files exist
test -f Plugins/SiriusXM/install.xml
test -f repo.xml
test -f Plugins/SiriusXM/strings.txt
test -f README.md
test -f .gitignore
test -f Plugins/SiriusXM/Plugin.pm
test -f Plugins/SiriusXM/API.pm
test -f Plugins/SiriusXM/Settings.pm
test -f Plugins/SiriusXM/HTML/EN/plugins/SiriusXM/settings/basic.html
- name: Check strings file format
run: |
# Basic validation of strings.txt format
grep -q "PLUGIN_SIRIUSXM" Plugins/SiriusXM/strings.txt
grep -q "EN" Plugins/SiriusXM/strings.txt
- name: Validate HTML template
run: |
# Check that HTML template contains required elements
grep -q "PLUGIN_SIRIUSXM" Plugins/SiriusXM/HTML/EN/plugins/SiriusXM/settings/basic.html
grep -q "pref_username" Plugins/SiriusXM/HTML/EN/plugins/SiriusXM/settings/basic.html
grep -q "pref_password" Plugins/SiriusXM/HTML/EN/plugins/SiriusXM/settings/basic.html
grep -q "pref_port" Plugins/SiriusXM/HTML/EN/plugins/SiriusXM/settings/basic.html
grep -q "pref_quality" Plugins/SiriusXM/HTML/EN/plugins/SiriusXM/settings/basic.html
- name: Test menu system validation
run: |
# Test that the new simplified menu structure is implemented
echo "Checking for simplified menu structure..."
# Check that handleFeed is replaced with toplevelMenu
if grep -q "toplevelMenu" Plugins/SiriusXM/Plugin.pm; then
echo "✓ toplevelMenu function found"
else
echo "✗ toplevelMenu function missing"
exit 1
fi
# Check that HLS validation is present
if grep -q "validateHLSSupport" Plugins/SiriusXM/Plugin.pm; then
echo "✓ HLS validation function found"
else
echo "✗ HLS validation function missing"
exit 1
fi
# Check that search functionality is present
if grep -q "searchMenu" Plugins/SiriusXM/Plugin.pm; then
echo "✓ Search menu function found"
else
echo "✗ Search menu function missing"
exit 1
fi
# Check that browse by genre is present
if grep -q "browseByGenre" Plugins/SiriusXM/Plugin.pm; then
echo "✓ Browse by genre function found"
else
echo "✗ Browse by genre function missing"
exit 1
fi
echo "Menu system validation passed"