05/19 Fix ci.yml
This commit is contained in:
+18
-40
@@ -1,13 +1,15 @@
|
|||||||
# .gitea/workflows/ci.yml
|
# .gitea/workflows/ci.yml
|
||||||
#
|
#
|
||||||
# PassKeeper CI pipeline — runs on every push and pull request.
|
# 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:
|
# Jobs:
|
||||||
# lint-python — flake8 style + error check
|
# lint-python — flake8 style + error check
|
||||||
# syntax-check — ast.parse all Python files (catches import-time errors)
|
# syntax-check — ast.parse all Python files
|
||||||
# migration-check — verify Alembic chain has a single head, no duplicates
|
# migration-check — verify Alembic chain has single head
|
||||||
# js-syntax — node --check on all JS files
|
# js-syntax — node syntax check on all JS files
|
||||||
# build-extension — zip the extension for distribution
|
# build-extension — zip Chrome and Firefox extensions
|
||||||
|
|
||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
@@ -25,13 +27,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: "3.12"
|
|
||||||
|
|
||||||
- name: Install flake8
|
- name: Install flake8
|
||||||
run: pip install flake8
|
run: pip3 install flake8 --quiet
|
||||||
|
|
||||||
- name: Run flake8
|
- name: Run flake8
|
||||||
run: |
|
run: |
|
||||||
@@ -41,18 +38,13 @@ jobs:
|
|||||||
--exclude=__pycache__,migrations \
|
--exclude=__pycache__,migrations \
|
||||||
--statistics
|
--statistics
|
||||||
|
|
||||||
# ── Python syntax (ast.parse — catches broken imports fast) ─────────────────
|
# ── Python syntax ────────────────────────────────────────────────────────────
|
||||||
syntax-check:
|
syntax-check:
|
||||||
name: Python syntax check
|
name: Python syntax check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- 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
|
- name: Check all Python files parse cleanly
|
||||||
run: |
|
run: |
|
||||||
python3 - << 'EOF'
|
python3 - << 'EOF'
|
||||||
@@ -69,25 +61,18 @@ jobs:
|
|||||||
print(f"FAIL: {f}")
|
print(f"FAIL: {f}")
|
||||||
if failures:
|
if failures:
|
||||||
sys.exit(1)
|
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
|
EOF
|
||||||
|
|
||||||
# ── Alembic migration chain check ───────────────────────────────────────────
|
# ── Alembic migration chain ──────────────────────────────────────────────────
|
||||||
migration-check:
|
migration-check:
|
||||||
name: Alembic migration chain
|
name: Alembic migration chain
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Verify single head, no duplicate revisions
|
||||||
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
|
|
||||||
run: |
|
run: |
|
||||||
python3 - << 'EOF'
|
python3 - << 'EOF'
|
||||||
import re, sys, glob
|
import re, sys, glob
|
||||||
@@ -96,8 +81,8 @@ jobs:
|
|||||||
revisions = {}
|
revisions = {}
|
||||||
for f in files:
|
for f in files:
|
||||||
content = open(f).read()
|
content = open(f).read()
|
||||||
rev = re.search(r"revision = '([^']+)'", content)
|
rev = re.search(r"revision = '([^']+)'", content)
|
||||||
down = re.search(r"down_revision = (.+)", content)
|
down = re.search(r"down_revision = (.+)", content)
|
||||||
if rev:
|
if rev:
|
||||||
rid = rev.group(1)
|
rid = rev.group(1)
|
||||||
if rid in revisions:
|
if rid in revisions:
|
||||||
@@ -122,11 +107,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: "20"
|
|
||||||
|
|
||||||
- name: Check JS files parse cleanly
|
- name: Check JS files parse cleanly
|
||||||
run: |
|
run: |
|
||||||
FAILED=0
|
FAILED=0
|
||||||
@@ -143,7 +123,6 @@ jobs:
|
|||||||
extension/bridge/bridge.js \
|
extension/bridge/bridge.js \
|
||||||
extension/shared/crypto.js; do
|
extension/shared/crypto.js; do
|
||||||
if [ -f "$f" ]; then
|
if [ -f "$f" ]; then
|
||||||
node --input-type=module < "$f" 2>/dev/null || \
|
|
||||||
node -e "new Function(require('fs').readFileSync('$f','utf8'))" 2>/dev/null || \
|
node -e "new Function(require('fs').readFileSync('$f','utf8'))" 2>/dev/null || \
|
||||||
{ echo "FAIL: $f"; FAILED=1; }
|
{ echo "FAIL: $f"; FAILED=1; }
|
||||||
fi
|
fi
|
||||||
@@ -166,12 +145,11 @@ jobs:
|
|||||||
--exclude "*.bak" \
|
--exclude "*.bak" \
|
||||||
--exclude "manifest.firefox.json" \
|
--exclude "manifest.firefox.json" \
|
||||||
--exclude "background.firefox.js"
|
--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
|
- name: Build Firefox extension
|
||||||
run: |
|
run: |
|
||||||
cd extension
|
cd extension
|
||||||
# Swap manifests for Firefox build
|
|
||||||
cp manifest.json manifest.chrome.json
|
cp manifest.json manifest.chrome.json
|
||||||
cp manifest.firefox.json manifest.json
|
cp manifest.firefox.json manifest.json
|
||||||
zip -r ../passkeeper-extension-firefox.zip . \
|
zip -r ../passkeeper-extension-firefox.zip . \
|
||||||
@@ -179,7 +157,7 @@ jobs:
|
|||||||
--exclude "manifest.chrome.json" \
|
--exclude "manifest.chrome.json" \
|
||||||
--exclude "background.js"
|
--exclude "background.js"
|
||||||
mv manifest.chrome.json manifest.json
|
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
|
- name: Upload Chrome extension artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
@@ -193,4 +171,4 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: passkeeper-extension-firefox
|
name: passkeeper-extension-firefox
|
||||||
path: passkeeper-extension-firefox.zip
|
path: passkeeper-extension-firefox.zip
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
Reference in New Issue
Block a user