name: Web Tests on: workflow_call: secrets: CODECOV_TOKEN: required: false permissions: contents: read jobs: test: name: Web Tests (${{ matrix.shardIndex }}/${{ matrix.shardTotal }}) runs-on: depot-ubuntu-24.04-4 strategy: fail-fast: false matrix: shardIndex: [1, 2, 3, 4] shardTotal: [4] defaults: run: shell: bash working-directory: ./web steps: - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Setup web environment uses: ./.github/actions/setup-web - name: Run tests run: vp test run --project unit --reporter=blob --reporter=minimal --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --coverage - name: Upload blob report if: ${{ !cancelled() }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: blob-report-${{ matrix.shardIndex }} path: web/.vitest-reports/* include-hidden-files: true retention-days: 1 browser-test: name: Web Browser Tests runs-on: ubuntu-24.04 timeout-minutes: 20 defaults: run: shell: bash working-directory: ./web steps: - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Setup web environment uses: ./.github/actions/setup-web - name: Install Chromium for Browser Mode timeout-minutes: 15 run: vp exec playwright install --with-deps --only-shell chromium - name: Run browser tests run: vp test run --project browser --silent=passed-only - name: Upload browser failure artifacts if: ${{ failure() && !cancelled() }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: browser-test-failures path: web/.vitest-browser/ if-no-files-found: ignore include-hidden-files: true retention-days: 7 merge-reports: name: Merge Test Reports if: ${{ !cancelled() }} needs: [test] runs-on: depot-ubuntu-24.04-4 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} defaults: run: shell: bash working-directory: ./web steps: - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Setup web environment uses: ./.github/actions/setup-web - name: Download blob reports uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: path: web/.vitest-reports pattern: blob-report-* merge-multiple: true - name: Merge reports run: vp test --merge-reports --coverage --silent=passed-only - name: Report coverage if: ${{ env.CODECOV_TOKEN != '' }} uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 with: directory: web/coverage flags: web env: CODECOV_TOKEN: ${{ env.CODECOV_TOKEN }} dify-ui-test: name: dify-ui Tests runs-on: ubuntu-24.04 timeout-minutes: 20 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} defaults: run: shell: bash working-directory: ./packages/dify-ui steps: - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Setup web environment uses: ./.github/actions/setup-web - name: Install Chromium for Browser Mode timeout-minutes: 15 run: vp exec playwright install --with-deps --only-shell chromium - name: Run dify-ui tests run: vp test run --project unit --coverage --silent=passed-only - name: Upload dify-ui test failure artifacts if: ${{ failure() && !cancelled() }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: dify-ui-test-failures path: packages/dify-ui/.vitest-browser/ if-no-files-found: ignore include-hidden-files: true retention-days: 7 - name: Report coverage if: ${{ env.CODECOV_TOKEN != '' }} uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 with: directory: packages/dify-ui/coverage flags: dify-ui env: CODECOV_TOKEN: ${{ env.CODECOV_TOKEN }} dify-ui-storybook-test: name: dify-ui Storybook Tests runs-on: ubuntu-24.04 timeout-minutes: 20 defaults: run: shell: bash working-directory: ./packages/dify-ui steps: - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Setup web environment uses: ./.github/actions/setup-web - name: Install Chromium for Browser Mode timeout-minutes: 15 run: vp exec playwright install --with-deps --only-shell chromium - name: Run dify-ui Storybook tests run: vp run test:storybook - name: Upload dify-ui Storybook test failure artifacts if: ${{ failure() && !cancelled() }} uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: dify-ui-storybook-test-failures path: packages/dify-ui/.vitest-browser/ if-no-files-found: ignore include-hidden-files: true retention-days: 7