chenzhaoyang
2025-12-17 d3e5a4b7658ece4f845bbc0c4f95acf3fbdf8a61
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: "yarn e2e"
 
on:
  workflow_call:
    inputs:
      head_sha:
        required: true
        type: string
 
env:
  NODE: "22"
  FRONTEND_MONOREPO_DIR: "web"
 
jobs:
  main:
    name: "yarn e2e"
    runs-on: ubuntu-latest
    timeout-minutes: 60
    steps:
      - uses: hmarr/debug-action@v3.0.0
 
      - name: Configure git
        shell: bash
        run: |
          set -xeuo pipefail
          git config --global user.name 'robot-ci-heartex'
          git config --global user.email 'robot-ci-heartex@users.noreply.github.com'
 
      - name: Checkout
        uses: actions/checkout@v6
        with:
          ref: ${{ inputs.ref }}
 
      - name: Setup frontend environment
        uses: ./.github/actions/setup-frontend-environment
        with:
          node-version: "${{ env.NODE }}"
          directory: "${{ env.FRONTEND_MONOREPO_DIR }}"
 
      - name: Install e2e dependencies
        working-directory: ${{ env.FRONTEND_MONOREPO_DIR }}/libs/editor/tests/e2e
        run: yarn install
 
      - name: Install Playwright browsers
        working-directory: ${{ env.FRONTEND_MONOREPO_DIR }}/libs/editor/tests/e2e
        run: yarn playwright install --with-deps
 
      - name: Run LSF server
        id: run-lsf-server
        timeout-minutes: 2
        working-directory: ${{ env.FRONTEND_MONOREPO_DIR }}
        env:
          NODE_ENV: development
          BUILD_NO_MINIMIZATION: true
        run: |
          set -xeuo pipefail
 
          yarn lsf:serve &
          pid=$!
          echo "pid=${pid}" >> $GITHUB_OUTPUT
 
          while ! curl -s -o /dev/null -L "http://localhost:3000"; do
            echo "=> Waiting for service to become available"
            sleep 2s
          done
 
      - name: Run tests
        working-directory: ${{ env.FRONTEND_MONOREPO_DIR }}
        env:
          HEADLESS: true
          COVERAGE: true
        run: |
          yarn lsf:e2e:ci
 
      - name: Upload coverage to Codecov
        if: ${{ always() && github.event.pull_request.head.repo.fork == false && github.event.pull_request.user.login != 'dependabot[bot]' }}
        uses: codecov/codecov-action@v5
        with:
          name: lsf-e2e
          flags: lsf-e2e
          directory: web/libs/editor/tests/coverage
          token: ${{ secrets.CODECOV_TOKEN }}
          verbose: true
          fail_ci_if_error: true
 
      - uses: actions/upload-artifact@v6
        if: always()
        with:
          name: e2e output
          path: |
            web/libs/editor/tests/e2e/output
            web/libs/editor/tests/coverage
 
      - name: Kill LSF server
        if: always()
        continue-on-error: true
        run: kill -9 "${{ steps.run-lsf-server.outputs.pid }}"