Skip to content

chore(release): prepare Socket CLI 2.1.1-rc.0 #4235

chore(release): prepare Socket CLI 2.1.1-rc.0

chore(release): prepare Socket CLI 2.1.1-rc.0 #4235

Workflow file for this run

name: CI
on:
push:
branches: [v1.x]
pull_request:
branches: [v1.x]
workflow_dispatch:
inputs:
refresh-native-cache:
description: Refresh native download cache
type: boolean
required: false
default: false
# Stop superseded PR runs before they reach the expensive matrices.
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
cache-mode: read
jobs:
lint:
name: 🧹 Lint Check
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
actions: write
contents: read
steps:
- name: Checkout source
shell: bash
env:
CHECKOUT_REF: ${{ github.sha }}
GITHUB_TOKEN: ${{ github.token }}
SERVER_URL: ${{ github.server_url }}
REPOSITORY: ${{ github.repository }}
run: |
set -euo pipefail
git init -q
git config --local advice.detachedHead false
git remote add origin "${SERVER_URL}/${REPOSITORY}"
AUTH_B64="$(printf 'x-access-token:%s' "$GITHUB_TOKEN" | base64 | tr -d '\n')"
export GIT_CONFIG_COUNT=1
export GIT_CONFIG_KEY_0="http.${SERVER_URL}/.extraheader"
export GIT_CONFIG_VALUE_0="AUTHORIZATION: basic ${AUTH_B64}"
git fetch --no-tags --depth=1 origin "$CHECKOUT_REF"
git checkout -q --detach FETCH_HEAD
- name: Check CLI executable line endings
run: bash scripts/ci/check-bin-eol.sh
- name: Install release toolchain
shell: bash
run: bash scripts/setup/release-tools.sh
- name: Set up Socket Firewall
shell: bash
env:
GH_TOKEN: ${{ github.token }}
SOCKET_API_KEY: ${{ secrets.SOCKET_API_TOKEN_FOR_CLI_AND_SFW }} # zizmor: ignore[secrets-outside-env]
run: bash scripts/setup/firewall.sh
- name: Install dependencies
run: pnpm install --loglevel error
- name: Lint
run: pnpm run check:ci
- &cancel_workflow_on_failure
name: Cancel remaining CI jobs after failure
if: ${{ failure() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: gh run cancel "$GITHUB_RUN_ID" --repo "$GITHUB_REPOSITORY"
typecheck:
name: 🔍 Type Check
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
actions: write
contents: read
steps:
- name: Checkout source
shell: bash
env:
CHECKOUT_REF: ${{ github.sha }}
GITHUB_TOKEN: ${{ github.token }}
SERVER_URL: ${{ github.server_url }}
REPOSITORY: ${{ github.repository }}
run: |
set -euo pipefail
git init -q
git config --local advice.detachedHead false
git remote add origin "${SERVER_URL}/${REPOSITORY}"
AUTH_B64="$(printf 'x-access-token:%s' "$GITHUB_TOKEN" | base64 | tr -d '\n')"
export GIT_CONFIG_COUNT=1
export GIT_CONFIG_KEY_0="http.${SERVER_URL}/.extraheader"
export GIT_CONFIG_VALUE_0="AUTHORIZATION: basic ${AUTH_B64}"
git fetch --no-tags --depth=1 origin "$CHECKOUT_REF"
git checkout -q --detach FETCH_HEAD
- name: Install release toolchain
shell: bash
run: bash scripts/setup/release-tools.sh
- name: Set up Socket Firewall
shell: bash
env:
GH_TOKEN: ${{ github.token }}
SOCKET_API_KEY: ${{ secrets.SOCKET_API_TOKEN_FOR_CLI_AND_SFW }} # zizmor: ignore[secrets-outside-env]
run: bash scripts/setup/firewall.sh
- name: Install dependencies
run: pnpm install --loglevel error
- name: Type check
run: pnpm run check:tsc
- *cancel_workflow_on_failure
test:
needs: [lint, typecheck]
name: ${{ matrix.suite == 'e2e' && format('e2e-tests ({0}, {1})', matrix.node-version == 26 && '26.13.0' || matrix.node-version, matrix.os) || format('🧪 Tests • {0} • Node {1} • {2}', matrix.os, matrix.node-version, matrix.shell) }}
runs-on: ${{ matrix.os }}
timeout-minutes: ${{ matrix.suite == 'e2e' && 20 || matrix.timeout }}
permissions:
actions: write
contents: read
strategy:
fail-fast: true
matrix:
suite: ${{ fromJSON(github.event_name == 'pull_request' && '["regular", "e2e"]' || '["regular"]') }}
lane: [linux-22, linux-24, linux-26, windows-bash, windows-pwsh]
exclude:
- suite: e2e
lane: windows-bash
- suite: e2e
lane: windows-pwsh
include:
- lane: linux-22
os: ubuntu-latest
node-version: 22
shell: bash
timeout: 15
- lane: linux-24
os: ubuntu-latest
node-version: 24
shell: bash
timeout: 15
- lane: linux-26
os: ubuntu-latest
node-version: 26
shell: bash
timeout: 15
- lane: windows-bash
os: windows-2022
node-version: 24
shell: bash
timeout: 90
- lane: windows-pwsh
os: windows-2022
node-version: 24
shell: pwsh
timeout: 90
steps:
- &test-checkout
name: Checkout source
shell: bash
env:
CHECKOUT_REF: ${{ github.sha }}
GITHUB_TOKEN: ${{ github.token }}
SERVER_URL: ${{ github.server_url }}
REPOSITORY: ${{ github.repository }}
run: |
set -euo pipefail
git init -q
git config --local advice.detachedHead false
git remote add origin "${SERVER_URL}/${REPOSITORY}"
AUTH_B64="$(printf 'x-access-token:%s' "$GITHUB_TOKEN" | base64 | tr -d '\n')"
export GIT_CONFIG_COUNT=1
export GIT_CONFIG_KEY_0="http.${SERVER_URL}/.extraheader"
export GIT_CONFIG_VALUE_0="AUTHORIZATION: basic ${AUTH_B64}"
git fetch --no-tags --depth=1 origin "$CHECKOUT_REF"
git checkout -q --detach FETCH_HEAD
- name: Install Node.js • Linux
if: runner.os == 'Linux'
shell: bash
env:
NODE_VERSION: ${{ matrix.suite == 'e2e' && matrix.node-version == 26 && '26.13.0' || matrix.node-version }}
run: node scripts/setup/node.mts --version "$NODE_VERSION"
- &test-windows-node
name: Install Node.js • Windows
if: runner.os == 'Windows'
shell: pwsh
run: |
$nodeMajor = '${{ matrix.node-version }}'
$release = Invoke-RestMethod -Uri 'https://nodejs.org/dist/index.json' -ErrorAction Stop
$release = $release |
Where-Object {
$_.version -match '^v?(\d+)\.(\d+)\.(\d+)$' -and
[int]$Matches[1] -eq [int]$nodeMajor
} |
Sort-Object { [version]$_.version.TrimStart('v') } -Descending |
Select-Object -First 1
if (-not $release) {
throw "No stable Node.js release found for major $nodeMajor"
}
$nodeVersion = $release.version.TrimStart('v')
$tools = Join-Path $env:RUNNER_TEMP 'windows-node'
New-Item -ItemType Directory -Force $tools | Out-Null
$archive = "node-v$nodeVersion-win-x64.zip"
$releaseUrl = "https://nodejs.org/dist/v$nodeVersion"
$archivePath = Join-Path $tools $archive
$checksums = Invoke-WebRequest -Uri "$releaseUrl/SHASUMS256.txt" -ErrorAction Stop
$assetPattern = "(?m)^([a-fA-F0-9]{64})\s+\*?$([Regex]::Escape($archive))\s*$"
$checksumMatches = [Regex]::Matches($checksums.Content, $assetPattern)
if ($checksumMatches.Count -ne 1) {
throw "Expected one SHA-256 checksum for $archive"
}
Invoke-WebRequest -Uri "$releaseUrl/$archive" -OutFile $archivePath -ErrorAction Stop
$expectedHash = $checksumMatches[0].Groups[1].Value.ToLowerInvariant()
if ((Get-FileHash $archivePath -Algorithm SHA256).Hash.ToLowerInvariant() -ne $expectedHash) {
throw "Checksum mismatch for $archive"
}
Expand-Archive $archivePath $tools
(Join-Path $tools "node-v$nodeVersion-win-x64") | Add-Content $env:GITHUB_PATH
- &test-package-managers
name: Install pinned package managers
shell: bash
run: bash scripts/setup/release-tools.sh --keep-node
- name: Install uv
if: matrix.suite == 'e2e'
run: pnpm run ci:setup-uv
- &test-socket-firewall
name: Set up Socket Firewall
shell: bash
env:
GH_TOKEN: ${{ github.token }}
SOCKET_API_KEY: ${{ secrets.SOCKET_API_TOKEN_FOR_CLI_AND_SFW }} # zizmor: ignore[secrets-outside-env]
run: bash scripts/setup/firewall.sh
- name: Install dependencies • Bash
if: matrix.shell == 'bash'
shell: bash
run: pnpm install --loglevel error ${{ runner.os == 'Windows' && '--config.enable-global-virtual-store=false' || '' }}
- &test-pwsh-dependencies
name: Install dependencies • PowerShell
if: matrix.shell == 'pwsh'
shell: pwsh
run: pnpm install --loglevel error --config.enable-global-virtual-store=false
- name: Run full unit and integration suite • Bash
if: matrix.suite == 'regular' && matrix.shell == 'bash'
shell: bash
run: pnpm run test:ci
- name: Run full unit and integration suite • PowerShell
if: matrix.suite == 'regular' && matrix.shell == 'pwsh'
shell: pwsh
run: pnpm run test:ci
- name: Install the minimum supported Node.js for the built CLI
if: matrix.suite == 'regular' && matrix.lane == 'linux-22'
shell: bash
run: node scripts/setup/node.mts --version 18.20.8
- name: Check CLI startup on Node.js 18
if: matrix.suite == 'regular' && matrix.lane == 'linux-22'
shell: bash
run: |
test "$(node --version)" = v18.20.8
test "$(node bin/cli.js --version)" = "$(node -p "require('./package.json').version")"
- name: Build for E2E tests
if: matrix.suite == 'e2e'
run: pnpm run build
- name: Run E2E tests
if: matrix.suite == 'e2e'
env:
SOCKET_CLI_API_TOKEN: ${{ secrets.SOCKET_API_TOKEN_FOR_CLI_AND_SFW }} # zizmor: ignore[secrets-outside-env]
run: pnpm run test:e2e --bail=1
- *cancel_workflow_on_failure
bazel-windows:
name: Windows Bazel Maven manifests
needs: test
runs-on: windows-2022
timeout-minutes: 30
permissions:
actions: write
contents: read
strategy:
fail-fast: true
matrix:
node-version: [24]
shell: [pwsh]
steps:
- *test-checkout
- *test-windows-node
- *test-package-managers
- *test-socket-firewall
- *test-pwsh-dependencies
- name: Install Bazel test tools
shell: pwsh
run: |
$tools = Join-Path $env:RUNNER_TEMP 'bazel-tools'
New-Item -ItemType Directory -Force "$tools/bin" | Out-Null
function Get-VerifiedTool($url, $file, $sha256) {
Invoke-WebRequest -Uri $url -OutFile $file
if ((Get-FileHash $file -Algorithm SHA256).Hash.ToLowerInvariant() -ne $sha256) {
throw "Checksum mismatch for $file"
}
}
Get-VerifiedTool 'https://api.nuget.org/v3-flatcontainer/python/3.12.10/python.3.12.10.nupkg' "$tools/python.zip" '0eb85c2dfccccf1b17352de4c397f69194035b7d37149eacc16f1147d93de3b8'
Get-VerifiedTool 'https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.6%2B7/OpenJDK21U-jdk_x64_windows_hotspot_21.0.6_7.zip' "$tools/java.zip" '897c8eebb0f85a99ccecbd482ebae9a45d88c19d6077054f6529ebab49b6d259'
Get-VerifiedTool 'https://github.com/bazelbuild/bazelisk/releases/download/v1.26.0/bazelisk-windows-amd64.exe' "$tools/bin/bazelisk.exe" '023734f33ed6b9c6d65468fe20bb2c5fb32473ccb8aca2fc5bf1521e61ce1622'
Expand-Archive "$tools/python.zip" "$tools/python"
Expand-Archive "$tools/java.zip" "$tools/java"
"$tools/python/tools" | Add-Content $env:GITHUB_PATH
"$tools/java/jdk-21.0.6+7/bin" | Add-Content $env:GITHUB_PATH
"$tools/bin" | Add-Content $env:GITHUB_PATH
"JAVA_HOME=$tools/java/jdk-21.0.6+7" | Add-Content $env:GITHUB_ENV
'USE_BAZEL_VERSION=7.4.1' | Add-Content $env:GITHUB_ENV
'SOCKET_BAZEL_OUTPUT_ROOT=C:/sb' | Add-Content $env:GITHUB_ENV
New-Item -ItemType Directory -Force 'C:/sb' | Out-Null
- name: Record Bazel test tool versions
shell: pwsh
run: |
$PSNativeCommandUseErrorActionPreference = $true
node --version
pnpm --version
bazelisk --version
python --version
java -version
Write-Output "PowerShell $($PSVersionTable.PSVersion)"
- name: Build the packaged CLI
shell: pwsh
run: pnpm run build:dist:src
- name: Install the packaged CLI
shell: pwsh
run: |
$PSNativeCommandUseErrorActionPreference = $true
$packages = Join-Path $env:RUNNER_TEMP 'bazel-packages'
$installation = Join-Path $env:RUNNER_TEMP 'bazel-installation'
New-Item -ItemType Directory -Force $packages, $installation | Out-Null
pnpm pack --pack-destination $packages
$tarball = Get-ChildItem "$packages/*.tgz" | Select-Object -First 1
npm install --ignore-scripts --no-audit --no-fund --prefix $installation $tarball.FullName
"SOCKET_BAZEL_TEST_CLI=$installation/node_modules/socket/bin/cli.js" | Add-Content $env:GITHUB_ENV
- name: Verify Bazel Maven manifests
shell: pwsh
env:
SOCKET_BAZEL_E2E: '1'
SFW_CUSTOM_REGISTRIES: 'bypass:bcr.bazel.build,bypass:release-assets.githubusercontent.com,bypass:repo.maven.apache.org,bypass:repo1.maven.org'
run: |
$PSNativeCommandUseErrorActionPreference = $true
pnpm exec vitest run --config .config/vitest.e2e.config.mts src/commands/manifest/bazel/bazel-native.e2e.test.mts
- *cancel_workflow_on_failure
native-cli-pr:
needs: test
name: Native CLI tests • Cache read-only • No Apple signing
if: github.event_name == 'pull_request' && github.base_ref == 'v1.x'
runs-on: ${{ matrix.os }}
timeout-minutes: 60
permissions:
actions: write
contents: read
concurrency: &native_concurrency
group: native-cli-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.target }}
cancel-in-progress: true
strategy: &native_strategy
fail-fast: true
matrix:
include:
- os: ubuntu-24.04
target: linux-x64
- os: macos-15
target: darwin-arm64
- os: windows-2025
target: win-x64
steps: &native_steps
- name: Checkout source
shell: bash
env:
CHECKOUT_REF: ${{ github.sha }}
GITHUB_TOKEN: ${{ github.token }}
SERVER_URL: ${{ github.server_url }}
REPOSITORY: ${{ github.repository }}
run: |
set -euo pipefail
git init -q
git config --local advice.detachedHead false
git remote add origin "${SERVER_URL}/${REPOSITORY}"
AUTH_B64="$(printf 'x-access-token:%s' "$GITHUB_TOKEN" | base64 | tr -d '\n')"
export GIT_CONFIG_COUNT=1
export GIT_CONFIG_KEY_0="http.${SERVER_URL}/.extraheader"
export GIT_CONFIG_VALUE_0="AUTHORIZATION: basic ${AUTH_B64}"
git fetch --no-tags --depth=1 origin "$CHECKOUT_REF"
git checkout -q --detach FETCH_HEAD
- name: Install release toolchain
shell: bash
run: bash scripts/setup/release-tools.sh
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Restore pinned SEA download cache
id: sea-download-cache
uses: ./.github/actions/repo/cache-downloads
with:
mode: restore
path: ~/.cache/socket-sea/downloads/v1/blobs
key: sea-downloads-v1-${{ matrix.target }}-${{ hashFiles('pnpm-lock.yaml', 'src/sea/stage/uv-pins.json', 'src/sea/build-sea.mts') }}${{ inputs.refresh-native-cache && format('-refresh-{0}-{1}', github.run_id, github.run_attempt) || '' }}
restore-keys: |
sea-downloads-v1-${{ matrix.target }}-
- name: Test screenshot and signing helpers
id: terminal-helpers
env:
SOCKET_CLI_NATIVE_TEST_ARTIFACTS: &terminal_artifacts build/terminal-test-artifacts/${{ matrix.target }}
NODE_OPTIONS: ${{ matrix.target == 'darwin-arm64' && '--max-old-space-size=4096' || '' }}
shell: bash
run: |
pnpm exec vitest run --config .config/vitest.config.mts test/unit/scripts/test/apple-signing.test.mts
pnpm exec vitest run --config .config/vitest.terminal.config.mts
- name: Show failed scan setup screenshots
if: failure() && steps.terminal-helpers.outcome == 'failure'
env:
SOCKET_CLI_NATIVE_TEST_ARTIFACTS: *terminal_artifacts
shell: bash
run: |
python - <<'PYTHON'
import os
import pathlib
import sys
import xml.etree.ElementTree as ET
sys.stdout.reconfigure(encoding='utf-8')
for svg in (pathlib.Path(os.environ['SOCKET_CLI_NATIVE_TEST_ARTIFACTS']) / 'npm-scan-setup').glob('*.svg'):
if svg.name in ('menu.svg', 'canceled.svg'):
print(svg.name)
for row in ET.parse(svg).iter('{http://www.w3.org/2000/svg}text'):
print(''.join(row.itertext()).rstrip())
PYTHON
- name: Build and check the native executable
env:
NODE_OPTIONS: ${{ matrix.target == 'darwin-arm64' && '--max-old-space-size=4096' || '' }}
run: pnpm run build:sea
- name: Save pinned SEA download cache
if: success() && steps.sea-download-cache.outputs.cache-hit != 'true' && github.repository == 'SocketDev/socket-cli' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/v1.x' || github.ref == 'refs/heads/feat/v1x-node27-sea-vfs-socket' || startsWith(github.ref, 'refs/heads/test/native-terminal-validation-'))
uses: ./.github/actions/repo/cache-downloads
with:
mode: save
path: ~/.cache/socket-sea/downloads/v1/blobs
key: sea-downloads-v1-${{ matrix.target }}-${{ hashFiles('pnpm-lock.yaml', 'src/sea/stage/uv-pins.json', 'src/sea/build-sea.mts') }}${{ inputs.refresh-native-cache && format('-refresh-{0}-{1}', github.run_id, github.run_attempt) || '' }}
- name: Run native screenshot tests
shell: bash
env:
SOCKET_CLI_NATIVE_TEST_ARTIFACTS: build/native-test-artifacts/${{ matrix.target }}
APPLE_DEVELOPER_ID_IDENTITY: ${{ matrix.target == 'darwin-arm64' && github.event_name != 'pull_request' && github.repository == 'SocketDev/socket-cli' && (github.ref == 'refs/heads/v1.x' || github.ref == 'refs/heads/feat/v1x-node27-sea-vfs-socket' || startsWith(github.ref, 'refs/heads/test/native-terminal-validation-')) && secrets.APPLE_DEVELOPER_ID_IDENTITY || '' }}
APPLE_TEAM_ID: ${{ matrix.target == 'darwin-arm64' && github.event_name != 'pull_request' && github.repository == 'SocketDev/socket-cli' && (github.ref == 'refs/heads/v1.x' || github.ref == 'refs/heads/feat/v1x-node27-sea-vfs-socket' || startsWith(github.ref, 'refs/heads/test/native-terminal-validation-')) && secrets.APPLE_TEAM_ID || '' }}
APPLE_DEVELOPER_ID_APPLICATION_CERTS_P12: ${{ matrix.target == 'darwin-arm64' && github.event_name != 'pull_request' && github.repository == 'SocketDev/socket-cli' && (github.ref == 'refs/heads/v1.x' || github.ref == 'refs/heads/feat/v1x-node27-sea-vfs-socket' || startsWith(github.ref, 'refs/heads/test/native-terminal-validation-')) && secrets.APPLE_DEVELOPER_ID_APPLICATION_CERTS_P12 || '' }}
APPLE_DEVELOPER_ID_APPLICATION_CERTS_P12_PASS: ${{ matrix.target == 'darwin-arm64' && github.event_name != 'pull_request' && github.repository == 'SocketDev/socket-cli' && (github.ref == 'refs/heads/v1.x' || github.ref == 'refs/heads/feat/v1x-node27-sea-vfs-socket' || startsWith(github.ref, 'refs/heads/test/native-terminal-validation-')) && secrets.APPLE_DEVELOPER_ID_APPLICATION_CERTS_P12_PASS || '' }}
SOCKET_CLI_NATIVE_TEST_REQUIRE_APPLE_SIGNATURE: ${{ matrix.target == 'darwin-arm64' && github.event_name != 'pull_request' && github.repository == 'SocketDev/socket-cli' && (github.ref == 'refs/heads/v1.x' || github.ref == 'refs/heads/feat/v1x-node27-sea-vfs-socket' || startsWith(github.ref, 'refs/heads/test/native-terminal-validation-')) && (secrets.APPLE_DEVELOPER_ID_IDENTITY != '' || secrets.APPLE_TEAM_ID != '' || secrets.APPLE_DEVELOPER_ID_APPLICATION_CERTS_P12 != '' || secrets.APPLE_DEVELOPER_ID_APPLICATION_CERTS_P12_PASS != '') && '1' || '' }}
run: |
set -euo pipefail
export SOCKET_CLI_NATIVE_TEST_ARTIFACTS
rm -rf "$SOCKET_CLI_NATIVE_TEST_ARTIFACTS"
mkdir -p "$SOCKET_CLI_NATIVE_TEST_ARTIFACTS"
pnpm run test:sea test/native/commands/cli.native.test.mts test/native/commands/cli-behavior.native.test.mts test/native/commands/tui.native.test.mts
- *cancel_workflow_on_failure
native-cli-writer:
needs: test
name: Native CLI tests • Cache writes • Apple signing available
cache-mode: write
if: github.repository == 'SocketDev/socket-cli' && ((github.event_name == 'push' && (github.ref == 'refs/heads/v1.x' || github.ref == 'refs/heads/feat/v1x-node27-sea-vfs-socket' || startsWith(github.ref, 'refs/heads/test/native-terminal-validation-'))) || (github.event_name == 'workflow_dispatch' && (github.ref == 'refs/heads/v1.x' || github.ref == 'refs/heads/feat/v1x-node27-sea-vfs-socket' || startsWith(github.ref, 'refs/heads/test/native-terminal-validation-'))))
runs-on: ${{ matrix.os }}
timeout-minutes: 60
permissions:
actions: write
contents: read
concurrency: *native_concurrency
strategy: *native_strategy
steps: *native_steps