Skip to content

Commit 31bb3b4

Browse files
committed
update ci
1 parent 836acc3 commit 31bb3b4

File tree

4 files changed

+72
-17
lines changed

4 files changed

+72
-17
lines changed

.github/workflows/base.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
type: string
77

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

1212
permissions:
@@ -21,7 +21,7 @@ jobs:
2121
with:
2222
node-version: '22.x'
2323

24-
- name: Cache node_modules
24+
- name: Cache restore node_modules
2525
uses: actions/cache/restore@v4
2626
with:
2727
fail-on-cache-miss: true

.github/workflows/ci.yml

Lines changed: 67 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ jobs:
2828
- name: Setup pnpm
2929
uses: pnpm/action-setup@v4
3030

31-
- uses: actions/cache@v4
31+
- name: Cache node_modules
32+
uses: actions/cache@v4
3233
with:
3334
path: dist/
3435
key: ${{ runner.os }}-build-${{ hashFiles('**/pnpm-lock.yaml') }}
@@ -49,7 +50,7 @@ jobs:
4950
with:
5051
node-version: '22.x'
5152

52-
- name: Cache node_modules
53+
- name: Cache restore node_modules
5354
uses: actions/cache/restore@v4
5455
with:
5556
fail-on-cache-miss: true
@@ -59,21 +60,74 @@ jobs:
5960
- name: Build
6061
run: npm run build
6162

62-
- name: Cache build
63+
- name: Cache save build
6364
uses: actions/cache/save@v4
6465
with:
6566
path: dist/
6667
key: ${{ runner.os }}-build-${{ github.sha }}
6768

68-
- name: Check exports
69-
run: npm run check-exports
70-
71-
test:
72-
name: Test
69+
test-unit:
70+
name: Test - Unit
7371
needs: [deps]
7472
uses: ./.github/workflows/base.yml
7573
with:
76-
command: npm run test
74+
command: npm run test:unit
75+
76+
test-integration:
77+
name: Test - Integration
78+
runs-on: ubuntu-latest
79+
needs: [deps, build]
80+
steps:
81+
- uses: actions/checkout@v4
82+
83+
- name: Setup Node.js
84+
uses: actions/setup-node@v4
85+
with:
86+
node-version: '22.x'
87+
88+
- name: Cache restore node_modules
89+
uses: actions/cache/restore@v4
90+
with:
91+
fail-on-cache-miss: true
92+
path: node_modules/
93+
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }}
94+
95+
- name: Cache restore build
96+
uses: actions/cache/restore@v4
97+
with:
98+
fail-on-cache-miss: true
99+
path: dist/
100+
key: ${{ runner.os }}-build-${{ github.sha }}
101+
102+
- run: npm run test:integration
103+
104+
check-exports:
105+
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
77131

78132
lint:
79133
name: Lint
@@ -99,7 +153,7 @@ jobs:
99153
deploy:
100154
name: Deploy
101155
runs-on: ubuntu-latest
102-
needs: [build, test, lint]
156+
needs: [build, test-unit, test-integration, check-exports, lint]
103157
steps:
104158
- uses: actions/checkout@v4
105159

@@ -108,7 +162,7 @@ jobs:
108162
with:
109163
node-version: '22.x'
110164

111-
- name: Cache build
165+
- name: Cache restore build
112166
uses: actions/cache/restore@v4
113167
with:
114168
fail-on-cache-miss: true
@@ -126,9 +180,9 @@ jobs:
126180
artifact:
127181
name: Artifact
128182
runs-on: ubuntu-latest
129-
needs: [build, test, lint]
183+
needs: [build, test-unit, test-integration, check-exports, lint]
130184
steps:
131-
- name: Cache build
185+
- name: Cache restore build
132186
uses: actions/cache/restore@v4
133187
with:
134188
fail-on-cache-miss: true

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"ci": "concurrently --names=\"build,test,lint,format,spelling,exports\" \"npm run build\" \"npm run test\" \"npm run lint\" \"npm run check-format\" \"npm run check-spelling\" \"npm run check-exports\"",
77
"build": "tsc --project tsconfig.build.json",
88
"test": "vitest run --coverage",
9+
"test:unit": "vitest run --exclude=\"**/*.integration.spec.*\" --coverage",
10+
"test:integration": "vitest run .integration.spec.",
911
"lint": "eslint ./",
1012
"check-format": "prettier --check .",
1113
"check-spelling": "cspell **",

src/cli.integration.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ const outputDir = path.dirname(outputPath)
2222

2323
test('cli', async () => {
2424
await rm(outputDir, { recursive: true, force: true })
25-
await exec('npm run build')
26-
await exec(`npx graphql-x --schema ${schemaPath} --output ${outputPath}`)
25+
await exec(`bin/graphql-x --schema ${schemaPath} --output ${outputPath}`)
2726

2827
const result = await invoke(async () => {
2928
let x

0 commit comments

Comments
 (0)