Skip to content

Commit 8977398

Browse files
committed
update ci
1 parent 31bb3b4 commit 8977398

File tree

3 files changed

+56
-43
lines changed

3 files changed

+56
-43
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- run: pnpm install --frozen-lockfile --prefer-offline
4040

4141
build:
42-
name: Build & check exports
42+
name: Build
4343
needs: [deps]
4444
runs-on: ubuntu-latest
4545
steps:
@@ -69,14 +69,7 @@ jobs:
6969
test-unit:
7070
name: Test - Unit
7171
needs: [deps]
72-
uses: ./.github/workflows/base.yml
73-
with:
74-
command: npm run test:unit
75-
76-
test-integration:
77-
name: Test - Integration
7872
runs-on: ubuntu-latest
79-
needs: [deps, build]
8073
steps:
8174
- uses: actions/checkout@v4
8275

@@ -92,61 +85,43 @@ jobs:
9285
path: node_modules/
9386
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }}
9487

95-
- name: Cache restore build
96-
uses: actions/cache/restore@v4
88+
- run: npm run test:unit
89+
90+
- uses: actions/upload-artifact@v4
9791
with:
98-
fail-on-cache-miss: true
99-
path: dist/
100-
key: ${{ runner.os }}-build-${{ github.sha }}
92+
name: coverage
93+
path: coverage/
10194

102-
- run: npm run test:integration
95+
test-integration:
96+
name: Test - Integration
97+
uses: ./.github/workflows/shared/base-1.yml
98+
with:
99+
command: npm run test:integration
103100

104101
check-exports:
105102
name: Check exports
106-
runs-on: ubuntu-latest
107-
needs: [deps, build]
108-
steps:
109-
- uses: actions/checkout@v4
110-
111-
- name: Setup Node.js
112-
uses: actions/setup-node@v4
113-
with:
114-
node-version: '22.x'
115-
116-
- name: Cache restore node_modules
117-
uses: actions/cache/restore@v4
118-
with:
119-
fail-on-cache-miss: true
120-
path: node_modules/
121-
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }}
122-
123-
- name: Cache restore build
124-
uses: actions/cache/restore@v4
125-
with:
126-
fail-on-cache-miss: true
127-
path: dist/
128-
key: ${{ runner.os }}-build-${{ github.sha }}
129-
130-
- run: npm run check-exports
103+
uses: ./.github/workflows/shared/base-1.yml
104+
with:
105+
command: npm run check-exports
131106

132107
lint:
133108
name: Lint
134109
needs: [deps]
135-
uses: ./.github/workflows/base.yml
110+
uses: ./.github/workflows/shared/base-2.yml
136111
with:
137112
command: npm run lint
138113

139114
check-format:
140115
name: Check format
141116
needs: [deps]
142-
uses: ./.github/workflows/base.yml
117+
uses: ./.github/workflows/shared/base-2.yml
143118
with:
144119
command: npm run check-format
145120

146121
check-spelling:
147122
name: Check spelling
148123
needs: [deps]
149-
uses: ./.github/workflows/base.yml
124+
uses: ./.github/workflows/shared/base-2.yml
150125
with:
151126
command: npm run check-spelling
152127

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
command:
5+
required: true
6+
type: string
7+
8+
jobs:
9+
base-1:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: read
14+
id-token: write
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '22.x'
23+
24+
- name: Cache restore node_modules
25+
uses: actions/cache/restore@v4
26+
with:
27+
fail-on-cache-miss: true
28+
path: node_modules/
29+
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }}
30+
31+
- name: Cache restore build
32+
uses: actions/cache/restore@v4
33+
with:
34+
fail-on-cache-miss: true
35+
path: dist/
36+
key: ${{ runner.os }}-build-${{ github.sha }}
37+
38+
- run: ${{ inputs.command }}

.github/workflows/base.yml renamed to .github/workflows/shared/base-2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
type: string
77

88
jobs:
9-
base:
9+
base-2:
1010
runs-on: ubuntu-latest
1111

1212
permissions:

0 commit comments

Comments
 (0)