docs-e2e.workflow.template.yml•2.09 kB
# Generated by DocuMCP - Documentation E2E Testing Workflow
name: Documentation E2E Tests
on:
push:
branches: [{ { mainBranch } }]
pull_request:
branches: [{ { mainBranch } }]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: npm ci
- name: Build documentation
run: { { buildCommand } }
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: docs-build
path: { { buildDir } }
test:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
browser: [chromium, firefox, webkit]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: docs-build
path: { { buildDir } }
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install Playwright
run: |
npm ci
npx playwright install --with-deps ${{ matrix.browser }}
- name: Run E2E tests
run: npx playwright test --project=${{ matrix.browser }}
env:
BASE_URL: http://localhost:{{port}}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report-${{ matrix.browser }}
path: playwright-report/
deploy:
runs-on: ubuntu-latest
needs: [build, test]
if: github.ref == 'refs/heads/{{mainBranch}}' && github.event_name == 'push'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/download-artifact@v4
with:
name: docs-build
path: .
- uses: actions/upload-pages-artifact@v3
with:
path: .
- id: deployment
uses: actions/deploy-pages@v4