Skip to content

Commit 5a50f7c

Browse files
committed
Merge remote-tracking branch 'origin/feature/vsc-ci' into feature/vsc-ext-native-improvements
2 parents 996d73c + 94f508d commit 5a50f7c

5 files changed

Lines changed: 137 additions & 4 deletions

File tree

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: VS Extension Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'packages/b2c-vs-extension/**'
9+
pull_request:
10+
branches:
11+
- main
12+
paths:
13+
- 'packages/b2c-vs-extension/**'
14+
15+
permissions:
16+
contents: read
17+
18+
env:
19+
SFCC_DISABLE_TELEMETRY: ${{ vars.SFCC_DISABLE_TELEMETRY }}
20+
21+
jobs:
22+
test:
23+
runs-on: ubuntu-latest
24+
25+
strategy:
26+
matrix:
27+
node-version: [22.x]
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
33+
- name: Setup Node.js ${{ matrix.node-version }}
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: ${{ matrix.node-version }}
37+
38+
- name: Setup pnpm
39+
uses: pnpm/action-setup@v4
40+
with:
41+
version: 10.17.1
42+
43+
- name: Get pnpm store directory
44+
shell: bash
45+
run: |
46+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
47+
48+
- name: Setup pnpm cache
49+
uses: actions/cache@v4
50+
with:
51+
path: ${{ env.STORE_PATH }}
52+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
53+
restore-keys: |
54+
${{ runner.os }}-pnpm-store-
55+
56+
- name: Install dependencies
57+
run: pnpm install --frozen-lockfile
58+
59+
- name: Build packages
60+
run: pnpm -r run build
61+
62+
- name: Run VS Extension tests
63+
working-directory: packages/b2c-vs-extension
64+
run: xvfb-run -a pnpm run test

.github/workflows/ci.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,11 @@ jobs:
7575
working-directory: packages/b2c-cli
7676
run: pnpm run pretest && pnpm run test:ci && pnpm run lint
7777

78-
- name: Run VS Extension lint
78+
- name: Run VS Extension checks
7979
id: vs-extension-test
80-
if: always() && steps.vs-extension-test.conclusion != 'cancelled'
80+
if: always() && steps.cli-test.conclusion != 'cancelled'
8181
working-directory: packages/b2c-vs-extension
82-
# Testing not currently supported on CI
83-
run: pnpm run lint
82+
run: pnpm run typecheck:agent && pnpm run lint
8483

8584
- name: Test Report
8685
uses: dorny/test-reporter@fe45e9537387dac839af0d33ba56eed8e24189e8 # v2.3.0

.github/workflows/publish.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,17 @@ jobs:
8181
check_package "@salesforce/b2c-cli" "packages/b2c-cli" "cli"
8282
check_package "@salesforce/b2c-dx-mcp" "packages/b2c-dx-mcp" "mcp"
8383
84+
# VS Code extension — compare against git tags (not npm)
85+
LOCAL_VSX_VERSION=$(node -p "require('./packages/b2c-vs-extension/package.json').version")
86+
LAST_VSX_TAG=$(git tag -l "b2c-vs-extension@*" --sort=-v:refname | head -1 | sed 's/b2c-vs-extension@//')
87+
echo "b2c-vs-extension: local=${LOCAL_VSX_VERSION} tag=${LAST_VSX_TAG:-none}"
88+
if [ "$LOCAL_VSX_VERSION" != "$LAST_VSX_TAG" ]; then
89+
echo "publish_vsx=true" >> $GITHUB_OUTPUT
90+
echo "version_vsx=${LOCAL_VSX_VERSION}" >> $GITHUB_OUTPUT
91+
else
92+
echo "publish_vsx=false" >> $GITHUB_OUTPUT
93+
fi
94+
8495
- name: Create snapshot versions
8596
if: steps.release-type.outputs.type == 'nightly'
8697
run: |
@@ -114,6 +125,11 @@ jobs:
114125
if: steps.release-type.outputs.type == 'nightly' || steps.packages.outputs.publish_mcp == 'true'
115126
run: pnpm --filter @salesforce/b2c-dx-mcp publish --provenance --no-git-checks --tag ${{ steps.release-type.outputs.tag }}
116127

128+
- name: Package VS Code extension
129+
if: steps.release-type.outputs.type == 'stable' && steps.packages.outputs.publish_vsx == 'true'
130+
working-directory: packages/b2c-vs-extension
131+
run: pnpm run package
132+
117133
- name: Create git tags
118134
if: steps.release-type.outputs.type == 'stable'
119135
run: |
@@ -140,6 +156,12 @@ jobs:
140156
TAGS_CREATED="$TAGS_CREATED $TAG"
141157
fi
142158
159+
if [[ "${{ steps.packages.outputs.publish_vsx }}" == "true" ]]; then
160+
TAG="b2c-vs-extension@${{ steps.packages.outputs.version_vsx }}"
161+
git tag "$TAG"
162+
TAGS_CREATED="$TAGS_CREATED $TAG"
163+
fi
164+
143165
if [ -n "$TAGS_CREATED" ]; then
144166
git push origin $TAGS_CREATED
145167
echo "Created tags:$TAGS_CREATED"
@@ -180,6 +202,13 @@ jobs:
180202
extract_latest packages/b2c-tooling-sdk/CHANGELOG.md
181203
echo ""
182204
fi
205+
206+
if [[ "${{ steps.packages.outputs.publish_vsx }}" == "true" ]]; then
207+
echo "## b2c-vs-extension@${{ steps.packages.outputs.version_vsx }}"
208+
echo ""
209+
extract_latest packages/b2c-vs-extension/CHANGELOG.md
210+
echo ""
211+
fi
183212
} > /tmp/release-notes.md
184213
185214
- name: Create GitHub Release
@@ -192,6 +221,8 @@ jobs:
192221
RELEASE_TAG="@salesforce/b2c-tooling-sdk@${{ steps.packages.outputs.version_sdk }}"
193222
elif [[ "${{ steps.packages.outputs.publish_mcp }}" == "true" ]]; then
194223
RELEASE_TAG="@salesforce/b2c-dx-mcp@${{ steps.packages.outputs.version_mcp }}"
224+
elif [[ "${{ steps.packages.outputs.publish_vsx }}" == "true" ]]; then
225+
RELEASE_TAG="b2c-vs-extension@${{ steps.packages.outputs.version_vsx }}"
195226
else
196227
echo "No packages published, skipping release"
197228
exit 0
@@ -223,6 +254,8 @@ jobs:
223254
RELEASE_TAG="@salesforce/b2c-tooling-sdk@${{ steps.packages.outputs.version_sdk }}"
224255
elif [[ "${{ steps.packages.outputs.publish_mcp }}" == "true" ]]; then
225256
RELEASE_TAG="@salesforce/b2c-dx-mcp@${{ steps.packages.outputs.version_mcp }}"
257+
elif [[ "${{ steps.packages.outputs.publish_vsx }}" == "true" ]]; then
258+
RELEASE_TAG="b2c-vs-extension@${{ steps.packages.outputs.version_vsx }}"
226259
else
227260
echo "No release to upload to"
228261
exit 0
@@ -231,3 +264,24 @@ jobs:
231264
gh release upload "$RELEASE_TAG" b2c-skills.zip b2c-cli-skills.zip
232265
env:
233266
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
267+
268+
- name: Upload VS Code extension to release
269+
if: steps.release-type.outputs.type == 'stable' && steps.packages.outputs.publish_vsx == 'true'
270+
run: |
271+
# Determine the release tag (same logic as Create GitHub Release)
272+
if [[ "${{ steps.packages.outputs.publish_cli }}" == "true" ]]; then
273+
RELEASE_TAG="@salesforce/b2c-cli@${{ steps.packages.outputs.version_cli }}"
274+
elif [[ "${{ steps.packages.outputs.publish_sdk }}" == "true" ]]; then
275+
RELEASE_TAG="@salesforce/b2c-tooling-sdk@${{ steps.packages.outputs.version_sdk }}"
276+
elif [[ "${{ steps.packages.outputs.publish_mcp }}" == "true" ]]; then
277+
RELEASE_TAG="@salesforce/b2c-dx-mcp@${{ steps.packages.outputs.version_mcp }}"
278+
elif [[ "${{ steps.packages.outputs.publish_vsx }}" == "true" ]]; then
279+
RELEASE_TAG="b2c-vs-extension@${{ steps.packages.outputs.version_vsx }}"
280+
else
281+
echo "No release to upload to"
282+
exit 0
283+
fi
284+
285+
gh release upload "$RELEASE_TAG" packages/b2c-vs-extension/*.vsix
286+
env:
287+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

packages/b2c-vs-extension/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@
321321
"typecheck:agent": "tsc -p . --noEmit --pretty false",
322322
"format": "prettier --write src",
323323
"format:check": "prettier --check src",
324+
"pretest": "tsc -p tsconfig.test.json",
324325
"test": "vscode-test",
325326
"posttest": "pnpm run lint",
326327
"analyze": "ANALYZE_BUNDLE=1 node scripts/esbuild-bundle.mjs"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"compilerOptions": {
3+
"module": "Node16",
4+
"target": "ES2022",
5+
"outDir": "out/test",
6+
"lib": ["ES2022"],
7+
"sourceMap": true,
8+
"rootDir": "src/test",
9+
"strict": true,
10+
"skipLibCheck": true,
11+
"esModuleInterop": true,
12+
"forceConsistentCasingInFileNames": true
13+
},
14+
"include": ["src/test"]
15+
}

0 commit comments

Comments
 (0)