Skip to content

Commit 55e3873

Browse files
committed
Make work so we can run locally without publishing
1 parent b57b201 commit 55e3873

File tree

6 files changed

+38
-34
lines changed

6 files changed

+38
-34
lines changed

.github/workflows/nightly.yml

+10-18
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ jobs:
1818
uses: actions/checkout@v4
1919
- name: Build Extension
2020
run: |
21-
export NODE_VERSION=v18.19.0
22-
export NODE_PATH=/usr/local/nvm/versions/node/v18.19.0/bin
23-
export NVM_DIR=/usr/local/nvm
2421
. .github/workflows/scripts/setup-linux.sh
2522
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
2623
npm ci
@@ -34,27 +31,25 @@ jobs:
3431
- name: Archive production artifacts
3532
id: archive
3633
uses: actions/upload-artifact@v4
37-
if: always()
34+
if: ${{ env.ACT != 'true' }}
3835
with:
3936
if-no-files-found: error
4037
name: vscode-swift-extension
4138
path: |
4239
*.vsix
40+
4341
tests_release:
4442
name: Test Release
4543
needs: package
46-
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
44+
uses: award999/github-workflows/.github/workflows/swift_package_test.yml@token
45+
secrets: inherit
4746
with:
4847
# Linux
4948
linux_env_vars: |
50-
NODE_VERSION=v18.19.0
51-
NODE_PATH=/usr/local/nvm/versions/node/v18.19.0/bin
52-
NVM_DIR=/usr/local/nvm
5349
CI=1
5450
VSCODE_SWIFT_VSIX_ID=${{needs.package.outputs.artifact-id}}
55-
VSCODE_SWIFT_VSIX=vscode-swift.vsix
56-
GITHUB_TOKEN=${{github.token}}
5751
GITHUB_REPOSITORY=${{github.repository}}
52+
GITHUB_TOKEN=${{github.secrets.GITHUB_TOKEN}}
5853
linux_pre_build_command: . .github/workflows/scripts/setup-linux.sh
5954
linux_build_command: ./scripts/test.sh
6055
# Windows
@@ -63,30 +58,27 @@ jobs:
6358
VSCODE_TEST=1
6459
VSCODE_SWIFT_VSIX_ID=${{needs.package.outputs.artifact-id}}
6560
VSCODE_SWIFT_VSIX=vscode-swift.vsix
66-
GITHUB_TOKEN=${{github.token}}
6761
GITHUB_REPOSITORY=${{github.repository}}
62+
GITHUB_TOKEN=${{github.secrets.GITHUB_TOKEN}}
6863
windows_pre_build_command: .github\workflows\scripts\windows\setup.ps1
6964
windows_build_command: scripts\test_windows.ps1
7065
enable_windows_docker: false
7166

7267
tests_insiders:
7368
name: Test Insiders
7469
needs: package
75-
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
70+
uses: award999/github-workflows/.github/workflows/swift_package_test.yml@token
71+
secrets: inherit
7672
with:
7773
# Linux
7874
linux_exclude_swift_versions: '[{"swift_version": "5.8"}, {"swift_version": "5.9"}, {"swift_version": "5.10"}, {"swift_version": "nightly-6.0"}, {"swift_version": "nightly-main"}]'
7975
linux_env_vars: |
80-
NODE_VERSION=v18.19.0
81-
NODE_PATH=/usr/local/nvm/versions/node/v18.19.0/bin
82-
NVM_DIR=/usr/local/nvm
8376
CI=1
8477
VSCODE_TEST=1
8578
VSCODE_VERSION=insiders
8679
VSCODE_SWIFT_VSIX_ID=${{needs.package.outputs.artifact-id}}
87-
VSCODE_SWIFT_VSIX=vscode-swift.vsix
88-
GITHUB_TOKEN=${{github.token}}
8980
GITHUB_REPOSITORY=${{github.repository}}
81+
GITHUB_TOKEN=${{github.secrets.GITHUB_TOKEN}}
9082
linux_pre_build_command: . .github/workflows/scripts/setup-linux.sh
9183
linux_build_command: ./scripts/test.sh
9284
# Windows
@@ -97,8 +89,8 @@ jobs:
9789
VSCODE_VERSION=insiders
9890
VSCODE_SWIFT_VSIX_ID=${{needs.package.outputs.artifact-id}}
9991
VSCODE_SWIFT_VSIX=vscode-swift.vsix
100-
GITHUB_TOKEN=${{github.token}}
10192
GITHUB_REPOSITORY=${{github.repository}}
93+
GITHUB_TOKEN=${{github.secrets.GITHUB_TOKEN}}
10294
windows_pre_build_command: .github\workflows\scripts\windows\setup.ps1
10395
windows_build_command: scripts\test_windows.ps1
10496
enable_windows_docker: false

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

+10-8
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ export NVM_DIR=/usr/local/nvm
1919

2020
apt-get update && apt-get install -y rsync curl gpg libasound2 libgbm1 libgtk-3-0 libnss3 xvfb build-essential
2121

22-
if [ ! -z "$VSCODE_SWIFT_VSIX_URL" ]; then
23-
export VSCODE_SWIFT_VSIX="$PWD/vscode-swift.vsix"
24-
echo "Downloading $VSCODE_SWIFT_VSIX_URL to $VSCODE_SWIFT_VSIX"
25-
curl -o "$VSCODE_SWIFT_VSIX" "$VSCODE_SWIFT_VSIX_URL"
26-
fi
27-
2822
mkdir -p $NVM_DIR
2923
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
30-
/bin/bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION"
31-
echo "$NODE_PATH" >> "$GITHUB_PATH"
24+
. $NVM_DIR/nvm.sh && nvm install $NODE_VERSION
25+
echo "$NODE_PATH" >> "$GITHUB_PATH"
26+
27+
env | sort
28+
29+
if [ ! -z "$VSCODE_SWIFT_VSIX_ID" ]; then
30+
npm ci --ignore-scripts
31+
npx tsx scripts/download_vsix.ts
32+
export VSCODE_SWIFT_VSIX="vscode-swift.vsix"
33+
fi

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,10 @@
33

44
# Download the VSIX archived upstream
55
npm ci -ignore-script node-pty
6-
npx tsx scripts/download_vsix.ts
6+
$Process = Start-Process npx "tsx scripts/download_vsix.ts" -Wait -PassThru -NoNewWindow
7+
if ($Process.ExitCode -eq 0) {
8+
Write-Host 'SUCCESS'
9+
} else {
10+
Write-Host ('FAILED ({0})' -f $Process.ExitCode)
11+
exit 1
12+
}

.vscode-test.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
const { defineConfig } = require("@vscode/test-cli");
1616
const path = require("path");
17-
const { version } = require("./package.json");
17+
const { version, publisher, name } = require("./package.json");
1818

1919
const isCIBuild = process.env["CI"] === "1";
2020
const isFastTestRun = process.env["FAST_TEST_RUN"] === "1";
@@ -50,7 +50,7 @@ module.exports = defineConfig({
5050
version: process.env["VSCODE_VERSION"] ?? "stable",
5151
workspaceFolder: "./assets/test",
5252
extensionDevelopmentPath: vsixPath
53-
? [`${__dirname}/.vscode-test/extensions/swiftlang.vscode-swift-${version}`]
53+
? [`${__dirname}/.vscode-test/extensions/${publisher}.${name}-${version}`]
5454
: undefined,
5555
launchArgs: [
5656
"--disable-updates",
@@ -99,6 +99,7 @@ module.exports = defineConfig({
9999
},
100100
},
101101
},
102+
skipExtensionDependencies: true,
102103
reuseMachineInstall: !isCIBuild,
103104
},
104105
// you can specify additional test configurations, too

scripts/download_vsix.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,18 @@ import { Octokit } from "octokit";
2222
const artifact_id = process.env["VSCODE_SWIFT_VSIX_ID"];
2323
if (!artifact_id) {
2424
console.error("No VSCODE_SWIFT_VSIX_ID provided");
25-
process.exit(1);
25+
process.exit(0);
2626
}
2727
const token = process.env["GITHUB_TOKEN"];
2828
if (!token) {
2929
console.error("No GITHUB_TOKEN provided");
3030
process.exit(1);
3131
}
3232
const repository = process.env["GITHUB_REPOSITORY"] || "swiftlang/vscode-swift";
33+
const owner = repository.split("/")[0];
34+
const repo = repository.split("/")[1];
3335

3436
(async function () {
35-
const owner = repository.split("/")[0];
36-
const repo = repository.split("/")[1];
37-
3837
const octokit = new Octokit({
3938
auth: token,
4039
});
@@ -56,6 +55,9 @@ const repository = process.env["GITHUB_REPOSITORY"] || "swiftlang/vscode-swift";
5655
);
5756
await pipeline(data, createWriteStream("artifacts.zip", data));
5857
const files = await decompress("artifacts.zip", process.cwd());
59-
await rename(files[0].path, "vscode-swift.vsix");
58+
console.log(`Downloaded artifact(s): ${files.map(f => f.path).join(", ")}`);
59+
const newName = process.env["VSCODE_SWIFT_VSIX"] || "vscode-swift.vsix";
60+
await rename(files[0].path, newName);
61+
console.log(`Renamed artifact: ${files[0].path} => ${newName}`);
6062
await unlink("artifacts.zip");
6163
})();

scripts/test_windows.ps1

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ npm ci -ignore-script node-pty
1818
npm run lint
1919
npm run format
2020
npm run package
21+
npm test -- --label installExtension
2122
$Process = Start-Process npm "run integration-test" -Wait -PassThru -NoNewWindow
2223
if ($Process.ExitCode -eq 0) {
2324
Write-Host 'SUCCESS'

0 commit comments

Comments
 (0)