-
Notifications
You must be signed in to change notification settings - Fork 42
104 lines (96 loc) · 3.28 KB
/
ci.yml
File metadata and controls
104 lines (96 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: 🚀 CI Pipeline
# Dependencies:
# - SocketDev/socket-registry/.github/workflows/ci.yml
on:
push:
branches: [main]
tags: ['*']
paths:
- 'packages/cli/**'
- 'pnpm-lock.yaml'
- 'package.json'
- '.github/workflows/ci.yml'
pull_request:
branches: [main]
paths:
- 'packages/cli/**'
- 'pnpm-lock.yaml'
- 'package.json'
- '.github/workflows/ci.yml'
workflow_dispatch:
inputs:
skip-tests:
description: 'Skip test execution'
required: false
type: boolean
default: false
node-versions:
description: 'Node.js versions to test (JSON array)'
required: false
type: string
default: '[20, 22, 24]'
permissions:
contents: read
jobs:
ci:
name: Run CI Pipeline
uses: SocketDev/socket-registry/.github/workflows/ci.yml@ed3c6104ebfbabb657432e79a7f77cf7d33df984 # 2025-10-31
with:
test-setup-script: 'pnpm --filter @socketsecurity/cli run build'
lint-script: 'pnpm --filter @socketsecurity/cli run check'
type-check-script: 'pnpm --filter @socketsecurity/cli run type'
test-script: ${{ inputs.skip-tests && 'echo "Tests skipped"' || 'pnpm --filter @socketsecurity/cli run test:unit' }}
node-versions: ${{ inputs.node-versions || '[20, 22, 24]' }}
os-versions: '["ubuntu-latest", "macos-latest", "windows-latest"]'
fail-fast: false
# Increase parallelization for socket-cli's longer test suite (~48s).
# Default is 4, we increase to 8 for better performance.
max-parallel: 8
# Increase timeout for slower subprocess-heavy tests.
test-timeout-minutes: 20
# Sharded unit tests (optional, enable for faster CI).
# To enable: uncomment this job and set `run-test: false` in the ci job above.
# test-sharded:
# name: Unit Tests (Sharded ${{ matrix.shard }}/3)
# runs-on: ${{ matrix.os }}
# timeout-minutes: 15
# strategy:
# fail-fast: false
# matrix:
# node-version: ${{ fromJSON(inputs.node-versions || '[20, 22, 24]') }}
# os: [ubuntu-latest, macos-latest, windows-latest]
# shard: [1, 2, 3]
# steps:
# - uses: SocketDev/socket-registry/.github/actions/setup-and-install@51be85d39d3b4a42dd9d4712948b9d30a2e04794
# with:
# node-version: ${{ matrix.node-version }}
#
# - name: Build CLI
# working-directory: packages/cli
# run: pnpm run build
#
# - name: Run unit tests (shard ${{ matrix.shard }})
# working-directory: packages/cli
# run: pnpm test:unit --shard=${{ matrix.shard }}/3
e2e:
name: E2E Tests
needs: ci
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: true
matrix:
node-version: ${{ fromJSON(inputs.node-versions || '[20, 22, 24]') }}
os: [ubuntu-latest]
steps:
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@51be85d39d3b4a42dd9d4712948b9d30a2e04794
with:
node-version: ${{ matrix.node-version }}
- name: Build CLI
working-directory: packages/cli
run: pnpm run build
- name: Run e2e tests
working-directory: packages/cli
env:
SOCKET_CLI_API_TOKEN: ${{ secrets.SOCKET_CLI_API_TOKEN }}
run: pnpm run e2e-tests