-
Notifications
You must be signed in to change notification settings - Fork 1
159 lines (133 loc) · 5.28 KB
/
test.yml
File metadata and controls
159 lines (133 loc) · 5.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
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"