forked from Unmanic/unmanic-plugins
-
Notifications
You must be signed in to change notification settings - Fork 2
174 lines (164 loc) · 5.9 KB
/
plugin-checker.yml
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: Unmanic Plugin Test and Generate Repo
on:
push:
branches:
- '**'
- 'pr-**'
- '!template'
pull_request:
branches:
- 'official'
- 'master'
jobs:
# Ensure that all plugins contain the required files and that
# certain files or directories are not present.
plugins-contain-required-files:
runs-on: ubuntu-latest
name: Plugins contain all required files
steps:
# Checkout
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# _____ ____ _
# | ____|_ __ ___ _ _ _ __ ___ | _ \ _ __ ___ ___ ___ _ __ | |_
# | _| | '_ \/ __| | | | '__/ _ \ | |_) | '__/ _ \/ __|/ _ \ '_ \| __|
# | |___| | | \__ \ |_| | | | __/ | __/| | | __/\__ \ __/ | | | |_
# |_____|_| |_|___/\__,_|_| \___| |_| |_| \___||___/\___|_| |_|\__|
#
- name: Check .gitignore in all plugin folders
if: success() || failure()
run: |
success=0
for plugin_dir in source/*; do
if [ -d "${plugin_dir}" ]; then
# Ensure this directory contains a .gitignore file
if [ -e "${plugin_dir}/.gitignore" ]; then
echo "PASS - Found .gitignore in plugin '${plugin_dir}'"
else
echo "FAIL - Missing .gitignore in plugin '${plugin_dir}'"
success=1
fi
fi
done
if [ ${success} -gt 0 ]; then
exit 1
fi
- name: Check info.json in all plugin folders
if: success() || failure()
run: |
success=0
for plugin_dir in source/*; do
if [ -d "${plugin_dir}" ]; then
# Ensure this directory contains a info.json file
if [ -e "${plugin_dir}/info.json" ]; then
echo "PASS - Found info.json in plugin '${plugin_dir}'"
else
echo "FAIL - Missing info.json in plugin '${plugin_dir}'"
success=1
fi
fi
done
if [ ${success} -gt 0 ]; then
exit 1
fi
- name: Check plugin.py in all plugin folders
if: success() || failure()
run: |
success=0
for plugin_dir in source/*; do
if [ -d "${plugin_dir}" ]; then
# Ensure this directory contains a plugin.py file
if [ -e "${plugin_dir}/plugin.py" ]; then
echo "PASS - Found plugin.py in plugin '${plugin_dir}'"
else
echo "FAIL - Missing plugin.py in plugin '${plugin_dir}'"
success=1
fi
fi
done
if [ ${success} -gt 0 ]; then
exit 1
fi
# _____ __ __ _ _
# | ____|_ __ ___ _ _ _ __ ___ | \/ (_)___ ___(_)_ __ __ _
# | _| | '_ \/ __| | | | '__/ _ \ | |\/| | / __/ __| | '_ \ / _` |
# | |___| | | \__ \ |_| | | | __/ | | | | \__ \__ \ | | | | (_| |
# |_____|_| |_|___/\__,_|_| \___| |_| |_|_|___/___/_|_| |_|\__, |
# |___/
- name: Check site-packages in all plugin folders
if: success() || failure()
run: |
success=0
for plugin_dir in source/*; do
if [ -d "${plugin_dir}" ]; then
# Ensure this directory contains a site-packages file
if [ -e "${plugin_dir}/site-packages" ]; then
echo "FAIL - Directory 'site-packages' found in plugin '${plugin_dir}'"
success=1
else
echo "PASS - No 'site-packages' directory found in plugin '${plugin_dir}'"
fi
fi
done
if [ ${success} -gt 0 ]; then
exit 1
fi
- name: Check settings.json in all plugin folders
if: success() || failure()
run: |
success=0
for plugin_dir in source/*; do
if [ -d "${plugin_dir}" ]; then
# Ensure this directory contains a settings.json file
if [ -e "${plugin_dir}/settings.json" ]; then
echo "FAIL - Directory 'settings.json' found in plugin '${plugin_dir}'"
success=1
else
echo "PASS - No 'settings.json' directory found in plugin '${plugin_dir}'"
fi
fi
done
if [ ${success} -gt 0 ]; then
exit 1
fi
# Store success message in success file artifact
- name: Set success file on completion of tests
if: success()
run: echo 'true' > success_file.txt
- name: Upload success file
if: success()
uses: actions/upload-artifact@v4
with:
name: success_file
path: success_file.txt
# Build the plugin repository
deploy-plugin-repo:
needs: [plugins-contain-required-files]
runs-on: ubuntu-latest
name: Build the plugin repository
steps:
# Fetch and read success file
- name: Download success file from previous job
uses: actions/download-artifact@v4
with:
path: ./artifacts/
- name: Read success file
id: previous_jobs_success
run: |
IS_SUCCESS=$(cat ./artifacts/success_file/success_file.txt)
echo "IS_SUCCESS=${IS_SUCCESS:?}" >> $GITHUB_OUTPUT
rm -rfv ./artifacts
# Checkout
- name: Checkout
if: steps.previous_jobs_success.outputs.IS_SUCCESS == 'true'
uses: actions/checkout@v4
with:
submodules: recursive
# Execute plugin repo gen action
- name: Generate and Deploy Unmanic Plugin Repository
uses: Unmanic/action.generate-unmanic-plugin-repo@master
with:
deploy_repo: 'true'
github_token: ${{ secrets.GH_TOKEN }}