diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 861e640..32ca473 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -5,7 +5,7 @@ on: pull_request: concurrency: group: rice-pk-xhs-production - cancel-in-progress: false + cancel-in-progress: true jobs: verify-deploy: runs-on: ubuntu-latest @@ -22,7 +22,7 @@ jobs: env: { SOURCE_TOKEN: "${{ secrets.GITEA_TOKEN || gitea.token }}" } run: | set -eu - apk add --no-cache python3 nodejs npm curl + apk add --no-cache python3 curl python3 - <<'PY' import io,os,shutil,tarfile,tempfile,urllib.request from pathlib import Path @@ -34,7 +34,7 @@ jobs: roots=list(Path(d).iterdir());shutil.copytree(roots[0],Path.cwd(),dirs_exist_ok=True) PY - name: Check source and preview - run: npm run check + run: python3 scripts/check.py - name: Build preview image run: docker build -t "rice-pk-xhs:$SOURCE_REVISION" . - name: Update permanent preview container diff --git a/scripts/check.py b/scripts/check.py new file mode 100644 index 0000000..dedf7e1 --- /dev/null +++ b/scripts/check.py @@ -0,0 +1,18 @@ +import json +from pathlib import Path + +required = [ + "app.js", + "app.json", + "pages/index/index.xhsml", + "pages/test/test.js", + "pages/result/result.js", + "web/index.html", + "web/app.js", +] +missing = [name for name in required if not Path(name).is_file()] +if missing: + raise SystemExit("Missing required files: " + ", ".join(missing)) + +json.loads(Path("app.json").read_text()) +print(f"Static checks passed ({len(required)} required files).")