Skip to content

Commit 939a6d9

Browse files
committed
fix(ci): use pnpm/action-setup to read packageManager from package.json
Replace socket-registry reusable workflow with inline setup that uses pnpm/action-setup without specifying a version. This allows pnpm to read the version from packageManager in package.json (10.32.0) instead of using the hardcoded 10.21.0 from the reusable workflow. This matches the pattern used in socket-btm.
1 parent c01a6ad commit 939a6d9

File tree

1 file changed

+94
-23
lines changed

1 file changed

+94
-23
lines changed

.github/workflows/ci.yml

Lines changed: 94 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
name: 🚀 CI
22

3-
# Dependencies:
4-
# - SocketDev/socket-registry/.github/workflows/ci.yml
5-
63
concurrency:
74
group: ${{ github.workflow }}-${{ github.ref }}
85
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
@@ -59,29 +56,67 @@ jobs:
5956
echo "node=[\"$NODE_VERSION\"]" >> $GITHUB_OUTPUT
6057
echo "Loaded Node.js: $NODE_VERSION"
6158
62-
ci:
63-
name: Run CI Pipeline
59+
# Lint and type check jobs (run in parallel).
60+
lint:
61+
name: 🧹 Lint Check
6462
needs: versions
63+
runs-on: ubuntu-latest
64+
timeout-minutes: 10
6565
permissions:
66-
contents: read # Read repository contents for CI checks and build operations.
67-
uses: SocketDev/socket-registry/.github/workflows/ci.yml@67a3db92603c23c58031586611c7cc852244c87c # main
68-
with:
69-
test-setup-script: 'pnpm --filter @socketsecurity/cli run build'
70-
lint-script: 'pnpm --filter @socketsecurity/cli run check'
71-
type-check-script: 'pnpm --filter @socketsecurity/cli run type'
72-
run-test: false # Tests run in separate sharded job below.
73-
node-versions: ${{ inputs.node-versions || needs.versions.outputs.node }}
74-
os-versions: '["ubuntu-latest"]'
75-
fail-fast: false
76-
max-parallel: 4
77-
test-timeout-minutes: 15
66+
contents: read
67+
steps:
68+
- name: Checkout repository
69+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
70+
with:
71+
persist-credentials: false
72+
73+
- name: Setup Node.js
74+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
75+
with:
76+
node-version-file: .node-version
77+
78+
- name: Setup pnpm
79+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
80+
81+
- name: Install dependencies
82+
run: pnpm install --frozen-lockfile
83+
84+
- name: Run lint
85+
run: pnpm --filter @socketsecurity/cli run check
86+
87+
type-check:
88+
name: 🔍 Type Check
89+
needs: versions
90+
runs-on: ubuntu-latest
91+
timeout-minutes: 10
92+
permissions:
93+
contents: read
94+
steps:
95+
- name: Checkout repository
96+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
97+
with:
98+
persist-credentials: false
99+
100+
- name: Setup Node.js
101+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
102+
with:
103+
node-version-file: .node-version
104+
105+
- name: Setup pnpm
106+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
107+
108+
- name: Install dependencies
109+
run: pnpm install --frozen-lockfile
110+
111+
- name: Run type check
112+
run: pnpm --filter @socketsecurity/cli run type
78113

79114
# Sharded unit tests for faster CI.
80115
# Splits 2,819 tests across 3 shards (~16s per shard vs 48s monolithic).
81116
# Runs on Linux only to optimize CI runtime and build requirements.
82117
test-sharded:
83118
name: Unit Tests (Shard ${{ matrix.shard }}/3)
84-
needs: [ci, versions]
119+
needs: [lint, type-check, versions]
85120
runs-on: ubuntu-latest
86121
timeout-minutes: 10
87122
permissions:
@@ -93,10 +128,22 @@ jobs:
93128
node-version: ${{ fromJSON(inputs.node-versions || needs.versions.outputs.node) }}
94129
shard: [1, 2, 3]
95130
steps:
96-
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@67a3db92603c23c58031586611c7cc852244c87c # main
131+
- name: Checkout repository
132+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
133+
with:
134+
persist-credentials: false
135+
136+
- name: Setup Node.js
137+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
97138
with:
98139
node-version: ${{ matrix.node-version }}
99140

141+
- name: Setup pnpm
142+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
143+
144+
- name: Install dependencies
145+
run: pnpm install --frozen-lockfile
146+
100147
- name: Generate CLI build cache key
101148
id: cli-cache-key
102149
shell: bash
@@ -148,7 +195,7 @@ jobs:
148195
# Tests the JS distribution and optionally SEA/smol if cached binaries are available.
149196
integration:
150197
name: Integration Tests
151-
needs: [ci, versions]
198+
needs: [lint, type-check, versions]
152199
runs-on: ubuntu-latest
153200
timeout-minutes: 15
154201
permissions:
@@ -158,10 +205,22 @@ jobs:
158205
matrix:
159206
node-version: ${{ fromJSON(inputs.node-versions || needs.versions.outputs.node) }}
160207
steps:
161-
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@67a3db92603c23c58031586611c7cc852244c87c # main
208+
- name: Checkout repository
209+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
210+
with:
211+
persist-credentials: false
212+
213+
- name: Setup Node.js
214+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
162215
with:
163216
node-version: ${{ matrix.node-version }}
164217

218+
- name: Setup pnpm
219+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
220+
221+
- name: Install dependencies
222+
run: pnpm install --frozen-lockfile
223+
165224
- name: Generate CLI build cache key
166225
id: cli-cache-key
167226
shell: bash
@@ -347,7 +406,7 @@ jobs:
347406

348407
e2e:
349408
name: E2E Tests (Shard ${{ matrix.shard }}/2)
350-
needs: [ci, versions]
409+
needs: [lint, type-check, versions]
351410
runs-on: ${{ matrix.os }}
352411
timeout-minutes: 15
353412
permissions:
@@ -360,10 +419,22 @@ jobs:
360419
os: [ubuntu-latest]
361420
shard: [1, 2]
362421
steps:
363-
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@67a3db92603c23c58031586611c7cc852244c87c # main
422+
- name: Checkout repository
423+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
424+
with:
425+
persist-credentials: false
426+
427+
- name: Setup Node.js
428+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
364429
with:
365430
node-version: ${{ matrix.node-version }}
366431

432+
- name: Setup pnpm
433+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
434+
435+
- name: Install dependencies
436+
run: pnpm install --frozen-lockfile
437+
367438
- name: Generate CLI build cache key
368439
id: cli-cache-key
369440
shell: bash

0 commit comments

Comments
 (0)