Skip to content

Commit c198a25

Browse files
authored
Bump extension version (#1756)
1 parent 30e91e8 commit c198a25

File tree

22 files changed

+231
-215
lines changed

22 files changed

+231
-215
lines changed

.github/workflows/nightly.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,8 @@ jobs:
6666
windows_env_vars: |
6767
CI=1
6868
VSCODE_SWIFT_VSIX_ID=${{needs.package.outputs.artifact-id}}
69-
VSCODE_SWIFT_VSIX=vscode-swift.vsix
7069
GITHUB_REPOSITORY=${{github.repository}}
71-
windows_pre_build_command: .github\workflows\scripts\windows\setup.ps1
70+
windows_pre_build_command: . .github\workflows\scripts\windows\setup.ps1
7271
windows_build_command: scripts\test_windows.ps1
7372
enable_windows_docker: false
7473

@@ -87,6 +86,7 @@ jobs:
8786
CI=1
8887
VSCODE_VERSION=insiders
8988
VSCODE_SWIFT_VSIX_ID=${{needs.package.outputs.artifact-id}}
89+
VSCODE_SWIFT_VSIX_PRERELEASE=1
9090
GITHUB_REPOSITORY=${{github.repository}}
9191
linux_pre_build_command: . .github/workflows/scripts/setup-linux.sh
9292
linux_build_command: ./scripts/test.sh
@@ -96,8 +96,8 @@ jobs:
9696
CI=1
9797
VSCODE_VERSION=insiders
9898
VSCODE_SWIFT_VSIX_ID=${{needs.package.outputs.artifact-id}}
99-
VSCODE_SWIFT_PRERELEASE_VSIX=vscode-swift-prerelease.vsix
99+
VSCODE_SWIFT_VSIX_PRERELEASE=1
100100
GITHUB_REPOSITORY=${{github.repository}}
101-
windows_pre_build_command: .github\workflows\scripts\windows\setup.ps1
101+
windows_pre_build_command: . .github\workflows\scripts\windows\setup.ps1
102102
windows_build_command: scripts\test_windows.ps1
103103
enable_windows_docker: false

.github/workflows/pull_request.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ jobs:
2323
. .github/workflows/scripts/setup-linux.sh
2424
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
2525
npm ci
26-
npm run package
27-
npm run preview-package
26+
npm run dev-package
2827
for file in *.vsix; do
2928
name="$(basename "$file" .vsix)-${{github.run_number}}.vsix"
3029
echo "Created bundle $name"
@@ -67,9 +66,8 @@ jobs:
6766
CI=1
6867
FAST_TEST_RUN=${{ contains(github.event.pull_request.labels.*.name, 'full-test-run') && '0' || '1'}}
6968
VSCODE_SWIFT_VSIX_ID=${{needs.package.outputs.artifact-id}}
70-
VSCODE_SWIFT_VSIX=vscode-swift.vsix
7169
GITHUB_REPOSITORY=${{github.repository}}
72-
windows_pre_build_command: .github\workflows\scripts\windows\setup.ps1
70+
windows_pre_build_command: . .github\workflows\scripts\windows\setup.ps1
7371
windows_build_command: scripts\test_windows.ps1
7472
enable_windows_docker: false
7573

.github/workflows/scripts/setup-linux.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,4 @@ env | sort
2929
if [ -n "$VSCODE_SWIFT_VSIX_ID" ]; then
3030
npm ci --ignore-scripts
3131
npx tsx scripts/download_vsix.ts
32-
export VSCODE_SWIFT_VSIX="vscode-swift.vsix"
33-
export VSCODE_SWIFT_PRERELEASE_VSIX="vscode-swift-prerelease.vsix"
3432
fi

.github/workflows/scripts/windows/setup.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@ if ($Process.ExitCode -eq 0) {
1010
Write-Host ('FAILED ({0})' -f $Process.ExitCode)
1111
exit 1
1212
}
13+
14+
Get-Content $env:GITHUB_ENV | foreach {
15+
$name, $value = $_.split('=')
16+
Set-Content env:\$name $value
17+
}

.vscode-test.js

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
const { defineConfig } = require("@vscode/test-cli");
1616
const path = require("path");
1717
const { version, publisher, name } = require("./package.json");
18-
const { preview } = require("./scripts/versions");
1918

2019
const isCIBuild = process.env["CI"] === "1";
2120
const isFastTestRun = process.env["FAST_TEST_RUN"] === "1";
@@ -41,51 +40,67 @@ if (dataDir) {
4140
if (process.platform === "darwin" && process.arch === "x64") {
4241
launchArgs.push("--disable-gpu");
4342
}
44-
const isStableRun = process.env["VSCODE_VERSION"] !== "insiders";
43+
44+
const installExtensions = [];
45+
let vsixPath = process.env["VSCODE_SWIFT_VSIX"];
4546
let versionStr = version;
46-
if (!isStableRun) {
47-
const segments = version.split(".").map(v => parseInt(v, 10));
48-
versionStr = preview({ major: segments[0], minor: segments[1], patch: segments[2] });
49-
}
50-
let vsixPath = isStableRun
51-
? process.env["VSCODE_SWIFT_VSIX"]
52-
: process.env["VSCODE_SWIFT_PRERELEASE_VSIX"];
53-
const install = [];
54-
const installExtensions = ["vadimcn.vscode-lldb", "llvm-vs-code-extensions.lldb-dap"];
47+
let extensionDevelopmentPath;
5548
if (vsixPath) {
49+
// https://github.com/swiftlang/vscode-swift/issues/1751
50+
// Will install extensions before CI tests run
51+
installExtensions.push("vadimcn.vscode-lldb", "llvm-vs-code-extensions.lldb-dap");
52+
53+
// Absolute path to vsix needed
5654
if (!path.isAbsolute(vsixPath)) {
5755
vsixPath = path.join(__dirname, vsixPath);
5856
}
59-
console.log("Installing " + vsixPath);
57+
console.log("Installing VSIX " + vsixPath);
6058
installExtensions.push(vsixPath);
59+
60+
// Determine version to use
61+
const match = /swift-vscode-(\d+.\d+.\d+(-dev)?)(-\d+)?.vsix/g.exec(path.basename(vsixPath));
62+
if (match) {
63+
versionStr = match[1];
64+
}
65+
console.log("Running tests against extension version " + versionStr);
66+
67+
extensionDevelopmentPath = `${__dirname}/.vscode-test/extensions/${publisher}.${name}-${versionStr}`;
68+
console.log("Running tests against extension development path " + extensionDevelopmentPath);
6169
}
6270

71+
const vscodeVersion = process.env["VSCODE_VERSION"] ?? "stable";
72+
console.log("Running tests against VS Code version " + vscodeVersion);
73+
74+
const installConfigs = [];
6375
for (const ext of installExtensions) {
64-
install.push({
76+
installConfigs.push({
6577
label: `installExtension-${ext}`,
6678
installExtensions: [ext],
67-
launchArgs,
79+
launchArgs: launchArgs.concat("--disable-extensions"),
6880
files: ["dist/test/sleep.test.js"],
69-
version: process.env["VSCODE_VERSION"] ?? "stable",
81+
version: vscodeVersion,
82+
skipExtensionDependencies: true,
7083
reuseMachineInstall: !isCIBuild,
7184
});
7285
}
7386

87+
const env = {
88+
...process.env,
89+
RUNNING_UNDER_VSCODE_TEST_CLI: "1",
90+
};
91+
console.log("Running tests against environment:\n" + JSON.stringify(env, undefined, 2));
92+
7493
module.exports = defineConfig({
7594
tests: [
76-
...install,
95+
...installConfigs,
7796
{
7897
label: "integrationTests",
7998
files: ["dist/test/common.js", "dist/test/integration-tests/**/*.test.js"],
80-
version: process.env["VSCODE_VERSION"] ?? "stable",
99+
version: vscodeVersion,
81100
workspaceFolder: "./assets/test",
82101
launchArgs,
83-
extensionDevelopmentPath: vsixPath
84-
? [`${__dirname}/.vscode-test/extensions/${publisher}.${name}-${versionStr}`]
85-
: undefined,
86-
env: {
87-
VSCODE_TEST: "1",
88-
},
102+
extensionDevelopmentPath,
103+
env,
89104
mocha: {
90105
ui: "tdd",
91106
color: true,
@@ -102,7 +117,7 @@ module.exports = defineConfig({
102117
},
103118
},
104119
},
105-
skipExtensionDependencies: install.length > 0,
120+
skipExtensionDependencies: installConfigs.length > 0,
106121
reuseMachineInstall: !isCIBuild,
107122
},
108123
{
@@ -116,15 +131,11 @@ module.exports = defineConfig({
116131
"dist/test/integration-tests/testexplorer/TestExplorerIntegration.test.js",
117132
"dist/test/integration-tests/commands/dependency.test.js",
118133
],
119-
version: process.env["VSCODE_VERSION"] ?? "stable",
134+
version: vscodeVersion,
120135
workspaceFolder: "./assets/test.code-workspace",
121136
launchArgs,
122-
extensionDevelopmentPath: vsixPath
123-
? [`${__dirname}/.vscode-test/extensions/${publisher}.${name}-${versionStr}`]
124-
: undefined,
125-
env: {
126-
VSCODE_TEST: "1",
127-
},
137+
extensionDevelopmentPath,
138+
env,
128139
mocha: {
129140
ui: "tdd",
130141
color: true,
@@ -141,17 +152,15 @@ module.exports = defineConfig({
141152
},
142153
},
143154
},
144-
skipExtensionDependencies: install.length > 0,
155+
skipExtensionDependencies: installConfigs.length > 0,
145156
reuseMachineInstall: !isCIBuild,
146157
},
147158
{
148159
label: "unitTests",
149160
files: ["dist/test/common.js", "dist/test/unit-tests/**/*.test.js"],
150-
version: process.env["VSCODE_VERSION"] ?? "stable",
161+
version: vscodeVersion,
151162
launchArgs: launchArgs.concat("--disable-extensions"),
152-
env: {
153-
VSCODE_TEST: "1",
154-
},
163+
env,
155164
mocha: {
156165
ui: "tdd",
157166
color: true,

.vscodeignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
**/*
22
!LICENSE
33
!NOTICE.txt
4-
!CHANGELOG.md
4+
!CHANGELOG-*.md
55
!README.md
66
!icon.png
77
!package.json

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "swift-vscode",
33
"displayName": "Swift",
44
"description": "Swift Language Support for Visual Studio Code.",
5-
"version": "2.10.0",
5+
"version": "2.12.0-dev",
66
"publisher": "swiftlang",
77
"icon": "icon.png",
88
"repository": {

scripts/dev_package.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,11 @@
1313
//===----------------------------------------------------------------------===//
1414
/* eslint-disable no-console */
1515

16-
import {
17-
exec,
18-
getExtensionVersion,
19-
getRootDirectory,
20-
main,
21-
updateChangelog,
22-
} from "./lib/utilities";
23-
// eslint-disable-next-line @typescript-eslint/no-require-imports
24-
const { dev } = require("./versions");
16+
import { getExtensionVersion, main, packageExtension } from "./lib/utilities";
2517

2618
// eslint-disable-next-line @typescript-eslint/no-floating-promises
2719
main(async () => {
28-
const rootDirectory = getRootDirectory();
2920
const version = await getExtensionVersion();
30-
// Increment the patch version from the package.json
31-
const devVersion = dev(version);
32-
// Update version in CHANGELOG
33-
await updateChangelog(devVersion);
34-
// Use VSCE to package the extension
35-
await exec("npx", ["vsce", "package", "--no-update-package-json", devVersion], {
36-
cwd: rootDirectory,
37-
});
21+
const devVersion = `${version.major}.${version.minor}.${version.patch}-dev`;
22+
await packageExtension(devVersion);
3823
});

scripts/download_vsix.ts

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@
1313
//===----------------------------------------------------------------------===//
1414
/* eslint-disable no-console */
1515

16-
import decompress from "decompress";
16+
import * as DecompressType from "decompress";
1717
import { createWriteStream } from "node:fs";
18-
import { rename, unlink } from "node:fs/promises";
18+
import { appendFile, unlink } from "node:fs/promises";
1919
import { pipeline } from "node:stream/promises";
2020
import { Octokit } from "octokit";
2121

22+
// eslint-disable-next-line @typescript-eslint/no-require-imports
23+
const decompress: typeof DecompressType = require("decompress");
24+
2225
const artifact_id = process.env["VSCODE_SWIFT_VSIX_ID"];
2326
if (!artifact_id) {
2427
console.error("No VSCODE_SWIFT_VSIX_ID provided");
@@ -29,6 +32,11 @@ if (!token) {
2932
console.error("No GITHUB_TOKEN provided");
3033
process.exit(1);
3134
}
35+
const envFile = process.env["GITHUB_ENV"];
36+
if (!envFile) {
37+
console.error("No GITHUB_ENV provided");
38+
process.exit(1);
39+
}
3240
const repository = process.env["GITHUB_REPOSITORY"] || "swiftlang/vscode-swift";
3341
const owner = repository.split("/")[0];
3442
const repo = repository.split("/")[1];
@@ -57,22 +65,29 @@ const repo = repository.split("/")[1];
5765
await pipeline(data, createWriteStream("artifacts.zip", data));
5866
const files = await decompress("artifacts.zip", process.cwd());
5967
console.log(`Downloaded artifact(s): ${files.map(f => f.path).join(", ")}`);
60-
const newName = process.env["VSCODE_SWIFT_VSIX"] || "vscode-swift.vsix";
61-
const releaseVSIX = files.find(f => /swift-vscode-\d+.\d+.\d+-\d+.vsix/m.test(f.path));
62-
if (!releaseVSIX) {
63-
console.error("Cound not find vscode-swift release VSIX in artifact bundle");
64-
process.exit(1);
65-
}
66-
await rename(releaseVSIX.path, newName);
67-
const prereleaseVSIX = files.find(f => /swift-vscode-\d+.\d+.\d{8}-\d+.vsix/m.test(f.path));
68-
if (!prereleaseVSIX) {
69-
console.error("Cound not find vscode-swift pre-release VSIX in artifact bundle");
70-
process.exit(1);
68+
const testPrerelease = process.env["VSCODE_SWIFT_VSIX_PRERELEASE"] === "1";
69+
if (testPrerelease) {
70+
const prereleaseVSIX = files.find(f =>
71+
/swift-vscode-\d+.\d+.\d{8}(-dev)?-\d+.vsix/m.test(f.path)
72+
);
73+
if (prereleaseVSIX) {
74+
await appendFile(envFile, `VSCODE_SWIFT_VSIX=${prereleaseVSIX.path}\n`);
75+
console.log(`Running tests against: ${prereleaseVSIX.path}`);
76+
} else {
77+
console.error("Cound not find vscode-swift pre-release VSIX in artifact bundle");
78+
process.exit(1);
79+
}
80+
} else {
81+
const releaseVSIX = files.find(f =>
82+
/swift-vscode-\d+.\d+.\d+(-dev)?-\d+.vsix/m.test(f.path)
83+
);
84+
if (releaseVSIX) {
85+
await appendFile(envFile, `VSCODE_SWIFT_VSIX=${releaseVSIX.path}\n`);
86+
console.log(`Running tests against: ${releaseVSIX.path}`);
87+
} else {
88+
console.error("Cound not find vscode-swift release VSIX in artifact bundle");
89+
process.exit(1);
90+
}
7191
}
72-
console.log(`Renamed artifact: ${releaseVSIX.path} => ${newName}`);
73-
const preNewName =
74-
process.env["VSCODE_SWIFT_PRERELEASE_VSIX"] || "vscode-swift-prerelease.vsix";
75-
await rename(prereleaseVSIX.path, preNewName);
76-
console.log(`Renamed artifact: ${prereleaseVSIX.path} => ${preNewName}`);
7792
await unlink("artifacts.zip");
7893
})();

0 commit comments

Comments
 (0)