diff --git a/.github/workflows/angular.yml b/.github/workflows/angular.yml new file mode 100644 index 0000000..61df36b --- /dev/null +++ b/.github/workflows/angular.yml @@ -0,0 +1,34 @@ +name: Angular Vitest CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + runs-on: ubuntu-latest + + defaults: + run: + working-directory: frontend + + steps: + - name: Checkout Code + uses: actions/checkout@v7 + + - name: Setup Node.js + uses: actions/setup-node@v7 + with: + node-on-version: '24' + cache: 'npm' + cache-dependency-path: frontend/package-lock.json + + - name: Install Dependencies + run: npm ci --force + + - name: Run Vitest Tests + run: npm run test -- --watch=false + env: + CI: true \ No newline at end of file diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 6e3e32a..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: "CodeQL" - -on: - push: - branches: [master] - pull_request: - # The branches below must be a subset of the branches above - branches: [master] - schedule: - - cron: '0 22 * * 5' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - # Override automatic language detection by changing the below list - # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] - language: ['python', 'javascript'] - # Learn more... - # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 - - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v12 - with: - languages: ${{ matrix.language }} - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/python-analysis.yml b/.github/workflows/python-analysis.yml new file mode 100644 index 0000000..412d6c7 --- /dev/null +++ b/.github/workflows/python-analysis.yml @@ -0,0 +1,39 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: "PythonAnalysis" + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.11", "3.14"] + + steps: + - uses: actions/checkout@v7 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v7 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pylint pytest mysqlclient + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 --ignore E303,E501,W503 + - name: Test with unittest + run: | + touch config.py + python3 -m unittest api_test.py diff --git a/api.py b/api.py index 9e0a805..3610107 100755 --- a/api.py +++ b/api.py @@ -28,9 +28,9 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) -from permissions.storeConfig import storeConfig -from permissions.checkPrivilege import checkPrivilege -from permissions.sendHistory import sendHistory +from permissions.storeConfig import storeConfig # noqa: E402 +from permissions.checkPrivilege import checkPrivilege # noqa: E402 +from permissions.sendHistory import sendHistory # noqa: E402 # dispatch call: can be diff --git a/hooks/verifymsg.py b/hooks/verifymsg.py index 60c61a4..8279ae2 100755 --- a/hooks/verifymsg.py +++ b/hooks/verifymsg.py @@ -33,7 +33,7 @@ def read_commandline_arguments(self): try: opts, args = getopt.getopt(sys.argv[1:], "", ["url=", "repository=", "msgfile="]) - except: + except Exception: print("Command line: --repository=name --url=https://example.com/postsai/extensions/commitstop/api.py --msgfile=%l") sys.exit(2) diff --git a/permissions/checkPrivilege.py b/permissions/checkPrivilege.py index 21b3aa6..1a0b99f 100644 --- a/permissions/checkPrivilege.py +++ b/permissions/checkPrivilege.py @@ -26,11 +26,11 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) try: - from permissions.configDb import fetchLatestConfig + from permissions.configDb import fetchLatestConfig # noqa: E40 except ImportError: pass -from permissions.response import ret403, ret200 +from permissions.response import ret403, ret200 # noqa: E40 def matchesPattern(name, pattern): diff --git a/permissions/storeConfig.py b/permissions/storeConfig.py index 61615a6..ce10a86 100644 --- a/permissions/storeConfig.py +++ b/permissions/storeConfig.py @@ -24,11 +24,11 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) -import config +import config # noqa: E40 -from permissions.configDb import writeConfigToDB -from permissions.checkPrivilege import checkLinesSyntax -from permissions.response import ret403 +from permissions.configDb import writeConfigToDB # noqa: E40 +from permissions.checkPrivilege import checkLinesSyntax # noqa: E40 +from permissions.response import ret403 # noqa: E40 def storeConfig(arguments):