From 30184161314239e052c0d02e6bf931cc982b690f Mon Sep 17 00:00:00 2001 From: Hussam Ghazzi Date: Tue, 28 Jan 2025 07:24:39 -0500 Subject: [PATCH 1/3] =?UTF-8?q?Revert=20"Revert=20"Add=20landing=20page=20?= =?UTF-8?q?and=20upload=20vrt/aat=20reports=20to=20GitHub=20Pages=20(?= =?UTF-8?q?=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 16147555c4eb5abed206f7a39429e4f760545a5e. --- .github/workflows/aat-reports.yml | 173 ++++++++++++ .github/workflows/ci.yml | 296 --------------------- .github/workflows/deploy_preview.yml | 164 +++++++++++- .github/workflows/deploy_preview_forks.yml | 33 ++- .github/workflows/vrt-reports.yml | 173 ++++++++++++ packages/react/.storybook/index.html | 25 ++ script/build-storybook | 5 +- 7 files changed, 565 insertions(+), 304 deletions(-) create mode 100644 .github/workflows/aat-reports.yml create mode 100644 .github/workflows/vrt-reports.yml create mode 100644 packages/react/.storybook/index.html diff --git a/.github/workflows/aat-reports.yml b/.github/workflows/aat-reports.yml new file mode 100644 index 00000000000..1b5194137fb --- /dev/null +++ b/.github/workflows/aat-reports.yml @@ -0,0 +1,173 @@ +name: AAT Reports +on: + push: + branches: + - main + - next-major + workflow_call: + outputs: + aat-all-flags: + value: ${{ jobs.aat-all-flags.result }} + aat-no-flag: + value: ${{ jobs.aat.result }} + merge_group: + branches: + - main + - next-major + types: + - checks_requested + +concurrency: + group: aat-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + aat-runner: + runs-on: ubuntu-latest-16-cores + strategy: + fail-fast: false + matrix: + shard: [1, 2, 3, 4] + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'npm' + - name: Install dependencies + run: npm ci + - name: Build storybook + run: npx storybook build + working-directory: packages/react + - name: Run storybook + id: storybook + working-directory: packages/react + run: | + npx serve -l 6006 storybook-static & + pid=$! + echo "pid=$pid" >> $GITHUB_OUTPUT + sleep 5 + - name: Run AAT + uses: docker://mcr.microsoft.com/playwright:v1.47.2-jammy + env: + STORYBOOK_URL: 'http://172.17.0.1:6006' + with: + args: npx playwright test --grep @aat --shard="${{ matrix.shard }}/${{ strategy.job-total }}" + - name: Stop storybook + run: kill ${{ steps.storybook.outputs.pid }} + - name: Upload report + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: axe-no-flag-${{ matrix.shard }} + path: blob-report + retention-days: 1 + + aat: + if: ${{ always() }} + runs-on: ubuntu-latest + needs: aat-runner + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'npm' + - name: install dependencies + run: npm ci + - name: download all reports + uses: actions/download-artifact@v4 + with: + path: all-blob-reports + pattern: axe-no-flag-* + merge-multiple: true + - name: merge all reports + run: npx playwright merge-reports --reporter html ./all-blob-reports + - name: Upload report + uses: actions/upload-artifact@v4 + with: + name: axe + path: playwright-report + - name: Check aat-runner job status + if: ${{ needs.aat-runner.result == 'failure' }} + continue-on-error: true + run: exit 1 + + aat-runner-all-flags: + runs-on: ubuntu-latest-16-cores + strategy: + fail-fast: false + matrix: + shard: [1, 2, 3, 4] + env: + VITE_PRIMER_REACT_CSS_MODULES_TEAM: 1 + VITE_PRIMER_REACT_CSS_MODULES_STAFF: 1 + VITE_PRIMER_REACT_CSS_MODULES_GA: 1 + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'npm' + - name: Install dependencies + run: npm ci + - name: Build storybook + run: npx storybook build + working-directory: packages/react + - name: Run storybook + id: storybook + working-directory: packages/react + run: | + npx serve -l 6006 storybook-static & + pid=$! + echo "pid=$pid" >> $GITHUB_OUTPUT + sleep 5 + - name: Run AAT + uses: docker://mcr.microsoft.com/playwright:v1.47.2-jammy + env: + STORYBOOK_URL: 'http://172.17.0.1:6006' + with: + args: npx playwright test --grep @aat --shard="${{ matrix.shard }}/${{ strategy.job-total }}" + - name: Stop storybook + run: kill ${{ steps.storybook.outputs.pid }} + - name: Upload report + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: axe-all-flags-${{ matrix.shard }} + path: blob-report + retention-days: 1 + + aat-all-flags: + if: ${{ always() }} + runs-on: ubuntu-latest + needs: aat-runner-all-flags + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'npm' + - name: install dependencies + run: npm ci + - name: download all reports + uses: actions/download-artifact@v4 + with: + path: all-blob-reports + pattern: axe-all-flags-* + merge-multiple: true + - name: merge all reports + run: npx playwright merge-reports --reporter html ./all-blob-reports + - name: Upload report + uses: actions/upload-artifact@v4 + with: + name: axe-all-flags + path: playwright-report + - name: Check aat-runner-all-flags job status + if: ${{ needs.aat-runner-all-flags.result == 'failure' }} + continue-on-error: true + run: exit 1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dcda667caba..f6f984ae536 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,302 +100,6 @@ jobs: - name: Build run: npm run build -ws --if-present - vrt-runner: - runs-on: ubuntu-latest-16-cores - strategy: - fail-fast: false - matrix: - shard: [1, 2, 3, 4] - steps: - - uses: actions/checkout@v4 - - name: Use Node.js 20.x - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: 'npm' - - name: Install dependencies - run: npm ci - - name: Build storybook - run: npx storybook build - working-directory: packages/react - - name: Run storybook - id: storybook - working-directory: packages/react - run: | - npx serve -l 6006 storybook-static & - pid=$! - echo "pid=$pid" >> $GITHUB_OUTPUT - sleep 5 - - name: Run VRT - uses: docker://mcr.microsoft.com/playwright:v1.47.2-jammy - env: - STORYBOOK_URL: 'http://172.17.0.1:6006' - with: - args: npx playwright test --grep @vrt --shard="${{ matrix.shard }}/${{ strategy.job-total }}" - - name: Stop storybook - run: kill ${{ steps.storybook.outputs.pid }} - - name: Upload report - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: vrt-no-flag-${{ matrix.shard }} - path: blob-report - retention-days: 1 - - vrt: - if: ${{ always() }} - runs-on: ubuntu-latest - needs: vrt-runner - steps: - - uses: actions/checkout@v4 - - name: Use Node.js 20.x - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: 'npm' - - name: install dependencies - run: npm ci - - name: download all reports - uses: actions/download-artifact@v4 - with: - path: all-blob-reports - pattern: vrt-no-flag-* - merge-multiple: true - - name: merge all reports - run: npx playwright merge-reports --reporter html ./all-blob-reports - - name: Upload report - uses: actions/upload-artifact@v4 - with: - name: vrt-no-flag - path: playwright-report - - name: check vrt-runner job status - if: ${{ needs.vrt-runner.result == 'failure' }} - run: exit 1 - - vrt-runner-all-flags: - runs-on: ubuntu-latest-16-cores - strategy: - fail-fast: false - matrix: - shard: [1, 2, 3, 4] - env: - VITE_PRIMER_REACT_CSS_MODULES_TEAM: 1 - VITE_PRIMER_REACT_CSS_MODULES_STAFF: 1 - VITE_PRIMER_REACT_CSS_MODULES_GA: 1 - steps: - - uses: actions/checkout@v4 - - name: Use Node.js 20.x - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: 'npm' - - name: Install dependencies - run: npm ci - - name: Build storybook - run: npx storybook build - working-directory: packages/react - - name: Run storybook - id: storybook - working-directory: packages/react - run: | - npx serve -l 6006 storybook-static & - pid=$! - echo "pid=$pid" >> $GITHUB_OUTPUT - sleep 5 - - name: Run VRT - uses: docker://mcr.microsoft.com/playwright:v1.47.2-jammy - env: - STORYBOOK_URL: 'http://172.17.0.1:6006' - with: - args: npx playwright test --grep @vrt --shard="${{ matrix.shard }}/${{ strategy.job-total }}" - - name: Stop storybook - run: kill ${{ steps.storybook.outputs.pid }} - - name: Upload report - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: vrt-all-flags-${{ matrix.shard }} - path: blob-report - retention-days: 1 - - vrt-all-flags: - if: ${{ always() }} - runs-on: ubuntu-latest - needs: vrt-runner-all-flags - steps: - - uses: actions/checkout@v4 - - name: Use Node.js 20.x - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: 'npm' - - name: install dependencies - run: npm ci - - name: download all reports - uses: actions/download-artifact@v4 - with: - path: all-blob-reports - pattern: vrt-all-flags-* - merge-multiple: true - - name: merge all reports - run: npx playwright merge-reports --reporter html ./all-blob-reports - - name: Upload report - uses: actions/upload-artifact@v4 - with: - name: vrt-all-flags - path: playwright-report - - name: check vrt-runner-all-flags job status - if: ${{ needs.vrt-runner-all-flags.result == 'failure' }} - run: exit 1 - - aat-runner: - runs-on: ubuntu-latest-16-cores - strategy: - fail-fast: false - matrix: - shard: [1, 2, 3, 4] - steps: - - uses: actions/checkout@v4 - - name: Use Node.js 20.x - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: 'npm' - - name: Install dependencies - run: npm ci - - name: Build storybook - run: npx storybook build - working-directory: packages/react - - name: Run storybook - id: storybook - working-directory: packages/react - run: | - npx serve -l 6006 storybook-static & - pid=$! - echo "pid=$pid" >> $GITHUB_OUTPUT - sleep 5 - - name: Run AAT - uses: docker://mcr.microsoft.com/playwright:v1.47.2-jammy - env: - STORYBOOK_URL: 'http://172.17.0.1:6006' - with: - args: npx playwright test --grep @aat --shard="${{ matrix.shard }}/${{ strategy.job-total }}" - - name: Stop storybook - run: kill ${{ steps.storybook.outputs.pid }} - - name: Upload report - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: axe-no-flag-${{ matrix.shard }} - path: blob-report - retention-days: 1 - - aat: - if: ${{ always() }} - runs-on: ubuntu-latest - needs: aat-runner - steps: - - uses: actions/checkout@v4 - - name: Use Node.js 20.x - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: 'npm' - - name: install dependencies - run: npm ci - - name: download all reports - uses: actions/download-artifact@v4 - with: - path: all-blob-reports - pattern: axe-no-flag-* - merge-multiple: true - - name: merge all reports - run: npx playwright merge-reports --reporter html ./all-blob-reports - - name: Upload report - uses: actions/upload-artifact@v4 - with: - name: axe - path: playwright-report - - name: Check aat-runner job status - if: ${{ needs.aat-runner.result == 'failure' }} - run: exit 1 - - aat-runner-all-flags: - runs-on: ubuntu-latest-16-cores - strategy: - fail-fast: false - matrix: - shard: [1, 2, 3, 4] - env: - VITE_PRIMER_REACT_CSS_MODULES_TEAM: 1 - VITE_PRIMER_REACT_CSS_MODULES_STAFF: 1 - VITE_PRIMER_REACT_CSS_MODULES_GA: 1 - steps: - - uses: actions/checkout@v4 - - name: Use Node.js 20.x - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: 'npm' - - name: Install dependencies - run: npm ci - - name: Build storybook - run: npx storybook build - working-directory: packages/react - - name: Run storybook - id: storybook - working-directory: packages/react - run: | - npx serve -l 6006 storybook-static & - pid=$! - echo "pid=$pid" >> $GITHUB_OUTPUT - sleep 5 - - name: Run AAT - uses: docker://mcr.microsoft.com/playwright:v1.47.2-jammy - env: - STORYBOOK_URL: 'http://172.17.0.1:6006' - with: - args: npx playwright test --grep @aat --shard="${{ matrix.shard }}/${{ strategy.job-total }}" - - name: Stop storybook - run: kill ${{ steps.storybook.outputs.pid }} - - name: Upload report - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: axe-all-flags-${{ matrix.shard }} - path: blob-report - retention-days: 1 - - aat-all-flags: - if: ${{ always() }} - runs-on: ubuntu-latest - needs: aat-runner-all-flags - steps: - - uses: actions/checkout@v4 - - name: Use Node.js 20.x - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: 'npm' - - name: install dependencies - run: npm ci - - name: download all reports - uses: actions/download-artifact@v4 - with: - path: all-blob-reports - pattern: axe-all-flags-* - merge-multiple: true - - name: merge all reports - run: npx playwright merge-reports --reporter html ./all-blob-reports - - name: Upload report - uses: actions/upload-artifact@v4 - with: - name: axe-all-flags - path: playwright-report - - name: Check aat-runner-all-flags job status - if: ${{ needs.aat-runner-all-flags.result == 'failure' }} - run: exit 1 - build-components-json: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/deploy_preview.yml b/.github/workflows/deploy_preview.yml index 92196d8130a..e389ee04a1a 100644 --- a/.github/workflows/deploy_preview.yml +++ b/.github/workflows/deploy_preview.yml @@ -7,9 +7,19 @@ concurrency: cancel-in-progress: true jobs: - build: + vrt-reports: + if: ${{ github.event.pull_request.head.repo.full_name == 'primer/react' }} + uses: ./.github/workflows/vrt-reports.yml + + aat-reports: if: ${{ github.event.pull_request.head.repo.full_name == 'primer/react' }} + uses: ./.github/workflows/aat-reports.yml + + build: + if: ${{ always() && github.event.pull_request.head.repo.full_name == 'primer/react' }} + needs: [vrt-reports, aat-reports] runs-on: ubuntu-latest + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -22,13 +32,33 @@ jobs: run: npm ci - name: Build docs preview run: npm run build:docs:preview + - name: Download VRT reports (All flags enabled) + uses: actions/download-artifact@v4 + with: + name: vrt-all-flags + path: docs/public/vrt-all-flags + - name: Download VRT reports (No flags enabled) + uses: actions/download-artifact@v4 + with: + name: vrt-no-flag + path: docs/public/vrt-no-flag + - name: Download AAT reports (All flags enabled) + uses: actions/download-artifact@v4 + with: + name: axe-all-flags + path: docs/public/aat-all-flags + - name: Download AAT reports (No flags enabled) + uses: actions/download-artifact@v4 + with: + name: axe + path: docs/public/aat-no-flag - uses: actions/upload-pages-artifact@v3 with: name: github-pages path: docs/public deploy-preview: - if: ${{ github.event.pull_request.head.repo.full_name == 'primer/react' }} + if: ${{ always() && github.event.pull_request.head.repo.full_name == 'primer/react' }} needs: build permissions: pages: write @@ -48,7 +78,7 @@ jobs: deploy-storybook: name: Preview Storybook - if: ${{ github.event.pull_request.head.repo.full_name == 'primer/react' }} + if: ${{ always() && github.event.pull_request.head.repo.full_name == 'primer/react' }} needs: deploy-preview permissions: deployments: write @@ -60,13 +90,13 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} environment: storybook-preview-${{ github.event.number }} - environment_url: '${{ needs.deploy-preview.outputs.deployment_url }}/storybook' + environment-url: '${{ needs.deploy-preview.outputs.deployment_url }}storybook' - name: Update storybook deployment status (success) if: success() uses: chrnorm/deployment-status@v2.0.3 with: token: ${{ secrets.GITHUB_TOKEN }} - environment-url: '${{ needs.deploy-preview.outputs.deployment_url }}/storybook' + environment-url: '${{ needs.deploy-preview.outputs.deployment_url }}storybook' state: 'success' deployment-id: ${{ steps.storybook.outputs.deployment_id }} - name: Update storybook deployment status (failure) @@ -76,3 +106,127 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} state: 'failure' deployment-id: ${{ steps.storybook.outputs.deployment_id }} + + # deploy-vrt-no-flag: + # name: VRT (No flags enabled) + # if: ${{ always() && github.event.pull_request.head.repo.full_name == 'primer/react' }} + # needs: [deploy-preview] + # permissions: + # deployments: write + # runs-on: ubuntu-latest + # steps: + # - uses: chrnorm/deployment-action@v2.0.7 + # name: Create GitHub deployment for vrt-no-flag + # id: vrt-no-flag + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # environment: vrt-no-flag-${{ github.event.number }} + # environment-url: '${{ needs.deploy-preview.outputs.deployment_url }}vrt-no-flag' + # - name: Update vrt-no-flag deployment status (success) + # if: success() + # uses: chrnorm/deployment-status@v2.0.3 + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # environment-url: '${{ needs.deploy-preview.outputs.deployment_url }}vrt-no-flag' + # state: 'success' + # deployment-id: ${{ steps.vrt-no-flag.outputs.deployment_id }} + # - name: Update vrt-no-flag deployment status (failure) + # if: failure() + # uses: chrnorm/deployment-status@v2.0.3 + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # state: 'failure' + # deployment-id: ${{ steps.vrt-no-flag.outputs.deployment_id }} + + # deploy-vrt-all-flags: + # name: VRT (All flags enabled) + # if: ${{ always() && github.event.pull_request.head.repo.full_name == 'primer/react' }} + # needs: deploy-preview + # permissions: + # deployments: write + # runs-on: ubuntu-latest + # steps: + # - uses: chrnorm/deployment-action@v2.0.7 + # name: Create GitHub deployment for vrt-all-flags + # id: vrt-all-flags + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # environment: vrt-all-flags-${{ github.event.number }} + # environment-url: '${{ needs.deploy-preview.outputs.deployment_url }}vrt-all-flags' + # - name: Update vrt-all-flags deployment status (success) + # if: success() + # uses: chrnorm/deployment-status@v2.0.3 + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # environment-url: '${{ needs.deploy-preview.outputs.deployment_url }}vrt-all-flags' + # state: 'success' + # deployment-id: ${{ steps.vrt-all-flags.outputs.deployment_id }} + # - name: Update vrt-all-flags deployment status (failure) + # if: failure() + # uses: chrnorm/deployment-status@v2.0.3 + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # state: 'failure' + # deployment-id: ${{ steps.vrt-all-flags.outputs.deployment_id }} + + # deploy-aat-no-flag: + # name: AAT (No flags enabled) + # if: ${{ always() && github.event.pull_request.head.repo.full_name == 'primer/react' }} + # needs: deploy-preview + # permissions: + # deployments: write + # runs-on: ubuntu-latest + # steps: + # - uses: chrnorm/deployment-action@v2.0.7 + # name: Create GitHub deployment for aat-no-flag + # id: aat-no-flag + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # environment: aat-no-flag-${{ github.event.number }} + # environment-url: '${{ needs.deploy-preview.outputs.deployment_url }}aat-no-flag' + # - name: Update aat-no-flag deployment status (success) + # if: success() + # uses: chrnorm/deployment-status@v2.0.3 + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # environment-url: '${{ needs.deploy-preview.outputs.deployment_url }}aat-no-flag' + # state: 'success' + # deployment-id: ${{ steps.aat-no-flag.outputs.deployment_id }} + # - name: Update aat-no-flag deployment status (failure) + # if: failure() + # uses: chrnorm/deployment-status@v2.0.3 + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # state: 'failure' + # deployment-id: ${{ steps.aat-no-flag.outputs.deployment_id }} + + # deploy-aat-all-flags: + # name: AAT (All flags enabled) + # if: ${{ always() && github.event.pull_request.head.repo.full_name == 'primer/react' }} + # needs: deploy-preview + # permissions: + # deployments: write + # runs-on: ubuntu-latest + # steps: + # - uses: chrnorm/deployment-action@v2.0.7 + # name: Create GitHub deployment for aat-all-flags + # id: aat-all-flags + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # environment: aat-all-flags-${{ github.event.number }} + # environment-url: '${{ needs.deploy-preview.outputs.deployment_url }}aat-all-flags' + # - name: Update aat-all-flags deployment status (success) + # if: success() + # uses: chrnorm/deployment-status@v2.0.3 + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # environment-url: '${{ needs.deploy-preview.outputs.deployment_url }}aat-all-flags' + # state: 'success' + # deployment-id: ${{ steps.aat-all-flags.outputs.deployment_id }} + # - name: Update aat-all-flags deployment status (failure) + # if: failure() + # uses: chrnorm/deployment-status@v2.0.3 + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # state: 'failure' + # deployment-id: ${{ steps.aat-all-flags.outputs.deployment_id }} diff --git a/.github/workflows/deploy_preview_forks.yml b/.github/workflows/deploy_preview_forks.yml index 98a033ec12b..47c219bee83 100644 --- a/.github/workflows/deploy_preview_forks.yml +++ b/.github/workflows/deploy_preview_forks.yml @@ -7,9 +7,18 @@ concurrency: cancel-in-progress: true jobs: + vrt-reports: + if: ${{ github.repository != github.event.pull_request.head.repo.full_name }} + uses: ./.github/workflows/vrt-reports.yml + + aat-reports: + if: ${{ github.repository != github.event.pull_request.head.repo.full_name }} + uses: ./.github/workflows/aat-reports.yml + build: # target repository for pull_request is different from source repository - if: ${{ github.repository != github.event.pull_request.head.repo.full_name }} + if: ${{ always() && github.repository != github.event.pull_request.head.repo.full_name }} + needs: [vrt-reports, aat-reports] runs-on: ubuntu-latest steps: - name: Checkout repository @@ -23,13 +32,33 @@ jobs: run: npm ci - name: Build docs preview run: npm run build:docs:preview + - name: Download VRT reports (All flags enabled) + uses: actions/download-artifact@v4 + with: + name: vrt-all-flags + path: docs/public/vrt-all-flags + - name: Download VRT reports (No flags enabled) + uses: actions/download-artifact@v4 + with: + name: vrt-no-flag + path: docs/public/vrt-no-flag + - name: Download AAT reports (All flags enabled) + uses: actions/download-artifact@v4 + with: + name: axe-all-flags + path: docs/public/aat-all-flags + - name: Download AAT reports (No flags enabled) + uses: actions/download-artifact@v4 + with: + name: axe + path: docs/public/aat-no-flag - uses: actions/upload-pages-artifact@v3 with: name: github-pages path: docs/public deploy-preview: - if: ${{ github.repository != github.event.pull_request.head.repo.full_name }} + if: ${{ always() && github.repository != github.event.pull_request.head.repo.full_name }} needs: build permissions: pages: write diff --git a/.github/workflows/vrt-reports.yml b/.github/workflows/vrt-reports.yml new file mode 100644 index 00000000000..f411a33b488 --- /dev/null +++ b/.github/workflows/vrt-reports.yml @@ -0,0 +1,173 @@ +name: VRT Reports +on: + push: + branches: + - main + - next-major + workflow_call: + outputs: + aat-all-flags: + value: ${{ jobs.vrt-all-flags.result }} + aat-no-flag: + value: ${{ jobs.vrt.result }} + merge_group: + branches: + - main + - next-major + types: + - checks_requested + +concurrency: + group: vrt-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + vrt-runner: + runs-on: ubuntu-latest-16-cores + strategy: + fail-fast: false + matrix: + shard: [1, 2, 3, 4] + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'npm' + - name: Install dependencies + run: npm ci + - name: Build storybook + run: npx storybook build + working-directory: packages/react + - name: Run storybook + id: storybook + working-directory: packages/react + run: | + npx serve -l 6006 storybook-static & + pid=$! + echo "pid=$pid" >> $GITHUB_OUTPUT + sleep 5 + - name: Run VRT + uses: docker://mcr.microsoft.com/playwright:v1.47.2-jammy + env: + STORYBOOK_URL: 'http://172.17.0.1:6006' + with: + args: npx playwright test --grep @vrt --shard="${{ matrix.shard }}/${{ strategy.job-total }}" + - name: Stop storybook + run: kill ${{ steps.storybook.outputs.pid }} + - name: Upload report + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: vrt-no-flag-${{ matrix.shard }} + path: blob-report + retention-days: 1 + + vrt: + if: ${{ always() }} + runs-on: ubuntu-latest + needs: vrt-runner + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'npm' + - name: install dependencies + run: npm ci + - name: download all reports + uses: actions/download-artifact@v4 + with: + path: all-blob-reports + pattern: vrt-no-flag-* + merge-multiple: true + - name: merge all reports + run: npx playwright merge-reports --reporter html ./all-blob-reports + - name: Upload report + uses: actions/upload-artifact@v4 + with: + name: vrt-no-flag + path: playwright-report + - name: check vrt-runner job status + if: ${{ needs.vrt-runner.result == 'failure' }} + continue-on-error: true + run: exit 1 + + vrt-runner-all-flags: + runs-on: ubuntu-latest-16-cores + strategy: + fail-fast: false + matrix: + shard: [1, 2, 3, 4] + env: + VITE_PRIMER_REACT_CSS_MODULES_TEAM: 1 + VITE_PRIMER_REACT_CSS_MODULES_STAFF: 1 + VITE_PRIMER_REACT_CSS_MODULES_GA: 1 + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'npm' + - name: Install dependencies + run: npm ci + - name: Build storybook + run: npx storybook build + working-directory: packages/react + - name: Run storybook + id: storybook + working-directory: packages/react + run: | + npx serve -l 6006 storybook-static & + pid=$! + echo "pid=$pid" >> $GITHUB_OUTPUT + sleep 5 + - name: Run VRT + uses: docker://mcr.microsoft.com/playwright:v1.47.2-jammy + env: + STORYBOOK_URL: 'http://172.17.0.1:6006' + with: + args: npx playwright test --grep @vrt --shard="${{ matrix.shard }}/${{ strategy.job-total }}" + - name: Stop storybook + run: kill ${{ steps.storybook.outputs.pid }} + - name: Upload report + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: vrt-all-flags-${{ matrix.shard }} + path: blob-report + retention-days: 1 + + vrt-all-flags: + if: ${{ always() }} + runs-on: ubuntu-latest + needs: vrt-runner-all-flags + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'npm' + - name: install dependencies + run: npm ci + - name: download all reports + uses: actions/download-artifact@v4 + with: + path: all-blob-reports + pattern: vrt-all-flags-* + merge-multiple: true + - name: merge all reports + run: npx playwright merge-reports --reporter html ./all-blob-reports + - name: Upload report + uses: actions/upload-artifact@v4 + with: + name: vrt-all-flags + path: playwright-report + - name: check vrt-runner-all-flags job status + if: ${{ needs.vrt-runner-all-flags.result == 'failure' }} + continue-on-error: true + run: exit 1 diff --git a/packages/react/.storybook/index.html b/packages/react/.storybook/index.html new file mode 100644 index 00000000000..9bedaec25db --- /dev/null +++ b/packages/react/.storybook/index.html @@ -0,0 +1,25 @@ + + + + + + Primer Preview Page + + + +
+

Primer Preview Page

+
+
+ +
+ + \ No newline at end of file diff --git a/script/build-storybook b/script/build-storybook index 9c120b6e21b..7937bea0b6b 100755 --- a/script/build-storybook +++ b/script/build-storybook @@ -13,5 +13,8 @@ fi # Build storybook inside docs npx storybook build -o ../../docs/public/storybook +# Move index page to the right location +cp .storybook/index.html ../../docs/public/index.html + # Remove manager-head after build to not interfere with dev builds -rm .storybook/manager-head.html +rm .storybook/manager-head.html \ No newline at end of file From 1575592e77f375bc884308a8f92abf57b5c21cd7 Mon Sep 17 00:00:00 2001 From: Hussam Ghazzi Date: Tue, 28 Jan 2025 12:52:50 +0000 Subject: [PATCH 2/3] add new workflow file --- .github/workflows/aat-reports.yml | 10 ---------- .github/workflows/reports.yml | 23 +++++++++++++++++++++++ .github/workflows/vrt-reports.yml | 10 ---------- 3 files changed, 23 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/reports.yml diff --git a/.github/workflows/aat-reports.yml b/.github/workflows/aat-reports.yml index 1b5194137fb..9f21f9027ba 100644 --- a/.github/workflows/aat-reports.yml +++ b/.github/workflows/aat-reports.yml @@ -1,21 +1,11 @@ name: AAT Reports on: - push: - branches: - - main - - next-major workflow_call: outputs: aat-all-flags: value: ${{ jobs.aat-all-flags.result }} aat-no-flag: value: ${{ jobs.aat.result }} - merge_group: - branches: - - main - - next-major - types: - - checks_requested concurrency: group: aat-${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/reports.yml b/.github/workflows/reports.yml new file mode 100644 index 00000000000..9a72c7e078a --- /dev/null +++ b/.github/workflows/reports.yml @@ -0,0 +1,23 @@ +name: Build Reports +on: + push: + branches: + - main + - next-major + merge_group: + branches: + - main + - next-major + types: + - checks_requested + +concurrency: + group: reports-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + vrt-reports: + uses: ./.github/workflows/vrt-reports.yml + + aat-reports: + uses: ./.github/workflows/aat-reports.yml \ No newline at end of file diff --git a/.github/workflows/vrt-reports.yml b/.github/workflows/vrt-reports.yml index f411a33b488..54394d78a72 100644 --- a/.github/workflows/vrt-reports.yml +++ b/.github/workflows/vrt-reports.yml @@ -1,21 +1,11 @@ name: VRT Reports on: - push: - branches: - - main - - next-major workflow_call: outputs: aat-all-flags: value: ${{ jobs.vrt-all-flags.result }} aat-no-flag: value: ${{ jobs.vrt.result }} - merge_group: - branches: - - main - - next-major - types: - - checks_requested concurrency: group: vrt-${{ github.workflow }}-${{ github.ref }} From 30c77499b07760a3df514d4c12420d48dfab09dd Mon Sep 17 00:00:00 2001 From: Hussam Ghazzi Date: Tue, 28 Jan 2025 12:57:52 +0000 Subject: [PATCH 3/3] format fix --- .github/workflows/reports.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reports.yml b/.github/workflows/reports.yml index 9a72c7e078a..096309f75cd 100644 --- a/.github/workflows/reports.yml +++ b/.github/workflows/reports.yml @@ -20,4 +20,4 @@ jobs: uses: ./.github/workflows/vrt-reports.yml aat-reports: - uses: ./.github/workflows/aat-reports.yml \ No newline at end of file + uses: ./.github/workflows/aat-reports.yml