Skip to content

feat: Add VS Code Extension CI/CD Infrastructure#158

Draft
madhur310 wants to merge 19 commits into
mainfrom
feat/add-vscode-extension-ci
Draft

feat: Add VS Code Extension CI/CD Infrastructure#158
madhur310 wants to merge 19 commits into
mainfrom
feat/add-vscode-extension-ci

Conversation

@madhur310
Copy link
Copy Markdown

Draft PR to test VS Code CI infrastructure. Will update description after testing.

madhur310 and others added 19 commits May 22, 2026 15:51
Add shared CI/CD tooling for Salesforce VS Code extensions:

## NPM Package: @salesforce/vscode-extension-ci
- TypeScript CLI with 13 commands for release automation
- Smart version bumping (even/odd minor for stable/pre-release)
- Conventional commit analysis
- Change detection and package selection
- GitHub release creation
- Configurable via environment variables:
  - PACKAGES_ROOT (default: packages)
  - TAG_PREFIX (default: marketplace)
  - AUDIT_LOG_DIR (default: .github/audit-logs)

## Composite Actions (.github/actions/vscode/)
- calculate-artifact-name: Artifact naming with run isolation
- check-ci-status: CI quality gate verification
- detect-packages: Auto-detect extensions and npm packages
- download-vsix-artifacts: VSIX artifact downloader
- npm-install-with-retries: Retry wrapper for npm ci
- publish-vsix: Marketplace publisher (vsce/ovsx)

## Reusable Workflows (.github/workflows/vscode/)
- ci-template.yml: Parameterized CI workflow
- package.yml: VSIX packaging with checksums
- publish-extensions.yml: Complete release pipeline
- promote-prerelease.yml: Nightly → pre-release promotion

## Usage
Consuming repos reference workflows via:
  uses: salesforcecli/github-workflows/.github/workflows/vscode/<name>.yml@main

Consuming repos install the CLI:
  npm install --save-dev @salesforce/vscode-extension-ci

## Testing
- Tested with npm link in apex-language-support
- CLI successfully detects VS Code extensions
- All TypeScript builds cleanly

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Two test workflows for validating the VS Code CI infrastructure:

1. test-vscode-ci.yml - Tests NPM package build and composite actions
   - Verifies CLI commands work
   - Tests package selector and build type detection
   - Validates composite actions (npm-install, detect-packages, etc.)

2. test-vscode-workflows.yml - Tests reusable workflows
   - Tests nightly workflow with dry-run
   - Tests prerelease promotion with dry-run
   - Tests package workflow (VSIX creation)
   - Tests CI template (lint, compile, test)

Both can be triggered manually from Actions tab on this branch.
Add dist/, *.tsbuildinfo, and other build artifacts to .gitignore.
These should be generated during build, not committed to git.
Build artifacts in dist/ should not be committed.
They are now properly excluded via .gitignore and will be
generated during npm build.
The test workflows were failing on push because workflow_dispatch inputs
are not available in push events. These workflows are only meant to be
run manually for testing purposes.
GitHub Actions requires reusable workflows to be at the top level
of .github/workflows/, not in subdirectories.

Changes:
- Moved vscode/* workflows to top level with 'vscode-' prefix
- Added push triggers to test workflows so they run automatically
- Made workflows work for both push and workflow_dispatch events
- apex-language-support tests run on push, salesforcedx-vscode on manual trigger
The previous test workflows had YAML syntax issues.
This simpler workflow just builds the NPM package and verifies the CLI works.

Tests:
- Package builds successfully
- CLI executable exists
- Help command works
- Required commands are present
Removed extends from root tsconfig to avoid module resolution conflicts.
The package now has its own complete TypeScript configuration.
Tests the complete VS Code CI infrastructure:
- Package workflow (VSIX creation)
- Composite actions (npm-install, detect-packages, calculate-artifact-name)
- CLI scripts (ext-package-selector, ext-build-type)

Run manually from Actions tab with workflow_dispatch.
Removed composite action tests since they require specific context.
Focus on testing the CLI scripts and VSIX packaging workflow.
GitHub was trying to run the workflow on push but it only had
workflow_dispatch, causing validation failures.
path must be under with: parameter block.
Removed all require() calls and replaced with proper ES module imports.
The package uses type: module so require() is not available.

Fixed in:
- core/utils.ts: added appendFileSync import
- core/audit-logger.ts: added mkdirSync import
- extension/ext-publish-matrix.ts: added readFileSync import
apex-language-support uses 'npm run package', not 'npm run vscode:package'
Changed relative paths (./.github/workflows/package.yml) to absolute
repository paths (salesforcecli/github-workflows/.github/workflows/vscode-package.yml@feat/add-vscode-extension-ci)

This fixes the issue where reusable workflows called from other repos
would fail with 'workflow was not found' errors because relative paths
resolve to the calling repo, not the workflow's repo.
Changed all composite action references from relative paths
(./.github/actions/vscode/*) to absolute repository paths
(salesforcecli/github-workflows/.github/actions/vscode/*@feat/add-vscode-extension-ci)

This fixes the issue where reusable workflows called from other repos
would fail because relative action paths resolve to the calling repo,
not the workflow's repo.

Fixes:
- npm-install-with-retries
- calculate-artifact-name
- check-ci-status
- publish-vsix

All workflows now properly reference actions from the github-workflows
repo when called cross-repo.
When installing from git, npm runs the 'prepare' script automatically.
This ensures the package is built without needing to commit dist/ files.

This allows consuming repos to install the package via:
npm install @salesforce/vscode-extension-ci@github:salesforcecli/github-workflows#feat/add-vscode-extension-ci
When the monorepo is installed from git, this ensures all packages
including vscode-extension-ci are built automatically.
Changed all 'npx vscode-ext-ci' calls to use the full path:
node node_modules/github-workflows/packages/vscode-extension-ci/dist/cli.js

This works when the package is installed from git as 'github-workflows'
rather than as '@salesforce/vscode-extension-ci'.

Once published to NPM, we can switch back to 'npx vscode-ext-ci'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant