99
1010 workflow_dispatch :
1111
12- jobs :
13- # ======== calculate changes ========
14- changes :
15- runs-on : ubuntu-latest
16- outputs :
17- changed : ${{ steps.changes.outputs.changed }}
18- strategy :
19- matrix :
20- node-version : [18]
21-
22- steps :
23- - name : Checkout
24- uses : actions/checkout@v4
25- with :
26- fetch-depth : 10
27-
28- - name : Install pnpm
29- run : |
30- npm install -g corepack@latest --force
31- corepack enable
32-
33- - uses : dorny/paths-filter@v3.0.2
34- id : changes
35- with :
36- predicate-quantifier : ' every'
37- filters : |
38- changed:
39- - "!**/*.md"
40- - "!**/*.mdx"
41- - "!**/_meta.json"
42- - "!**/dictionary.txt"
12+ permissions :
13+ contents : read
4314
15+ jobs :
4416 # ======== ut ========
4517 ut :
4618 runs-on : ${{ matrix.os }}
47- needs : changes
48- if : ${{ needs.changes.outputs.changed == 'true' }}
4919 strategy :
5020 matrix :
5121 os : [ubuntu-latest]
5828 - name : Checkout
5929 uses : actions/checkout@v4
6030 with :
61- fetch-depth : 10
31+ fetch-depth : 1
6232
6333 - name : Git config
6434 if : ${{ matrix.os == 'windows-latest' }}
@@ -71,26 +41,39 @@ jobs:
7141 npm install -g corepack@latest --force
7242 corepack enable
7343
44+ - uses : dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
45+ id : changes
46+ with :
47+ predicate-quantifier : ' every'
48+ filters : |
49+ changed:
50+ - "!**/*.md"
51+ - "!**/*.mdx"
52+ - "!**/_meta.json"
53+ - "!**/dictionary.txt"
54+
7455 - name : Setup Node.js ${{ matrix.node-version }}
56+ if : steps.changes.outputs.changed == 'true'
7557 uses : actions/setup-node@v4
7658 with :
7759 node-version : ${{ matrix.node-version }}
7860 cache : ' pnpm'
7961
8062 - name : Install Dependencies
63+ if : steps.changes.outputs.changed == 'true'
8164 run : pnpm install
8265
8366 - name : Type Check
67+ if : steps.changes.outputs.changed == 'true'
8468 run : pnpm run type-check
8569
8670 - name : Unit Test
71+ if : steps.changes.outputs.changed == 'true'
8772 run : pnpm run test:unit
8873
8974 # ======== integration && e2e ========
9075 integration-e2e :
9176 runs-on : ${{ matrix.os }}
92- needs : changes
93- if : ${{ needs.changes.outputs.changed == 'true' }}
9477 strategy :
9578 matrix :
9679 os : [ubuntu-latest]
@@ -100,42 +83,48 @@ jobs:
10083 os : windows-latest
10184
10285 steps :
86+ - name : Checkout
87+ uses : actions/checkout@v4
88+ with :
89+ fetch-depth : 1
90+
10391 - name : Git config
10492 if : ${{ matrix.os == 'windows-latest' }}
10593 shell : bash
10694 run : |
10795 git config --system core.longpaths true
10896
109- - name : Checkout
110- uses : actions/checkout@v4
111- with :
112- fetch-depth : 10
113-
11497 - name : Install pnpm
11598 run : |
11699 npm install -g corepack@latest --force
117100 corepack enable
118101
102+ - uses : dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
103+ id : changes
104+ with :
105+ predicate-quantifier : ' every'
106+ filters : |
107+ changed:
108+ - "!**/*.md"
109+ - "!**/*.mdx"
110+ - "!**/_meta.json"
111+ - "!**/dictionary.txt"
112+
119113 - name : Setup Node.js ${{ matrix.node-version }}
114+ if : steps.changes.outputs.changed == 'true'
120115 uses : actions/setup-node@v4
121116 with :
122117 node-version : ${{ matrix.node-version }}
123118 cache : ' pnpm'
124119
125120 - name : Install Dependencies
121+ if : steps.changes.outputs.changed == 'true'
126122 run : pnpm install && cd ./tests && pnpm playwright install chromium
127123
128124 - name : Integration Test (Vitest)
125+ if : steps.changes.outputs.changed == 'true'
129126 run : pnpm run test:integration
130127
131128 - name : E2E Test (Playwright)
129+ if : steps.changes.outputs.changed == 'true'
132130 run : pnpm run test:e2e
133-
134- # ======== exit ========
135- pr-check-required :
136- if : (!cancelled() && !failure())
137- needs : [ut, integration-e2e]
138- runs-on : ubuntu-latest
139- name : Test passed or skipped
140- steps :
141- - run : echo "All tests passed or skipped."
0 commit comments