Skip to content

Commit 576a7c7

Browse files
authored
Changes for release process (#1534)
* Archive the commit SHA used to package the VSIX Eventually will be used downstream to tag releases Also setup PR job to package the VSIX and run tests against it so we can test against that in verifier jobs as well * Mark vscode-swift directory as safe * Need github token * Use same windows setup script as nightly * Use regex to match artifact names * Test toggling VSIX
1 parent aedf8eb commit 576a7c7

File tree

6 files changed

+80
-6
lines changed

6 files changed

+80
-6
lines changed

.github/workflows/nightly.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
echo "Created bundle $name"
3333
mv "$file" "$name"
3434
done
35+
git config --global --add safe.directory $PWD
36+
git rev-parse HEAD > vscode-swift-sha.txt
3537
- name: Archive production artifacts
3638
id: archive
3739
uses: actions/upload-artifact@v4
@@ -41,6 +43,7 @@ jobs:
4143
name: vscode-swift-extension
4244
path: |
4345
*.vsix
46+
vscode-swift-sha.txt
4447
4548
tests_release:
4649
name: Test Release

.github/workflows/pull_request.yml

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,51 @@ on:
55
types: [opened, reopened, synchronize]
66

77
jobs:
8+
package:
9+
name: Package Extension
10+
runs-on: ubuntu-latest
11+
container:
12+
image: swift:6.0-jammy
13+
outputs:
14+
artifact-id: ${{ steps.archive.outputs.artifact-id }}
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
- name: Build Extension
19+
run: |
20+
export NODE_VERSION=v20.18.2
21+
export NODE_PATH=/usr/local/nvm/versions/node/v20.18.2/bin
22+
export NVM_DIR=/usr/local/nvm
23+
. .github/workflows/scripts/setup-linux.sh
24+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
25+
npm ci
26+
npm run compile
27+
npm run package
28+
npm run preview-package
29+
for file in *.vsix; do
30+
name="$(basename "$file" .vsix)-${{github.run_number}}.vsix"
31+
echo "Created bundle $name"
32+
mv "$file" "$name"
33+
done
34+
git config --global --add safe.directory $PWD
35+
git rev-parse HEAD > vscode-swift-sha.txt
36+
- name: Archive production artifacts
37+
id: archive
38+
uses: actions/upload-artifact@v4
39+
if: ${{ env.ACT != 'true' }}
40+
with:
41+
if-no-files-found: error
42+
name: vscode-swift-extension
43+
path: |
44+
*.vsix
45+
vscode-swift-sha.txt
46+
847
tests:
948
name: ${{ contains(github.event.pull_request.labels.*.name, 'full-test-run') && 'Full Test Run' || 'Test'}}
1049
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
50+
needs: package
1151
with:
52+
needs_token: true
1253
# Linux
1354
linux_exclude_swift_versions: '[{"swift_version": "nightly-6.1"},{"swift_version": "nightly-main"}]'
1455
linux_env_vars: |
@@ -24,7 +65,7 @@ jobs:
2465
windows_env_vars: |
2566
CI=1
2667
FAST_TEST_RUN=${{ contains(github.event.pull_request.labels.*.name, 'full-test-run') && '0' || '1'}}
27-
windows_pre_build_command: .github\workflows\scripts\windows\install-nodejs.ps1
68+
windows_pre_build_command: .github\workflows\scripts\windows\setup.ps1
2869
windows_build_command: scripts\test_windows.ps1
2970
enable_windows_docker: false
3071

package-lock.json

Lines changed: 20 additions & 0 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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,6 +1676,7 @@
16761676
"@types/chai": "^4.3.19",
16771677
"@types/chai-as-promised": "^7.1.8",
16781678
"@types/chai-subset": "^1.3.6",
1679+
"@types/decompress": "^4.2.7",
16791680
"@types/glob": "^7.1.6",
16801681
"@types/lcov-parse": "^1.0.2",
16811682
"@types/lodash.debounce": "^4.0.9",

scripts/download_vsix.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,21 @@ const repo = repository.split("/")[1];
5757
const files = await decompress("artifacts.zip", process.cwd());
5858
console.log(`Downloaded artifact(s): ${files.map(f => f.path).join(", ")}`);
5959
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}`);
60+
const releaseVSIX = files.find(f => /swift-vscode-\d.\d.\d-\d+.vsix/m.test(f.path));
61+
if (!releaseVSIX) {
62+
console.error("Cound not find vscode-swift release VSIX in artifact bundle");
63+
process.exit(1);
64+
}
65+
await rename(releaseVSIX.path, newName);
66+
const prereleaseVSIX = files.find(f => /swift-vscode-\d.\d.\d{8}-\d+.vsix/m.test(f.path));
67+
if (!prereleaseVSIX) {
68+
console.error("Cound not find vscode-swift pre-release VSIX in artifact bundle");
69+
process.exit(1);
70+
}
71+
console.log(`Renamed artifact: ${releaseVSIX.path} => ${newName}`);
6272
const preNewName =
6373
process.env["VSCODE_SWIFT_PRERELEASE_VSIX"] || "vscode-swift-prerelease.vsix";
64-
await rename(files[1].path, preNewName);
65-
console.log(`Renamed artifact: ${files[1].path} => ${preNewName}`);
74+
await rename(prereleaseVSIX.path, preNewName);
75+
console.log(`Renamed artifact: ${prereleaseVSIX.path} => ${preNewName}`);
6676
await unlink("artifacts.zip");
6777
})();

scripts/test.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ cd /tmp/code
3131
npm ci
3232
npm run lint
3333
npm run format
34-
npm run package
3534
npm run soundness -- --force-run
3635

3736
xvfb-run -a npm run coverage 2>&1 | grep -Ev "Failed to connect to the bus|GPU stall due to ReadPixels"

0 commit comments

Comments
 (0)