Files
taxbaik/.gitea/workflows/browser-e2e.yml
T
kjh2064 58ec984f41
TaxBaik CI/CD / build-and-deploy (push) Successful in 58s
ci: output version info as JSON format and update e2e parser
2026-06-28 01:03:52 +09:00

80 lines
2.6 KiB
YAML

name: TaxBaik Browser E2E
on:
workflow_run:
workflows: ["TaxBaik CI/CD"]
types:
- completed
jobs:
browser-e2e:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-playwright-
- name: Install Playwright dependencies
run: |
set -e
npm ci
npx playwright install chromium --with-deps
- name: Wait for deployment
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
EXPECTED_VERSION: ${{ github.event.workflow_run.head_sha }}
run: |
set -e
# Extract short commit hash (first 7 characters)
SHORT_VERSION=$(echo "$EXPECTED_VERSION" | cut -c1-7)
echo "Expected short version: $SHORT_VERSION"
for i in $(seq 1 30); do
# Suppress stderr and allow failures to handle transition/down periods cleanly
VERSION_BODY="$(curl -fsS "http://${DEPLOY_HOST}/taxbaik/version.json" 2>/dev/null || true)"
BLOG_STATUS="$(curl -s -o /dev/null -w '%{http_code}' "http://${DEPLOY_HOST}/taxbaik/blog/accountant-mistakes-5" || true)"
if echo "$VERSION_BODY" | grep -q "\"version\": \"${SHORT_VERSION}\"" && [ "$BLOG_STATUS" = "200" ]; then
echo "Deployment is ready for ${SHORT_VERSION}"
exit 0
fi
echo "Waiting for deployment ${SHORT_VERSION} (attempt $i/30); blog status=${BLOG_STATUS:-down}; version=${VERSION_BODY:-unknown}"
sleep 5
done
echo "Deployment did not publish expected version ${SHORT_VERSION} in time" >&2
exit 1
- name: Browser E2E verification
env:
E2E_BASE_URL: http://${{ secrets.DEPLOY_HOST }}/taxbaik
E2E_ADMIN_USERNAME: admin
E2E_ADMIN_PASSWORD: ${{ secrets.TAXBAIK_ADMIN_TEST_PASSWORD }}
run: npm run test:e2e
- name: Browser E2E summary
if: always()
run: |
echo "Executed tests:"
echo "- admin-login"
echo "- admin-smoke"
echo "- public-smoke"
echo "- blog-seo"
echo "- contact-submit"
echo "- inquiry-detail"
echo "- admin-password-change"