1616
1717# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1818jobs :
19- # ======== ut ========
20- ut-ubuntu :
19+ # ======== caculate changes ========
20+ changes :
2121 runs-on : ubuntu-latest
22+ outputs :
23+ changed : ${{ steps.changes.outputs.changed }}
2224 strategy :
2325 matrix :
24- node-version : [18.x ]
26+ node-version : [18]
2527
2628 # Steps represent a sequence of tasks that will be executed as part of the job
2729 steps :
@@ -44,27 +46,45 @@ jobs:
4446 - "!**/_meta.json"
4547 - "!**/dictionary.txt"
4648
49+ # ======== ut ========
50+ ut-ubuntu :
51+ runs-on : ubuntu-latest
52+ needs : changes
53+ if : ${{ needs.changes.outputs.changed == 'true' }}
54+ strategy :
55+ matrix :
56+ node-version : [18, 20, 22]
57+
58+ # Steps represent a sequence of tasks that will be executed as part of the job
59+ steps :
60+ - name : Checkout
61+ uses : actions/checkout@v4
62+ with :
63+ fetch-depth : 10
64+
65+ - name : Install Pnpm
66+ run : corepack enable
67+
4768 - name : Setup Node.js ${{ matrix.node-version }}
48- if : steps.changes.outputs.changed == 'true'
4969 uses : actions/setup-node@v4
5070 with :
5171 node-version : ${{ matrix.node-version }}
5272 cache : ' pnpm'
5373
5474 - name : Install Dependencies
55- if : steps.changes.outputs.changed == 'true'
5675 run : pnpm install
5776
5877 - name : Unit Test
59- if : steps.changes.outputs.changed == 'true'
6078 run : pnpm run test:unit
6179
6280 # ======== integration && e2e ========
6381 integration-e2e-ubuntu :
6482 runs-on : ubuntu-latest
83+ needs : changes
84+ if : ${{ needs.changes.outputs.changed == 'true' }}
6585 strategy :
6686 matrix :
67- node-version : [18.x ]
87+ node-version : [18, 20, 22 ]
6888
6989 # Steps represent a sequence of tasks that will be executed as part of the job
7090 steps :
@@ -76,40 +96,53 @@ jobs:
7696 - name : Install Pnpm
7797 run : corepack enable
7898
79- - uses : dorny/paths-filter@v3
80- id : changes
81- with :
82- predicate-quantifier : ' every'
83- filters : |
84- changed:
85- - "!**/*.md"
86- - "!**/*.mdx"
87- - "!**/_meta.json"
88- - "!**/dictionary.txt"
89-
9099 - name : Setup Node.js ${{ matrix.node-version }}
91- if : steps.changes.outputs.changed == 'true'
92100 uses : actions/setup-node@v4
93101 with :
94102 node-version : ${{ matrix.node-version }}
95103 cache : ' pnpm'
96104
97105 - name : Install Dependencies
98- if : steps.changes.outputs.changed == 'true'
99106 run : pnpm install && cd ./tests && npx playwright install
100107
101108 - name : Integration Test (Vitest)
102- if : steps.changes.outputs.changed == 'true'
103109 run : pnpm run test:integration
104110
105111 - name : E2E Test (Playwright)
106- if : steps.changes.outputs.changed == 'true'
107112 run : pnpm run test:e2e
108113
114+ # ======== benchmark ========
115+ benchemark-ubuntu :
116+ # Only Ubuntu 20.04 and 22.04 are supported at the moment.
117+ # See https://github.com/CodSpeedHQ/action/blob/016456b513677f9d4a1c509c7f8a38d8dd55b2b0/.github/workflows/ci.yml#L19.
118+ runs-on : ubuntu-22.04
119+ needs : [integration-e2e-ubuntu]
120+ strategy :
121+ matrix :
122+ node-version : [20]
123+
124+ # Steps represent a sequence of tasks that will be executed as part of the job
125+ steps :
126+ - name : Checkout
127+ uses : actions/checkout@v4
128+ with :
129+ fetch-depth : 10
130+
131+ - name : Install Pnpm
132+ run : corepack enable
133+
134+ - name : Setup Node.js ${{ matrix.node-version }}
135+ uses : actions/setup-node@v4
136+ with :
137+ node-version : ${{ matrix.node-version }}
138+ cache : ' pnpm'
139+
140+ - name : Install Dependencies
141+ run : pnpm install && cd ./tests && npx playwright install
142+
109143 # only run benchmark in Ubuntu
110144 - name : Benchmarks (Vitest)
111145 uses : CodSpeedHQ/action@v3
112- if : steps.changes.outputs.changed == 'true'
113146 with :
114147 run : pnpm run test:benchmark
115148 # token retrieved from the CodSpeed app at the previous step
0 commit comments