E2E Tests #46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: E2E Tests | |
| # E2E Test Runner for Diplodoc Metapackage | |
| # | |
| # This workflow orchestrates full end-to-end testing of the Diplodoc metapackage: | |
| # 1. Initializes all git submodules to master branch (via submodules: recursive) | |
| # 2. Applies optional branch override to all submodules (via git:apply) | |
| # - If branch exists in a submodule, it will be checked out | |
| # - If branch doesn't exist, submodule stays on master | |
| # 3. Installs all dependencies (npm i) | |
| # 4. Resets node_modules to ensure proper linking (npm run reset -- -u) | |
| # 5. Runs e2e tests from @diplodoc/testpack | |
| # Set custom run name to include trigger_id for reliable tracking | |
| run-name: ${{ inputs.trigger_id && format('E2E Tests [ID:{0}]', inputs.trigger_id) || 'E2E Tests' }} | |
| on: | |
| push: | |
| branches: | |
| - master | |
| # Allow manual trigger with parameters | |
| workflow_dispatch: | |
| inputs: | |
| submodules_override: | |
| description: 'Branch name to checkout in all submodules (e.g., "feature-branch")' | |
| required: false | |
| type: string | |
| default: '' | |
| trigger_id: | |
| description: 'Unique identifier for this trigger (for tracking)' | |
| required: false | |
| type: string | |
| default: '' | |
| # Allow triggering from other repositories (child modules) | |
| workflow_call: | |
| inputs: | |
| submodules_override: | |
| description: 'Branch name to checkout in all submodules (e.g., "feature-branch")' | |
| required: false | |
| type: string | |
| default: '' | |
| trigger_id: | |
| description: 'Unique identifier for this trigger (for tracking)' | |
| required: false | |
| type: string | |
| default: '' | |
| jobs: | |
| e2e-tests: | |
| name: 'Run E2E Tests' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| - name: Install latest npm (>= 11.5.1) | |
| run: | | |
| [ "$(printf '%s\n' "11.5.1" "$(npm -v)" | sort -V | head -n1)" = "11.5.1" ] || npm install -g npm@latest | |
| shell: bash | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| id: playwright-cache | |
| with: | |
| path: | | |
| ~/.cache/ms-playwright | |
| key: ${{ runner.os }}-playwright-stable | |
| restore-keys: | | |
| ${{ runner.os }}-playwright- | |
| - name: Override active branch | |
| if: inputs.submodules_override != '' | |
| run: | | |
| echo "All submodules will attempt to checkout branch ${{ inputs.submodules_override }}" | |
| npm run git:apply -- "${{ inputs.submodules_override }}" | |
| - name: Setup node_modules | |
| run: | | |
| npm i | |
| npm run reset -- -u -q | |
| - name: Build projects | |
| run: npm run build -- --verbose | |
| - name: Link binaries | |
| run: npm i | |
| - name: Run E2E tests | |
| run: npm run test | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: | | |
| devops/testpack/test-results/ | |
| devops/testpack/playwright-report/ | |
| retention-days: 7 | |