The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Split front storybook tests into one job per scope (#27380)
Paul Rastoin00e471239fbb
diff --git a/.github/workflows/ci-front-storybook-test.yaml b/.github/workflows/ci-front-storybook-test.yamlnew file mode 100644index 00000000000..158403d5bf6--- /dev/null+++ b/.github/workflows/ci-front-storybook-test.yaml@@ -0,0 +1,74 @@+name: CI Front Storybook Test++on:+ workflow_call:+ inputs:+ scope:+ type: string+ required: true+ description: 'Storybook scope to test: modules, pages or performance'+ shard:+ type: number+ required: true+ shard-count:+ type: number+ required: true++permissions:+ contents: read++env:+ # Saved by front-sb-build in ci-front.yaml+ STORYBOOK_BUILD_CACHE_KEY_FOR_RESTORE_ACTION: storybook-build-ubuntu-latest-8-cores-runner++jobs:+ storybook-test:+ timeout-minutes: 30+ runs-on: ubuntu-latest+ env:+ REACT_APP_SERVER_BASE_URL: http://localhost:3000+ STORYBOOK_URL: http://localhost:6006+ steps:+ - name: Fetch local actions+ uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1+ with:+ fetch-depth: 10+ - name: Install dependencies+ uses: ./.github/actions/yarn-install+ - name: Restore storybook build cache+ uses: ./.github/actions/restore-cache+ with:+ key: ${{ env.STORYBOOK_BUILD_CACHE_KEY_FOR_RESTORE_ACTION }}+ - name: Clean stale storybook vitest cache+ run: rm -rf packages/twenty-front/node_modules/.cache/storybook+ - name: Build dependencies+ run: |+ npx nx build twenty-shared+ npx nx build twenty-ui+ npx nx build twenty-front-component-renderer+ - name: Resolve Playwright version+ id: playwright-version+ run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT"+ - name: Cache Playwright browsers+ id: playwright-cache+ uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0+ with:+ path: ~/.cache/ms-playwright+ key: v4-playwright-browsers-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}+ - name: Install Playwright+ if: steps.playwright-cache.outputs.cache-hit != 'true'+ run: |+ cd packages/twenty-front+ npx playwright install chromium+ - name: Front / Write .env+ run: npx nx reset:env twenty-front+ - name: Run storybook tests+ run: npx nx storybook:test:no-coverage twenty-front --configuration=${{ inputs.scope }} --shard=${{ inputs.shard }}/${{ inputs.shard-count }}+ - name: Upload screenshots for visual regression+ if: always() && !cancelled() && inputs.scope != 'performance'+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2+ with:+ name: argos-screenshots-twenty-front-${{ inputs.scope }}-${{ inputs.shard }}+ path: packages/twenty-front/screenshots+ retention-days: 1+ overwrite: truediff --git a/.github/workflows/ci-front.yaml b/.github/workflows/ci-front.yamlindex cd6bc3f504f..cd05747d83a 100644--- a/.github/workflows/ci-front.yaml+++ b/.github/workflows/ci-front.yaml@@ -70,9 +70,7 @@ jobs:uses: ./.github/actions/save-cachewith:key: ${{ env.STORYBOOK_BUILD_CACHE_KEY_FOR_SAVE_ACTION }}- front-sb-test:- timeout-minutes: 30- runs-on: ubuntu-latest+ front-sb-test-modules:needs: changed-files-checkif: >-always() &&@@ -82,110 +80,46 @@ jobs:fail-fast: falsematrix:shard: [1, 2, 3, 4, 5, 6, 7, 8]- storybook_scope: ${{ github.event_name == 'push' && fromJSON('["modules", "pages"]') || fromJSON('["modules", "pages", "performance"]') }}- exclude:- - { storybook_scope: pages, shard: 5 }- - { storybook_scope: pages, shard: 6 }- - { storybook_scope: pages, shard: 7 }- - { storybook_scope: pages, shard: 8 }- - { storybook_scope: performance, shard: 5 }- - { storybook_scope: performance, shard: 6 }- - { storybook_scope: performance, shard: 7 }- - { storybook_scope: performance, shard: 8 }- env:- SHARD_COUNTER: ${{ matrix.storybook_scope == 'modules' && 8 || 4 }}- REACT_APP_SERVER_BASE_URL: http://localhost:3000- STORYBOOK_URL: http://localhost:6006- steps:- - name: Fetch local actions- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1- with:- fetch-depth: 10- - name: Install dependencies- uses: ./.github/actions/yarn-install- - name: Restore storybook build cache- uses: ./.github/actions/restore-cache- with:- key: ${{ env.STORYBOOK_BUILD_CACHE_KEY_FOR_RESTORE_ACTION }}- - name: Clean stale storybook vitest cache- run: rm -rf packages/twenty-front/node_modules/.cache/storybook- - name: Build dependencies- run: |- npx nx build twenty-shared- npx nx build twenty-ui- npx nx build twenty-front-component-renderer- - name: Resolve Playwright version- id: playwright-version- run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT"- - name: Cache Playwright browsers- id: playwright-cache- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0- with:- path: ~/.cache/ms-playwright- key: v4-playwright-browsers-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}- - name: Install Playwright- if: steps.playwright-cache.outputs.cache-hit != 'true'- run: |- cd packages/twenty-front- npx playwright install chromium- - name: Front / Write .env- run: npx nx reset:env twenty-front- - name: Run storybook tests- run: npx nx storybook:test:no-coverage twenty-front --configuration=${{ matrix.storybook_scope }} --shard=${{ matrix.shard }}/${{ env.SHARD_COUNTER }}- - name: Upload screenshots for visual regression- if: always() && !cancelled() && matrix.storybook_scope != 'performance'- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2- with:- name: argos-screenshots-twenty-front-${{ matrix.storybook_scope }}-${{ matrix.shard }}- path: packages/twenty-front/screenshots- retention-days: 1- overwrite: true- # - name: Rename coverage file- # run: |- # if [ -f "packages/twenty-front/coverage/storybook/coverage-final.json" ]; then- # mv packages/twenty-front/coverage/storybook/coverage-final.json packages/twenty-front/coverage/storybook/coverage-shard-${{matrix.shard}}.json- # else- # echo "Error: coverage-final.json not found"- # ls -la packages/twenty-front/coverage/storybook/ || echo "Coverage directory does not exist"- # exit 1- # fi- # - name: Upload coverage artifact- # uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2- # with:- # retention-days: 1- # name: coverage-artifacts-${{ matrix.storybook_scope }}-${{ github.run_id }}-${{ matrix.shard }}- # path: packages/twenty-front/coverage/storybook/coverage-shard-${{matrix.shard}}.json- # merge-reports-and-check-coverage:- # timeout-minutes: 30- # runs-on: ubuntu-latest- # needs: front-sb-test- # env:- # PATH_TO_COVERAGE: packages/twenty-front/coverage/storybook- # strategy:- # matrix:- # storybook_scope: [modules, pages, performance]- # steps:- # - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1- # with:- # fetch-depth: 10- # - name: Install dependencies- # uses: ./.github/actions/yarn-install- # - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0- # with:- # pattern: coverage-artifacts-${{ matrix.storybook_scope }}-${{ github.run_id }}-*- # merge-multiple: true- # path: coverage-artifacts- # - name: Merge coverage reports- # run: |- # mkdir -p ${{ env.PATH_TO_COVERAGE }}- # npx nyc merge coverage-artifacts ${{ env.PATH_TO_COVERAGE }}/coverage-storybook.json- # - name: Checking coverage- # run: npx nx storybook:coverage twenty-front --checkCoverage=true --configuration=${{ matrix.storybook_scope }}+ uses: ./.github/workflows/ci-front-storybook-test.yaml+ with:+ scope: modules+ shard: ${{ matrix.shard }}+ shard-count: ${{ strategy.job-total }}+ front-sb-test-pages:+ needs: changed-files-check+ if: >-+ always() &&+ (github.event_name == 'push' ||+ needs.changed-files-check.outputs.any_changed == 'true')+ strategy:+ fail-fast: false+ matrix:+ shard: [1, 2, 3, 4]+ uses: ./.github/workflows/ci-front-storybook-test.yaml+ with:+ scope: pages+ shard: ${{ matrix.shard }}+ shard-count: ${{ strategy.job-total }}+ front-sb-test-performance:+ needs: changed-files-check+ if: needs.changed-files-check.outputs.any_changed == 'true'+ strategy:+ fail-fast: false+ matrix:+ shard: [1, 2, 3, 4]+ uses: ./.github/workflows/ci-front-storybook-test.yaml+ with:+ scope: performance+ shard: ${{ matrix.shard }}+ shard-count: ${{ strategy.job-total }}front-sb-screenshots:timeout-minutes: 5runs-on: ubuntu-latest- needs: front-sb-test- if: always() && needs.front-sb-test.result == 'success'+ needs: [front-sb-test-modules, front-sb-test-pages]+ if: >-+ always() &&+ needs.front-sb-test-modules.result == 'success' &&+ needs.front-sb-test-pages.result == 'success'steps:- name: Download shard screenshot artifactsuses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0@@ -281,8 +215,9 @@ jobs:changed-files-check,front-task,front-build,- # merge-reports-and-check-coverage,- front-sb-test,+ front-sb-test-modules,+ front-sb-test-pages,+ front-sb-test-performance,front-sb-build,front-sb-screenshots,]