Skip to content

Commit 0043f72

Browse files
committed
ci: refactor validation checks into reusable workflow
- Create composite action for SDK validation steps (build, typecheck, tests) - Update speakeasy workflow to use composite action - Add new PR validation workflow that runs on non-OpenAPI changes - Create reusable validation-checks workflow for shared logic
1 parent 7eb198a commit 0043f72

File tree

4 files changed

+73
-33
lines changed

4 files changed

+73
-33
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: 'Validate SDK'
2+
description: 'Run build, typecheck, and tests for the SDK'
3+
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: Setup Node.js
8+
uses: actions/setup-node@v4
9+
with:
10+
node-version: '22'
11+
cache: 'npm'
12+
13+
- name: Install dependencies
14+
shell: bash
15+
run: npm install
16+
17+
- name: Build SDK
18+
shell: bash
19+
run: npm run build
20+
21+
- name: Typecheck tests directory
22+
shell: bash
23+
run: npx tsc --noEmit --skipLibCheck --esModuleInterop --moduleResolution node --module esnext --target es2020 'tests/**/*.ts'
24+
25+
- name: Install examples dependencies
26+
shell: bash
27+
working-directory: examples
28+
run: npm install
29+
30+
- name: Typecheck examples root
31+
shell: bash
32+
working-directory: examples
33+
run: npx tsc --noEmit --skipLibCheck --esModuleInterop --moduleResolution node --module esnext --target es2020 '*.ts'
34+
35+
- name: Install nextjs-example dependencies
36+
shell: bash
37+
working-directory: examples/nextjs-example
38+
run: npm install
39+
40+
- name: Typecheck nextjs-example
41+
shell: bash
42+
working-directory: examples/nextjs-example
43+
run: npx tsc --noEmit
44+
45+
- name: Run tests
46+
shell: bash
47+
run: npm test
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: PR Validation
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- .speakeasy/in.openapi.yaml
7+
8+
jobs:
9+
validate:
10+
uses: ./.github/workflows/validation-checks.yaml

.github/workflows/speakeasy_run_on_pr.yaml

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -30,39 +30,8 @@ jobs:
3030
- name: Run Speakeasy
3131
run: speakeasy run
3232

33-
- name: Setup Node.js
34-
uses: actions/setup-node@v4
35-
with:
36-
node-version: '22'
37-
cache: 'npm'
38-
39-
- name: Install dependencies
40-
run: npm install
41-
42-
- name: Build SDK
43-
run: npm run build
44-
45-
- name: Typecheck tests directory
46-
run: npx tsc --noEmit --skipLibCheck --esModuleInterop --moduleResolution node --module esnext --target es2020 'tests/**/*.ts'
47-
48-
- name: Install examples dependencies
49-
working-directory: examples
50-
run: npm install
51-
52-
- name: Typecheck examples root
53-
working-directory: examples
54-
run: npx tsc --noEmit --skipLibCheck --esModuleInterop --moduleResolution node --module esnext --target es2020 '*.ts'
55-
56-
- name: Install nextjs-example dependencies
57-
working-directory: examples/nextjs-example
58-
run: npm install
59-
60-
- name: Typecheck nextjs-example
61-
working-directory: examples/nextjs-example
62-
run: npx tsc --noEmit
63-
64-
- name: Run tests
65-
run: npm test
33+
- name: Validate SDK
34+
uses: ./.github/actions/validate-sdk
6635

6736
- name: Commit changes
6837
run: |
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Validation Checks
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
validate:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v4
12+
13+
- name: Validate SDK
14+
uses: ./.github/actions/validate-sdk

0 commit comments

Comments
 (0)