05/19 Fix ci.yml
This commit is contained in:
+17
-39
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user