mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-09-01 09:13:48 +00:00
ci: add script to check README against plugins list
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2443>
This commit is contained in:
parent
e52dedcf38
commit
9ac981b731
2 changed files with 71 additions and 0 deletions
|
@ -340,6 +340,14 @@ check commits:
|
|||
- ci/check-for-symlinks.sh
|
||||
- ci/check-meson-version.sh
|
||||
|
||||
check readme:
|
||||
extends: '.debian:12-stable'
|
||||
stage: "lint"
|
||||
tags: [ 'placeholder-job' ]
|
||||
needs: []
|
||||
script:
|
||||
- ci/check-readme-against-plugins-list.py
|
||||
|
||||
clippy:
|
||||
extends: '.debian:12-stable'
|
||||
needs:
|
||||
|
|
63
ci/check-readme-against-plugins-list.py
Executable file
63
ci/check-readme-against-plugins-list.py
Executable file
|
@ -0,0 +1,63 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# check-readme-against-plugins-list.py:
|
||||
#
|
||||
# Check that the README.md covers all plugins in the plugin list.
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
# Read README.md
|
||||
with open('README.md') as f:
|
||||
readme = f.read()
|
||||
|
||||
# Read plugins doc cache
|
||||
with open('docs/plugins/gst_plugins_cache.json', 'r') as f:
|
||||
docs = json.load(f)
|
||||
|
||||
plugins = list(docs.keys())
|
||||
|
||||
missing_plugins = []
|
||||
covered_plugins = []
|
||||
|
||||
# Some plugins are listed with their subdir which doesn't match the plugin name
|
||||
plugins_remap = {
|
||||
'rsflv': 'flavors',
|
||||
'textahead': 'ahead',
|
||||
'textwrap': 'wrap',
|
||||
}
|
||||
|
||||
for plugin_name in plugins:
|
||||
if plugin_name in plugins_remap:
|
||||
plugin_name = plugins_remap[plugin_name]
|
||||
|
||||
plugin_bullet_line = f'- `{plugin_name}`:'
|
||||
if plugin_name.startswith('rs'):
|
||||
name2 = plugin_name[2:]
|
||||
plugin_bullet_line2 = f'- `{name2}`:'
|
||||
else:
|
||||
plugin_bullet_line2 = plugin_bullet_line
|
||||
if not plugin_bullet_line in readme and not plugin_bullet_line2 in readme:
|
||||
print(f'{plugin_name}: Missing!')
|
||||
missing_plugins += [plugin_name]
|
||||
else:
|
||||
print(f'{plugin_name}: Ok')
|
||||
|
||||
if missing_plugins:
|
||||
sys.exit(
|
||||
'\nMissing plugins in README.md:\n - {}'.format('\n - '.join(missing_plugins)))
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
# FIXME: for later if we want full coverage of all element names too
|
||||
'''
|
||||
factories = []
|
||||
|
||||
for plugin_name in plugins:
|
||||
plugin = docs[plugin_name]
|
||||
#print(json.dumps(plugin, indent=4))
|
||||
factories += list(plugin['elements'].keys())
|
||||
|
||||
print()
|
||||
print('Elements:', factories)
|
||||
'''
|
Loading…
Reference in a new issue