skillhub/.github/workflows/pr-e2e.yml
XiaoSeS 9557478dd8 feat(auth): add explicit identity link and safe unlink flow
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-07-31 07:02:17 +08:00

124 lines
3.4 KiB
YAML

name: PR E2E Tests
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
paths:
- 'web/**'
- 'server/**'
- 'scripts/**'
- 'docker-compose.yml'
- 'docker-compose.staging.yml'
- 'Makefile'
- '.github/workflows/pr-e2e.yml'
workflow_dispatch:
concurrency:
group: pr-e2e-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
e2e-tests:
name: E2E (Real Services)
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Verify Kubernetes PostgreSQL data-directory compatibility
run: bash scripts/tests/k8s-postgres-storage-test.sh
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
cache-dependency-path: web/pnpm-lock.yaml
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: maven
- name: Ensure Maven wrapper is executable
run: chmod +x server/mvnw
- name: Verify Binding V2 migration and concurrency on PostgreSQL
run: bash scripts/tests/identity-binding-v2-postgres-test.sh
- name: Start loopback identity provider for Identity Link
run: |
python3 scripts/tests/oauth2-mock-provider.py --port 18081 \
> /tmp/skillhub-oauth2-mock.log 2>&1 &
echo "$!" > /tmp/skillhub-oauth2-mock.pid
for attempt in $(seq 1 30); do
if curl --fail --silent \
http://127.0.0.1:18081/health >/dev/null; then
exit 0
fi
sleep 1
done
exit 1
- name: Start full dev stack
env:
OAUTH2_GITLAB_BASE_URI: http://127.0.0.1:18081
OAUTH2_GITLAB_CLIENT_ID: skillhub-e2e
OAUTH2_GITLAB_CLIENT_SECRET: skillhub-e2e-secret
run: make dev-all
- name: Install Playwright browsers
run: cd web && pnpm exec playwright install --with-deps chromium
- name: Run frontend E2E tests
env:
E2E_IDENTITY_LINK_BROWSER_PROVIDER: gitlab
run: make test-e2e-frontend
- name: Upload Playwright HTML report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: web/playwright-report/
if-no-files-found: warn
retention-days: 30
- name: Upload Playwright raw test results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-test-results
path: web/test-results/
if-no-files-found: warn
retention-days: 14
- name: Stop full dev stack
if: ${{ always() }}
run: make dev-all-down
- name: Stop loopback identity provider
if: ${{ always() }}
run: |
if [[ -f /tmp/skillhub-oauth2-mock.pid ]]; then
kill "$(cat /tmp/skillhub-oauth2-mock.pid)" 2>/dev/null || true
fi