Files
admin-frontend-domain/.github/workflows/e2e.yml
T
dependabot[bot] 1589fe6a4c chore(deps): bump the github-actions group with 8 updates (#160)
Bumps the github-actions group with 8 updates:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `4` | `6` |
| [oven-sh/setup-bun](https://github.com/oven-sh/setup-bun) | `1` | `2` |
| [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) | `5` | `7` |
| [actions/github-script](https://github.com/actions/github-script) | `7` | `9` |
| [actions/setup-node](https://github.com/actions/setup-node) | `4` | `6` |
| [actions/setup-go](https://github.com/actions/setup-go) | `5` | `6` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `4` | `7` |
| [softprops/action-gh-release](https://github.com/softprops/action-gh-release) | `2` | `3` |


Updates `actions/checkout` from 4 to 6
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v6)

Updates `oven-sh/setup-bun` from 1 to 2
- [Release notes](https://github.com/oven-sh/setup-bun/releases)
- [Commits](https://github.com/oven-sh/setup-bun/compare/v1...v2)

Updates `stefanzweifel/git-auto-commit-action` from 5 to 7
- [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases)
- [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stefanzweifel/git-auto-commit-action/compare/v5...v7)

Updates `actions/github-script` from 7 to 9
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v7...v9)

Updates `actions/setup-node` from 4 to 6
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v4...v6)

Updates `actions/setup-go` from 5 to 6
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v5...v6)

Updates `actions/upload-artifact` from 4 to 7
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v7)

Updates `softprops/action-gh-release` from 2 to 3
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: oven-sh/setup-bun
  dependency-version: '2'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: stefanzweifel/git-auto-commit-action
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/github-script
  dependency-version: '9'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/setup-node
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/setup-go
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: softprops/action-gh-release
  dependency-version: '3'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-06 08:15:40 +08:00

132 lines
3.6 KiB
YAML

name: E2E
on:
push:
branches:
- main
paths:
- "src/**"
- "tests/e2e/**"
- "playwright.config.ts"
- "package.json"
- "package-lock.json"
- ".github/workflows/e2e.yml"
pull_request:
branches:
- main
jobs:
playwright:
runs-on: ubuntu-latest
timeout-minutes: 25
env:
NEZHA_REPO: nezhahq/nezha
NEZHA_REF: master
NZ_LISTENHOST: 127.0.0.1
NZ_LISTENPORT: "8008"
NZ_AGENTSECRETKEY: e2e-agent-secret-32-bytes-long-ok
NZ_JWTSECRETKEY: e2e-jwt-secret-key-min-32-chars-long-ok
NZ_SITENAME: nezha-e2e
NZ_DEBUG: "true"
E2E_ADMIN_USER: admin
E2E_ADMIN_PASS: admin
E2E_BASE_URL: http://127.0.0.1:5173
steps:
- name: Checkout admin-frontend
uses: actions/checkout@v6
with:
path: admin-frontend
- name: Checkout nezha backend
uses: actions/checkout@v6
with:
repository: ${{ env.NEZHA_REPO }}
ref: ${{ env.NEZHA_REF }}
path: nezha
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 20
cache: npm
cache-dependency-path: admin-frontend/package-lock.json
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: "1.26.x"
cache-dependency-path: nezha/go.sum
- name: Install frontend dependencies
working-directory: admin-frontend
run: npm ci
- name: Install Playwright browsers
working-directory: admin-frontend
run: npx playwright install --with-deps chromium
- name: Prepare backend stubs (dist + swagger docs)
working-directory: nezha
run: |
mkdir -p cmd/dashboard/admin-dist cmd/dashboard/user-dist
printf '<!doctype html><title>admin e2e</title>\n' > cmd/dashboard/admin-dist/index.html
printf '<!doctype html><title>user e2e</title>\n' > cmd/dashboard/user-dist/index.html
go install github.com/swaggo/swag/cmd/swag@latest
"$(go env GOPATH)/bin/swag" init --pd -d cmd/dashboard -g main.go -o cmd/dashboard/docs
go build -o /tmp/nezha-dashboard ./cmd/dashboard
- name: Start backend
working-directory: nezha
env:
GIN_MODE: release
run: |
mkdir -p data
nohup /tmp/nezha-dashboard -c data/config.yaml -db data/sqlite.db \
> /tmp/dashboard.log 2>&1 &
echo $! > /tmp/dashboard.pid
- name: Wait for backend health
run: |
for i in {1..60}; do
if curl -fsS http://127.0.0.1:8008/api/v1/setting > /dev/null; then
echo "backend is up"
exit 0
fi
sleep 1
done
echo "backend failed to start within 60s"
echo "---- dashboard.log ----"
cat /tmp/dashboard.log || true
exit 1
- name: Run Playwright tests
working-directory: admin-frontend
env:
CI: "true"
run: npm run e2e
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v7
with:
name: playwright-report
path: admin-frontend/playwright-report
retention-days: 14
- name: Upload dashboard log
if: always()
uses: actions/upload-artifact@v7
with:
name: dashboard-log
path: /tmp/dashboard.log
retention-days: 7
- name: Stop backend
if: always()
run: |
if [ -f /tmp/dashboard.pid ]; then
kill "$(cat /tmp/dashboard.pid)" || true
fi