Playwright sharding demo #23
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: Playwright Tests | |
| # on: | |
| # push: | |
| # branches: [ main ] | |
| # pull_request: | |
| # branches: [ main ] | |
| # jobs: | |
| # playwright-tests: | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - name: Checkout code | |
| # uses: actions/checkout@v4 | |
| # - name: Setup Node.js | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: 18 | |
| # - name: Install dependencies | |
| # run: npm ci | |
| # - name: Install Playwright browsers | |
| # run: npx playwright install --with-deps | |
| # - name: Run Playwright tests | |
| # run: npx playwright test | |
| # name: Playwright Tests | |
| # on: | |
| # push: | |
| # branches: [ main ] | |
| # pull_request: | |
| # branches: [ main ] | |
| # jobs: | |
| # playwright-tests: | |
| # runs-on: ubuntu-latest | |
| # strategy: | |
| # matrix: | |
| # shard: [1, 2, 3, 4] | |
| # steps: | |
| # - name: Checkout code | |
| # uses: actions/checkout@v4 | |
| # - name: Setup Node.js | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: 18 | |
| # - name: Install dependencies | |
| # run: npm ci | |
| # - name: Install Playwright browsers | |
| # run: npx playwright install --with-deps | |
| # - name: Run Playwright tests (Shard ${{ matrix.shard }}) | |
| # run: npx playwright test --shard=${{ matrix.shard }}/4 | |
| name: Playwright Tests with Allure Report | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| playwright-tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1, 2, 3, 4] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install Playwright browsers | |
| run: npx playwright install --with-deps | |
| - name: Run Playwright tests (Shard ${{ matrix.shard }}) | |
| run: npx playwright test --shard=${{ matrix.shard }}/4 | |
| - name: Upload Allure results (Shard ${{ matrix.shard }}) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: allure-results-shard-${{ matrix.shard }} | |
| path: allure-results | |
| merge-allure-report: | |
| needs: playwright-tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| - name: Install Allure CLI | |
| run: npm install -g allure-commandline | |
| - name: Download all Allure results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: allure-results | |
| - name: Merge Allure results | |
| run: | | |
| mkdir merged-results | |
| find allure-results -type f -exec cp {} merged-results \; | |
| - name: Generate final Allure report | |
| run: allure generate merged-results --clean -o allure-report | |
| - name: Upload final Allure report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: allure-report-final | |
| path: allure-report |