Skip to content

Commit

Permalink
add scripts/plugin-validate.py, run it as github action
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Feb 23, 2024
1 parent 8573086 commit eebddaf
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/plugin-validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Validate Plugins"

on:
push:
branches: ["master", "github-action"]
pull_request:
schedule:
- cron: "33 1 * * 3"

jobs:
ubuntu:
name: Ubuntu

strategy:
fail-fast: false
matrix:
python-version: ["3.11"]

runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: cd and ls
run: |
cd ${{ github.workspace }}
ls -l
- name: Validate Plugins
run: python ./scripts/plugin-validate.py
1 change: 1 addition & 0 deletions pyglossary/plugins/testformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
description = "Test Format File(.test)"
extensions = (".test", ".tst")
extensionCreate = ".test"
singleFile = True
kind = "text"
wiki = ""
website = None
Expand Down
28 changes: 28 additions & 0 deletions scripts/plugin-validate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/python3

import sys
from os.path import abspath, dirname
from pathlib import Path

rootDir = dirname(dirname(abspath(__file__)))
sys.path.insert(0, rootDir)

from pyglossary.core import userPluginsDir
from pyglossary.glossary import Glossary

Glossary.init(
usePluginsJson=False,
skipDisabledPlugins=False,
)

userPluginsDirPath = Path(userPluginsDir)
plugins = [
p for p in Glossary.plugins.values() if userPluginsDirPath not in p.path.parents
]

data = []
for p in plugins:
module = p.module
# print(module.__file__)
p.checkModule(module)
p.checkModuleMore(module)

0 comments on commit eebddaf

Please sign in to comment.