e32d59ca44
- scripts/make-verify-json.js: 산출물 폴더 → extras/assets JSON 생성 - scripts/verify.js: JSON 입력으로 무결성 검증(종료코드 반영) - package.json: verify 스크립트 추가 - .gitea/workflows/ci.yml: ./artifacts/export 존재 시 검증 스텝 실행
95 lines
3.3 KiB
YAML
95 lines
3.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master ]
|
|
pull_request:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: [macos, host]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
|
|
- name: Install deps
|
|
run: npm ci
|
|
|
|
- name: Unit/Component tests (Vitest)
|
|
run: npm test
|
|
env:
|
|
CI: true
|
|
|
|
- name: Install Playwright browsers
|
|
run: npx playwright install --with-deps
|
|
|
|
- name: E2E tests (Playwright)
|
|
run: npm run test:e2e -- --reporter=line
|
|
env:
|
|
CI: true
|
|
|
|
- name: Upload Playwright report
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-report
|
|
path: playwright-report
|
|
if-no-files-found: ignore
|
|
retention-days: 3
|
|
|
|
- name: Verify bundle integrity (optional)
|
|
run: |
|
|
set -euo pipefail
|
|
if [ -d ./artifacts/export ]; then
|
|
echo "Found ./artifacts/export; generating verify inputs"
|
|
npm run verify:make-json
|
|
echo "Running verify CLI"
|
|
npm run verify:run
|
|
else
|
|
echo "No ./artifacts/export; skipping integrity verification"
|
|
fi
|
|
|
|
- name: Auto-merge PR on green
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
env:
|
|
CI_TOKEN: ${{ secrets.CI_TOKEN }}
|
|
GITEA_BASE_URL: https://gitea.jaybe.dev
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
REPO: ${{ github.repository }}
|
|
run: |
|
|
set -euo pipefail
|
|
if [ -z "${CI_TOKEN:-}" ]; then
|
|
echo "CI_TOKEN not set; skipping auto-merge"; exit 0; fi
|
|
OWNER=$(echo "$REPO" | cut -d'/' -f1)
|
|
NAME=$(echo "$REPO" | cut -d'/' -f2)
|
|
echo "Checking labels for PR #$PR_NUMBER on $OWNER/$NAME"
|
|
LABELS_JSON=$(curl -sS -X GET \
|
|
-H "Authorization: token ${CI_TOKEN}" \
|
|
"${GITEA_BASE_URL}/api/v1/repos/${OWNER}/${NAME}/issues/${PR_NUMBER}")
|
|
echo "labels payload (first 200 chars):"; echo "$LABELS_JSON" | cut -c1-200 || true
|
|
if ! echo "$LABELS_JSON" | grep -qi '"name":"automerge"'; then
|
|
echo "Label 'automerge' not present; skipping merge"; exit 0; fi
|
|
echo "Label 'automerge' present; proceeding to merge"
|
|
# ensure PR is open
|
|
PR_JSON=$(curl -sS -X GET \
|
|
-H "Authorization: token ${CI_TOKEN}" \
|
|
"${GITEA_BASE_URL}/api/v1/repos/${OWNER}/${NAME}/pulls/${PR_NUMBER}")
|
|
STATE=$(echo "$PR_JSON" | sed -n 's/.*"state":"\([^"]*\)".*/\1/p')
|
|
echo "PR state: ${STATE:-unknown}"
|
|
if [ "${STATE:-}" != "open" ]; then
|
|
echo "PR state is not open; skipping merge"; exit 0; fi
|
|
echo "Merging PR #$PR_NUMBER for $OWNER/$NAME"
|
|
HTTP_CODE=$(curl -sS -o /tmp/merge_resp.json -w "%{http_code}" -X POST \
|
|
-H "Content-Type: application/json" \
|
|
-H "Authorization: token ${CI_TOKEN}" \
|
|
"${GITEA_BASE_URL}/api/v1/repos/${OWNER}/${NAME}/pulls/${PR_NUMBER}/merge" \
|
|
-d '{"Do":"merge","MergeMessage":"auto-merge: CI green"}' || true)
|
|
echo "merge http: $HTTP_CODE"
|
|
echo "merge resp:"; cat /tmp/merge_resp.json || true
|