From 55f3629c379162106e60e0cf3549bdf8949ca360 Mon Sep 17 00:00:00 2001 From: NguyenND Date: Tue, 19 May 2026 11:07:42 -0400 Subject: [PATCH] 05/19 Fix ci.yml --- .gitea/workflows/ci.yml | 58 +++++++++++++---------------------------- 1 file changed, 18 insertions(+), 40 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 8fc472c..5e6602e 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,13 +1,15 @@ # .gitea/workflows/ci.yml # # PassKeeper CI pipeline — runs on every push and pull request. +# Designed for a self-hosted host-mode runner (no Docker required). +# Requires on the host: python3, pip3, node, zip # # Jobs: -# lint-python — flake8 style + error check -# syntax-check — ast.parse all Python files (catches import-time errors) -# migration-check — verify Alembic chain has a single head, no duplicates -# js-syntax — node --check on all JS files -# build-extension — zip the extension for distribution +# lint-python — flake8 style + error check +# syntax-check — ast.parse all Python files +# migration-check — verify Alembic chain has single head +# js-syntax — node syntax check on all JS files +# build-extension — zip Chrome and Firefox extensions name: CI @@ -25,13 +27,8 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.12" - - name: Install flake8 - run: pip install flake8 + run: pip3 install flake8 --quiet - name: Run flake8 run: | @@ -41,18 +38,13 @@ jobs: --exclude=__pycache__,migrations \ --statistics - # ── Python syntax (ast.parse — catches broken imports fast) ───────────────── + # ── Python syntax ──────────────────────────────────────────────────────────── syntax-check: name: Python syntax check runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.12" - - name: Check all Python files parse cleanly run: | python3 - << 'EOF' @@ -69,25 +61,18 @@ jobs: print(f"FAIL: {f}") if failures: sys.exit(1) - print(f"OK: {len(list(pathlib.Path('app').rglob('*.py')))} Python files parsed cleanly") + count = len(list(pathlib.Path('app').rglob('*.py'))) + print(f"OK: {count} Python files parsed cleanly") EOF - # ── Alembic migration chain check ─────────────────────────────────────────── + # ── Alembic migration chain ────────────────────────────────────────────────── migration-check: name: Alembic migration chain runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.12" - - - name: Install alembic - run: pip install alembic - - - name: Verify single head, linear chain, no duplicate revisions + - name: Verify single head, no duplicate revisions run: | python3 - << 'EOF' import re, sys, glob @@ -96,8 +81,8 @@ jobs: revisions = {} for f in files: content = open(f).read() - rev = re.search(r"revision = '([^']+)'", content) - down = re.search(r"down_revision = (.+)", content) + rev = re.search(r"revision = '([^']+)'", content) + down = re.search(r"down_revision = (.+)", content) if rev: rid = rev.group(1) if rid in revisions: @@ -122,11 +107,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Node - uses: actions/setup-node@v3 - with: - node-version: "20" - - name: Check JS files parse cleanly run: | FAILED=0 @@ -143,7 +123,6 @@ jobs: extension/bridge/bridge.js \ extension/shared/crypto.js; do if [ -f "$f" ]; then - node --input-type=module < "$f" 2>/dev/null || \ node -e "new Function(require('fs').readFileSync('$f','utf8'))" 2>/dev/null || \ { echo "FAIL: $f"; FAILED=1; } fi @@ -166,12 +145,11 @@ jobs: --exclude "*.bak" \ --exclude "manifest.firefox.json" \ --exclude "background.firefox.js" - echo "Chrome extension: $(du -sh ../passkeeper-extension-chrome.zip | cut -f1)" + echo "Chrome: $(du -sh ../passkeeper-extension-chrome.zip | cut -f1)" - name: Build Firefox extension run: | cd extension - # Swap manifests for Firefox build cp manifest.json manifest.chrome.json cp manifest.firefox.json manifest.json zip -r ../passkeeper-extension-firefox.zip . \ @@ -179,7 +157,7 @@ jobs: --exclude "manifest.chrome.json" \ --exclude "background.js" mv manifest.chrome.json manifest.json - echo "Firefox extension: $(du -sh ../passkeeper-extension-firefox.zip | cut -f1)" + echo "Firefox: $(du -sh ../passkeeper-extension-firefox.zip | cut -f1)" - name: Upload Chrome extension artifact uses: actions/upload-artifact@v3 @@ -193,4 +171,4 @@ jobs: with: name: passkeeper-extension-firefox path: passkeeper-extension-firefox.zip - retention-days: 30 + retention-days: 30 \ No newline at end of file