Skip to content

Commit eb316c9

Browse files
authored
ci: speed up (#1591)
* ci: speed up * chore: f * chore: f * chore: f * chore: f * chore: f * chore: f
1 parent 1150f4d commit eb316c9

File tree

4 files changed

+68
-19
lines changed

4 files changed

+68
-19
lines changed

.github/actions/setup/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ runs:
2525
run: pnpm install
2626
shell: bash
2727

28+
- uses: nrwl/nx-set-shas@v4
29+
2830
- name: Build packages
2931
run: pnpm build
3032
shell: bash

.github/workflows/ci.yml

Lines changed: 58 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,87 @@ on:
66
pull_request:
77
branches: [main]
88

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
913
env:
1014
CI: true
15+
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
1116

1217
jobs:
13-
build-and-test:
18+
install-deps:
1419
runs-on: ubuntu-latest
1520
steps:
16-
- name: checkout code repository
21+
- name: Checkout code repository
1722
uses: actions/checkout@v4
1823
with:
1924
fetch-depth: 0
2025

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
2236

2337
- uses: ./.github/actions/setup
2438

25-
- name: install dependencies
26-
run: pnpm install
39+
- name: Run lint
40+
run: pnpm test:lint --format github
2741

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
2954
run: pnpm test:unit
3055

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
3468

35-
- name: run lint
36-
run: pnpm test:lint --format github
69+
- uses: ./.github/actions/setup
3770

38-
- name: install browsers
71+
- name: Install browsers
3972
run: pnpm --filter=@milkdown/e2e test:install
4073

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 }}
4376

44-
- name: upload test results
77+
- name: Upload test results
4578
if: ${{ failure() }}
4679
uses: actions/upload-artifact@v4
4780
with:
48-
name: test-results-main
81+
name: test-results-e2e-${{ matrix.shard }}
4982
path: e2e/playwright-report/
5083
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

.github/workflows/fix.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
permissions:
99
contents: read
1010

11+
env:
12+
CI: true
13+
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
14+
1115
jobs:
1216
fix:
1317
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66

77
concurrency: ${{ github.workflow }}-${{ github.ref }}
88

9+
env:
10+
CI: true
11+
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
12+
913
jobs:
1014
prepare:
1115
runs-on: ubuntu-latest
@@ -35,9 +39,6 @@ jobs:
3539

3640
- uses: ./.github/actions/setup
3741

38-
- name: build packs
39-
run: pnpm build
40-
4142
- name: Publish to NPM
4243
run: pnpm ci:publish
4344
env:

0 commit comments

Comments
 (0)