Skip to content

Commit 42f7ce3

Browse files
committed
Propagate forward the GITHUB_ENV file
1 parent bb35efe commit 42f7ce3

File tree

5 files changed

+36
-27
lines changed

5 files changed

+36
-27
lines changed

.github/workflows/nightly.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ jobs:
6767
CI=1
6868
VSCODE_SWIFT_VSIX_ID=${{needs.package.outputs.artifact-id}}
6969
GITHUB_REPOSITORY=${{github.repository}}
70-
windows_pre_build_command: .github\workflows\scripts\windows\setup.ps1
70+
GITHUB_ENV=${{github.env}}
71+
windows_pre_build_command: . .github\workflows\scripts\windows\setup.ps1
7172
windows_build_command: scripts\test_windows.ps1
7273
enable_windows_docker: false
7374

@@ -98,6 +99,7 @@ jobs:
9899
VSCODE_SWIFT_VSIX_ID=${{needs.package.outputs.artifact-id}}
99100
VSCODE_SWIFT_VSIX_PRERELEASE=1
100101
GITHUB_REPOSITORY=${{github.repository}}
101-
windows_pre_build_command: .github\workflows\scripts\windows\setup.ps1
102+
GITHUB_ENV=${{github.env}}
103+
windows_pre_build_command: . .github\workflows\scripts\windows\setup.ps1
102104
windows_build_command: scripts\test_windows.ps1
103105
enable_windows_docker: false

.github/workflows/pull_request.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ jobs:
6767
FAST_TEST_RUN=${{ contains(github.event.pull_request.labels.*.name, 'full-test-run') && '0' || '1'}}
6868
VSCODE_SWIFT_VSIX_ID=${{needs.package.outputs.artifact-id}}
6969
GITHUB_REPOSITORY=${{github.repository}}
70-
windows_pre_build_command: .github\workflows\scripts\windows\setup.ps1
70+
GITHUB_ENV=${{github.env}}
71+
windows_pre_build_command: . .github\workflows\scripts\windows\setup.ps1
7172
windows_build_command: scripts\test_windows.ps1
7273
enable_windows_docker: false
7374

.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: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,33 @@ if (process.platform === "darwin" && process.arch === "x64") {
4141
launchArgs.push("--disable-gpu");
4242
}
4343

44-
// https://github.com/swiftlang/vscode-swift/issues/1751
45-
// Will install extensions before CI tests run
4644
const installExtensions = [];
47-
4845
let vsixPath = process.env["VSCODE_SWIFT_VSIX"];
46+
let versionStr = version;
47+
let extensionDevelopmentPath;
4948
if (vsixPath) {
49+
// https://github.com/swiftlang/vscode-swift/issues/1751
50+
// Will install extensions before CI tests run
5051
installExtensions.push("vadimcn.vscode-lldb", "llvm-vs-code-extensions.lldb-dap");
52+
53+
// Absolute path to vsix needed
5154
if (!path.isAbsolute(vsixPath)) {
5255
vsixPath = path.join(__dirname, vsixPath);
5356
}
54-
console.log("Installing " + vsixPath);
57+
console.log("Installing VSIX " + vsixPath);
5558
installExtensions.push(vsixPath);
56-
}
57-
let versionStr = version;
58-
if (vsixPath) {
59+
60+
// Determine version to use
5961
const match = /swift-vscode-(\d+.\d+.\d+(-dev)?)(-\d+)?.vsix/g.exec(path.basename(vsixPath));
6062
if (match) {
6163
versionStr = match[1];
6264
}
65+
console.log("Running tests against extension version " + versionStr);
66+
67+
extensionDevelopmentPath = vsixPath
68+
? [`${__dirname}/.vscode-test/extensions/${publisher}.${name}-${versionStr}`]
69+
: undefined;
6370
}
64-
console.log("Running tests against extension version " + versionStr);
6571

6672
const vscodeVersion = process.env["VSCODE_VERSION"] ?? "stable";
6773
console.log("Running tests against VS Code version " + vscodeVersion);
@@ -79,6 +85,10 @@ for (const ext of installExtensions) {
7985
});
8086
}
8187

88+
const env = {
89+
VSCODE_TEST: "1",
90+
};
91+
8292
module.exports = defineConfig({
8393
tests: [
8494
...installConfigs,
@@ -88,12 +98,8 @@ module.exports = defineConfig({
8898
version: vscodeVersion,
8999
workspaceFolder: "./assets/test",
90100
launchArgs,
91-
extensionDevelopmentPath: vsixPath
92-
? [`${__dirname}/.vscode-test/extensions/${publisher}.${name}-${versionStr}`]
93-
: undefined,
94-
env: {
95-
VSCODE_TEST: "1",
96-
},
101+
extensionDevelopmentPath,
102+
env,
97103
mocha: {
98104
ui: "tdd",
99105
color: true,
@@ -127,12 +133,8 @@ module.exports = defineConfig({
127133
version: vscodeVersion,
128134
workspaceFolder: "./assets/test.code-workspace",
129135
launchArgs,
130-
extensionDevelopmentPath: vsixPath
131-
? [`${__dirname}/.vscode-test/extensions/${publisher}.${name}-${versionStr}`]
132-
: undefined,
133-
env: {
134-
VSCODE_TEST: "1",
135-
},
136+
extensionDevelopmentPath,
137+
env,
136138
mocha: {
137139
ui: "tdd",
138140
color: true,
@@ -157,9 +159,7 @@ module.exports = defineConfig({
157159
files: ["dist/test/common.js", "dist/test/unit-tests/**/*.test.js"],
158160
version: vscodeVersion,
159161
launchArgs: launchArgs.concat("--disable-extensions"),
160-
env: {
161-
VSCODE_TEST: "1",
162-
},
162+
env,
163163
mocha: {
164164
ui: "tdd",
165165
color: true,

scripts/download_vsix.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

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

@@ -89,5 +89,6 @@ const repo = repository.split("/")[1];
8989
process.exit(1);
9090
}
9191
}
92+
console.log((await readFile(envFile)).toString("utf-8"));
9293
await unlink("artifacts.zip");
9394
})();

0 commit comments

Comments
 (0)