Skip to content

Commit 45793be

Browse files
committed
Make work so we can run locally without publishing
1 parent d4387ff commit 45793be

File tree

6 files changed

+34
-25
lines changed

6 files changed

+34
-25
lines changed

.github/workflows/nightly.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,26 @@ jobs:
3535
- name: Archive production artifacts
3636
id: archive
3737
uses: actions/upload-artifact@v4
38-
if: always()
38+
if: ${{ env.ACT != 'true' }}
3939
with:
4040
if-no-files-found: error
4141
name: vscode-swift-extension
4242
path: |
4343
*.vsix
44+
4445
tests_release:
4546
name: Test Release
4647
needs: package
47-
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
48+
uses: award999/github-workflows/.github/workflows/swift_package_test.yml@token
4849
with:
50+
needs_token: true
4951
# Linux
5052
linux_env_vars: |
5153
NODE_VERSION=v20.18.2
5254
NODE_PATH=/usr/local/nvm/versions/node/v20.18.2/bin
5355
NVM_DIR=/usr/local/nvm
5456
CI=1
5557
VSCODE_SWIFT_VSIX_ID=${{needs.package.outputs.artifact-id}}
56-
VSCODE_SWIFT_VSIX=vscode-swift.vsix
57-
GITHUB_TOKEN=${{github.token}}
5858
GITHUB_REPOSITORY=${{github.repository}}
5959
linux_pre_build_command: . .github/workflows/scripts/setup-linux.sh
6060
linux_build_command: ./scripts/test.sh
@@ -63,7 +63,6 @@ jobs:
6363
CI=1
6464
VSCODE_SWIFT_VSIX_ID=${{needs.package.outputs.artifact-id}}
6565
VSCODE_SWIFT_VSIX=vscode-swift.vsix
66-
GITHUB_TOKEN=${{github.token}}
6766
GITHUB_REPOSITORY=${{github.repository}}
6867
windows_pre_build_command: .github\workflows\scripts\windows\setup.ps1
6968
windows_build_command: scripts\test_windows.ps1
@@ -72,8 +71,9 @@ jobs:
7271
tests_insiders:
7372
name: Test Insiders
7473
needs: package
75-
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
74+
uses: award999/github-workflows/.github/workflows/swift_package_test.yml@token
7675
with:
76+
needs_token: true
7777
# Linux
7878
linux_exclude_swift_versions: '[{"swift_version": "5.8"}, {"swift_version": "5.9"}, {"swift_version": "5.10"}, {"swift_version": "6.0"}, {"swift_version": "nightly-6.1"}, {"swift_version": "nightly-main"}]'
7979
linux_env_vars: |
@@ -83,8 +83,6 @@ jobs:
8383
CI=1
8484
VSCODE_VERSION=insiders
8585
VSCODE_SWIFT_VSIX_ID=${{needs.package.outputs.artifact-id}}
86-
VSCODE_SWIFT_VSIX=vscode-swift.vsix
87-
GITHUB_TOKEN=${{github.token}}
8886
GITHUB_REPOSITORY=${{github.repository}}
8987
linux_pre_build_command: . .github/workflows/scripts/setup-linux.sh
9088
linux_build_command: ./scripts/test.sh
@@ -95,7 +93,6 @@ jobs:
9593
VSCODE_VERSION=insiders
9694
VSCODE_SWIFT_VSIX_ID=${{needs.package.outputs.artifact-id}}
9795
VSCODE_SWIFT_VSIX=vscode-swift.vsix
98-
GITHUB_TOKEN=${{github.token}}
9996
GITHUB_REPOSITORY=${{github.repository}}
10097
windows_pre_build_command: .github\workflows\scripts\windows\setup.ps1
10198
windows_build_command: scripts\test_windows.ps1

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

Lines changed: 10 additions & 8 deletions
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

Lines changed: 7 additions & 1 deletion
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

Lines changed: 3 additions & 2 deletions
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";
@@ -68,7 +68,7 @@ module.exports = defineConfig({
6868
workspaceFolder: "./assets/test",
6969
launchArgs,
7070
extensionDevelopmentPath: vsixPath
71-
? [`${__dirname}/.vscode-test/extensions/swiftlang.vscode-swift-${version}`]
71+
? [`${__dirname}/.vscode-test/extensions/${publisher}.${name}-${version}`]
7272
: undefined,
7373
mocha: {
7474
ui: "tdd",
@@ -105,6 +105,7 @@ module.exports = defineConfig({
105105
},
106106
},
107107
},
108+
skipExtensionDependencies: true,
108109
reuseMachineInstall: !isCIBuild,
109110
},
110111
// you can specify additional test configurations, too

scripts/download_vsix.ts

Lines changed: 7 additions & 5 deletions
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ npm ci -ignore-script node-pty
9696
npm run lint
9797
npm run format
9898
npm run package
99+
npm test -- --label installExtension
99100
npm run test
100101
if ($LASTEXITCODE -eq 0) {
101102
Write-Host 'SUCCESS'

0 commit comments

Comments
 (0)