|
6 | 6 | pull_request: |
7 | 7 | branches: [main] |
8 | 8 |
|
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
9 | 13 | env: |
10 | 14 | CI: true |
| 15 | + NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} |
11 | 16 |
|
12 | 17 | jobs: |
13 | | - build-and-test: |
| 18 | + install-deps: |
14 | 19 | runs-on: ubuntu-latest |
15 | 20 | steps: |
16 | | - - name: checkout code repository |
| 21 | + - name: Checkout code repository |
17 | 22 | uses: actions/checkout@v4 |
18 | 23 | with: |
19 | 24 | fetch-depth: 0 |
20 | 25 |
|
21 | | - - uses: nrwl/nx-set-shas@v4 |
| 26 | + - uses: ./.github/actions/setup |
| 27 | + |
| 28 | + lint: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + needs: install-deps |
| 31 | + steps: |
| 32 | + - name: Checkout code repository |
| 33 | + uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + fetch-depth: 0 |
22 | 36 |
|
23 | 37 | - uses: ./.github/actions/setup |
24 | 38 |
|
25 | | - - name: install dependencies |
26 | | - run: pnpm install |
| 39 | + - name: Run lint |
| 40 | + run: pnpm test:lint --format github |
27 | 41 |
|
28 | | - - name: run unit tests |
| 42 | + unit: |
| 43 | + runs-on: ubuntu-latest |
| 44 | + needs: install-deps |
| 45 | + steps: |
| 46 | + - name: Checkout code repository |
| 47 | + uses: actions/checkout@v4 |
| 48 | + with: |
| 49 | + fetch-depth: 0 |
| 50 | + |
| 51 | + - uses: ./.github/actions/setup |
| 52 | + |
| 53 | + - name: Run unit tests |
29 | 54 | run: pnpm test:unit |
30 | 55 |
|
31 | | - # build all the packages to prepare for release |
32 | | - - name: build packs |
33 | | - run: pnpm build |
| 56 | + e2e: |
| 57 | + runs-on: ubuntu-latest |
| 58 | + needs: install-deps |
| 59 | + strategy: |
| 60 | + fail-fast: false |
| 61 | + matrix: |
| 62 | + shard: [1, 2, 3, 4, 5] |
| 63 | + steps: |
| 64 | + - name: Checkout code repository |
| 65 | + uses: actions/checkout@v4 |
| 66 | + with: |
| 67 | + fetch-depth: 0 |
34 | 68 |
|
35 | | - - name: run lint |
36 | | - run: pnpm test:lint --format github |
| 69 | + - uses: ./.github/actions/setup |
37 | 70 |
|
38 | | - - name: install browsers |
| 71 | + - name: Install browsers |
39 | 72 | run: pnpm --filter=@milkdown/e2e test:install |
40 | 73 |
|
41 | | - - name: run playwright |
42 | | - run: pnpm test:e2e |
| 74 | + - name: Run playwright |
| 75 | + run: pnpm test:e2e -- --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }} |
43 | 76 |
|
44 | | - - name: upload test results |
| 77 | + - name: Upload test results |
45 | 78 | if: ${{ failure() }} |
46 | 79 | uses: actions/upload-artifact@v4 |
47 | 80 | with: |
48 | | - name: test-results-main |
| 81 | + name: test-results-e2e-${{ matrix.shard }} |
49 | 82 | path: e2e/playwright-report/ |
50 | 83 | retention-days: 7 |
| 84 | + |
| 85 | + summary: |
| 86 | + if: ${{ always() }} |
| 87 | + needs: [lint, unit, e2e] |
| 88 | + runs-on: ubuntu-latest |
| 89 | + steps: |
| 90 | + - name: On error |
| 91 | + if: ${{ needs.e2e.result != 'success' || needs.unit.result != 'success' || needs.lint.result != 'success' }} |
| 92 | + run: exit 1 |
0 commit comments