Skip to content

Commit 7d9e13b

Browse files
committed
refactor(ci): migrate to reusable workflow from socket-registry
1 parent 9d8e44a commit 7d9e13b

File tree

1 file changed

+23
-152
lines changed

1 file changed

+23
-152
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
name: ⚡ CI
22

3-
# Optimized CI with:
4-
# - Separate lint job (1x instead of 6x)
5-
# - Separate build verification job
6-
# - Parallel job execution
7-
# - pnpm dependency caching via setup-node
3+
# Dependencies:
4+
# - SocketDev/socket-registry/.github/workflows/ci.yml
85

96
on:
107
push:
@@ -13,170 +10,44 @@ on:
1310
pull_request:
1411
branches: [main]
1512
workflow_dispatch:
13+
inputs:
14+
node-versions:
15+
description: 'Node.js versions to test (JSON array)'
16+
required: false
17+
type: string
18+
default: '["24.10.0"]'
1619

1720
permissions:
1821
contents: read
1922

2023
jobs:
21-
# Separate lint job - runs once instead of 6x in matrix
22-
lint:
23-
name: Lint
24-
runs-on: ubuntu-latest
25-
timeout-minutes: 10
26-
steps:
27-
- name: Checkout code
28-
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
29-
30-
- name: Setup pnpm
31-
uses: pnpm/action-setup@9fd676a19091d4595eefd76e4bd31c97133911f1 # v4.2.0
32-
# NOTE: Do not specify version - pnpm-action-setup automatically reads
33-
# the version from the packageManager field in package.json.
34-
35-
- name: Setup Node.js
36-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
37-
with:
38-
node-version: 22
39-
cache: 'pnpm'
40-
41-
- name: Install dependencies
42-
run: pnpm install --frozen-lockfile
43-
44-
- name: Run lint
45-
run: pnpm run lint --all
46-
47-
# Build job - runs once and caches artifacts
48-
build:
49-
name: Build
50-
runs-on: ubuntu-latest
51-
timeout-minutes: 10
52-
steps:
53-
- name: Checkout code
54-
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
55-
56-
- name: Setup pnpm
57-
uses: pnpm/action-setup@9fd676a19091d4595eefd76e4bd31c97133911f1 # v4.2.0
58-
# NOTE: Do not specify version - pnpm-action-setup automatically reads
59-
# the version from the packageManager field in package.json.
60-
61-
- name: Setup Node.js
62-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
63-
with:
64-
node-version: 22
65-
cache: 'pnpm'
66-
67-
- name: Install dependencies
68-
run: pnpm install --frozen-lockfile
69-
70-
- name: Build project
71-
run: pnpm run build
72-
73-
# Test matrix - reuses build artifacts (main test suite)
74-
test:
75-
name: Test
76-
needs: [lint, build]
77-
runs-on: ${{ matrix.os }}
78-
timeout-minutes: 15
79-
strategy:
24+
ci:
25+
name: Run CI Pipeline
26+
uses: SocketDev/socket-registry/.github/workflows/ci.yml@63ad52562c1f2d007a1833b2b22cffc3001e1cc2 # main
27+
with:
28+
test-setup-script: 'pnpm run build'
29+
lint-script: 'pnpm run lint --all'
30+
type-check-script: 'pnpm run check'
31+
test-script: 'pnpm exec vitest --config .config/vitest.config.mts run'
32+
node-versions: ${{ inputs.node-versions || '["24.10.0"]' }}
33+
os-versions: '["ubuntu-latest", "windows-latest"]'
8034
fail-fast: false
81-
matrix:
82-
node: ['24.10.0']
83-
os: [ubuntu-latest, windows-latest]
84-
steps:
85-
- name: Checkout code
86-
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
87-
88-
- name: Setup pnpm
89-
uses: pnpm/action-setup@9fd676a19091d4595eefd76e4bd31c97133911f1 # v4.2.0
90-
# NOTE: Do not specify version - pnpm-action-setup automatically reads
91-
# the version from the packageManager field in package.json.
92-
93-
- name: Setup Node.js
94-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
95-
with:
96-
node-version: ${{ matrix.node }}
97-
cache: 'pnpm'
98-
99-
- name: Install dependencies
100-
run: pnpm install --frozen-lockfile
101-
102-
- name: Build project
103-
run: pnpm run build
104-
105-
- name: Run main tests
106-
run: pnpm exec vitest --config .config/vitest.config.mts run
35+
max-parallel: 4
36+
test-timeout-minutes: 15
10737

10838
# Isolated test suite - runs separately with full isolation
10939
test-isolated:
11040
name: Test (Isolated)
111-
needs: [lint, build]
41+
needs: ci
11242
runs-on: ubuntu-latest
11343
timeout-minutes: 10
11444
steps:
115-
- name: Checkout code
116-
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
117-
118-
- name: Setup pnpm
119-
uses: pnpm/action-setup@9fd676a19091d4595eefd76e4bd31c97133911f1 # v4.2.0
120-
# NOTE: Do not specify version - pnpm-action-setup automatically reads
121-
# the version from the packageManager field in package.json.
122-
123-
- name: Setup Node.js
124-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
45+
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@63ad52562c1f2d007a1833b2b22cffc3001e1cc2 # main
12546
with:
126-
node-version: 22
127-
cache: 'pnpm'
128-
129-
- name: Install dependencies
130-
run: pnpm install --frozen-lockfile
47+
node-version: '22'
13148

13249
- name: Build project
13350
run: pnpm run build
13451

13552
- name: Run isolated tests
13653
run: pnpm exec vitest --config .config/vitest.config.isolated.mts run
137-
138-
# Type check - reuses build artifacts
139-
type-check:
140-
name: Type Check
141-
needs: build
142-
runs-on: ubuntu-latest
143-
timeout-minutes: 10
144-
steps:
145-
- name: Checkout code
146-
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
147-
148-
- name: Setup pnpm
149-
uses: pnpm/action-setup@9fd676a19091d4595eefd76e4bd31c97133911f1 # v4.2.0
150-
# NOTE: Do not specify version - pnpm-action-setup automatically reads
151-
# the version from the packageManager field in package.json.
152-
153-
- name: Setup Node.js
154-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
155-
with:
156-
node-version: 22
157-
cache: 'pnpm'
158-
159-
- name: Install dependencies
160-
run: pnpm install --frozen-lockfile
161-
162-
- name: Run type check
163-
run: pnpm run check
164-
165-
# Status check job - used as required check in branch protection
166-
ci-success:
167-
name: CI Success
168-
needs: [lint, build, test, test-isolated, type-check]
169-
if: always()
170-
runs-on: ubuntu-latest
171-
steps:
172-
- name: Check job results
173-
run: |
174-
if [ "${{ needs.lint.result }}" != "success" ] || \
175-
[ "${{ needs.build.result }}" != "success" ] || \
176-
[ "${{ needs.test.result }}" != "success" ] || \
177-
[ "${{ needs.test-isolated.result }}" != "success" ] || \
178-
[ "${{ needs.type-check.result }}" != "success" ]; then
179-
echo "One or more jobs failed"
180-
exit 1
181-
fi
182-
echo "All CI jobs passed successfully!"

0 commit comments

Comments
 (0)