Skip to content

Commit 240823a

Browse files
committed
ci: add CI workflow for lint, typecheck, and unit tests on PRs
Add a GitHub Actions workflow that runs lint, type checking, and unit tests on every push to a PR targeting main or v1.x. Includes test fixture updates.
1 parent 390598f commit 240823a

File tree

5 files changed

+57
-2
lines changed

5 files changed

+57
-2
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, v1.x]
6+
pull_request:
7+
branches: [main, v1.x]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 10
16+
steps:
17+
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@51be85d39d3b4a42dd9d4712948b9d30a2e04794
18+
with:
19+
node-version: 22
20+
21+
- name: Lint
22+
run: pnpm check:lint
23+
24+
typecheck:
25+
runs-on: ubuntu-latest
26+
timeout-minutes: 10
27+
steps:
28+
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@51be85d39d3b4a42dd9d4712948b9d30a2e04794
29+
with:
30+
node-version: 22
31+
32+
- name: Type check
33+
run: pnpm check:tsc
34+
35+
test:
36+
runs-on: ${{ matrix.os }}
37+
timeout-minutes: 15
38+
strategy:
39+
fail-fast: true
40+
matrix:
41+
node-version: [20, 22, 24]
42+
os: [ubuntu-latest]
43+
steps:
44+
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@51be85d39d3b4a42dd9d4712948b9d30a2e04794
45+
with:
46+
node-version: ${{ matrix.node-version }}
47+
48+
- name: Build
49+
run: pnpm run build
50+
51+
- name: Run unit tests
52+
run: pnpm test:unit

src/commands/fix/cmd-fix.integration.test.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ describe('socket fix', async () => {
167167
--autopilot Enable auto-merge for pull requests that Socket opens.
168168
See GitHub documentation (https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-auto-merge-for-pull-requests-in-your-repository) for managing auto-merge for pull requests in your repository.
169169
--debug Enable debug logging in the Coana-based Socket Fix CLI invocation.
170+
--disable-external-tool-checks Disable external tool checks during fix analysis.
170171
--ecosystems Limit fix analysis to specific ecosystems. Can be provided as comma separated values or as multiple flags. Defaults to all ecosystems.
171172
--exclude Exclude workspaces matching these glob patterns. Can be provided as comma separated values or as multiple flags
172173
--fix-version Override the version of @coana-tech/cli used for fix analysis. Default: <coana-version>.

src/commands/fix/handle-fix-limit.test.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ describe('socket fix --pr-limit behavior verification', () => {
217217
})
218218

219219
expect(result.ok).toBe(true)
220-
expect(result.data?.fixed).toBe(false)
220+
expect(result.data?.fixedAll).toBe(false)
221221

222222
// Only discovery call, no fix call since no GHSAs found.
223223
expect(mockSpawnCoanaDlx).toHaveBeenCalledTimes(1)
@@ -374,7 +374,7 @@ describe('socket fix --pr-limit behavior verification', () => {
374374
})
375375

376376
expect(result.ok).toBe(true)
377-
expect(result.data?.fixed).toBe(false)
377+
expect(result.data?.fixedAll).toBe(false)
378378

379379
// With 5 open PRs and prLimit 3, adjusted limit is 0, so no processing.
380380
expect(mockSpawnCoanaDlx).not.toHaveBeenCalled()

src/commands/scan/cmd-scan-create.test.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ describe('socket scan create', async () => {
6161
--reach-debug Enable debug mode for reachability analysis. Provides verbose logging from the reachability CLI.
6262
--reach-detailed-analysis-log-file A log file with detailed analysis logs is written to root of each analyzed workspace.
6363
--reach-disable-analytics Disable reachability analytics sharing with Socket. Also disables caching-based optimizations.
64+
--reach-disable-external-tool-checks Disable external tool checks during reachability analysis.
6465
--reach-ecosystems List of ecosystems to conduct reachability analysis on, as either a comma separated value or as multiple flags. Defaults to all ecosystems.
6566
--reach-enable-analysis-splitting Allow the reachability analysis to partition CVEs into buckets that are processed in separate analysis runs. May improve accuracy, but not recommended by default.
6667
--reach-exclude-paths List of paths to exclude from reachability analysis, as either a comma separated value or as multiple flags.

src/commands/scan/cmd-scan-reach.test.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ describe('socket scan reach', async () => {
4343
--reach-debug Enable debug mode for reachability analysis. Provides verbose logging from the reachability CLI.
4444
--reach-detailed-analysis-log-file A log file with detailed analysis logs is written to root of each analyzed workspace.
4545
--reach-disable-analytics Disable reachability analytics sharing with Socket. Also disables caching-based optimizations.
46+
--reach-disable-external-tool-checks Disable external tool checks during reachability analysis.
4647
--reach-ecosystems List of ecosystems to conduct reachability analysis on, as either a comma separated value or as multiple flags. Defaults to all ecosystems.
4748
--reach-enable-analysis-splitting Allow the reachability analysis to partition CVEs into buckets that are processed in separate analysis runs. May improve accuracy, but not recommended by default.
4849
--reach-exclude-paths List of paths to exclude from reachability analysis, as either a comma separated value or as multiple flags.

0 commit comments

Comments
 (0)