Skip to content

Commit 69f0be3

Browse files
committed
ci: remove legacy alpine packaging path
1 parent c52a03a commit 69f0be3

7 files changed

Lines changed: 19 additions & 359 deletions

File tree

.github/scripts/ci-plan.mjs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,6 @@ const DEV_PACKAGE_TARGETS = new Map([
1212
["darwin-arm64", { os: "macos-15", target: "darwin-arm64" }],
1313
]);
1414

15-
const DEV_ALPINE_TARGETS = new Map([
16-
[
17-
"alpine-x64",
18-
{
19-
target: "alpine-x64",
20-
image: "ghcr.io/blackdex/rust-musl:x86_64-musl-nightly",
21-
"rust-target": "x86_64-unknown-linux-musl",
22-
},
23-
],
24-
]);
25-
2615
export async function planCi({ github, context, core, filters }) {
2716
const eventName = context.eventName;
2817
const workflowDispatch = eventName === "workflow_dispatch";
@@ -56,37 +45,25 @@ export async function planCi({ github, context, core, filters }) {
5645

5746
let runDevPackage = false;
5847
let runDevWebPackage = false;
59-
let runDevAlpinePackage = false;
6048
let devPackageMatrix = [DEV_PACKAGE_TARGETS.get("linux-x64")];
61-
let devAlpineMatrix = [DEV_ALPINE_TARGETS.get("alpine-x64")];
6249

6350
if (!pullRequest) {
6451
if (workflowDispatch || packageChanged) {
6552
runDevPackage = true;
6653
runDevWebPackage = true;
67-
runDevAlpinePackage = true;
6854
devPackageMatrix = [...DEV_PACKAGE_TARGETS.values()];
69-
devAlpineMatrix = [...DEV_ALPINE_TARGETS.values()];
7055
} else {
7156
const failedDevPackageTargets = failedTargets(
7257
failedJobNames,
7358
DEV_PACKAGE_TARGETS,
7459
);
75-
const failedDevAlpineTargets = failedTargets(
76-
failedJobNames,
77-
DEV_ALPINE_TARGETS,
78-
);
7960

8061
runDevPackage = failedDevPackageTargets.length > 0;
8162
runDevWebPackage = failedJobNames.includes("Dev Package (web)");
82-
runDevAlpinePackage = failedDevAlpineTargets.length > 0;
8363

8464
if (runDevPackage) {
8565
devPackageMatrix = failedDevPackageTargets;
8666
}
87-
if (runDevAlpinePackage) {
88-
devAlpineMatrix = failedDevAlpineTargets;
89-
}
9067
}
9168
}
9269

@@ -109,8 +86,6 @@ export async function planCi({ github, context, core, filters }) {
10986
run_dev_package: runDevPackage,
11087
dev_package_matrix: devPackageMatrix,
11188
run_dev_web_package: runDevWebPackage,
112-
run_dev_alpine_package: runDevAlpinePackage,
113-
dev_alpine_matrix: devAlpineMatrix,
11489
};
11590
}
11691

.github/workflows/ci.yml

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -400,118 +400,3 @@ jobs:
400400
if-no-files-found: error
401401
retention-days: 14
402402

403-
dev-alpine-package:
404-
name: Dev Package (${{ matrix.target }})
405-
needs: changes
406-
if: fromJSON(needs.changes.outputs.plan).run_dev_alpine_package == true
407-
runs-on: ubuntu-22.04
408-
container: ${{ matrix.image }}
409-
strategy:
410-
fail-fast: false
411-
matrix:
412-
include: ${{ fromJSON(needs.changes.outputs.plan).dev_alpine_matrix }}
413-
defaults:
414-
run:
415-
working-directory: editors/vscode
416-
env:
417-
SERVER_BIN: ${{ startsWith(matrix.target, 'win32-') && 'vide.exe' || 'vide' }}
418-
steps:
419-
- name: Install build dependencies
420-
working-directory: .
421-
run: |
422-
apt-get update
423-
apt-get install -y --no-install-recommends ca-certificates cmake git python3
424-
425-
- uses: actions/checkout@v4
426-
427-
- name: Trust checkout directories
428-
working-directory: .
429-
run: |
430-
git config --global --add safe.directory "$GITHUB_WORKSPACE"
431-
432-
- name: Restore bundled server cache
433-
id: bundled-server-cache
434-
uses: actions/cache/restore@v4
435-
with:
436-
path: editors/vscode/server/${{ matrix.target }}/${{ env.SERVER_BIN }}
437-
key: bundled-server-${{ matrix.target }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'xtask/**') }}
438-
439-
- name: Install Rust
440-
uses: ./.github/actions/setup-rust
441-
with:
442-
components: rustfmt
443-
targets: ${{ matrix.rust-target }}
444-
445-
- name: Setup sccache
446-
uses: ./.github/actions/setup-sccache
447-
with:
448-
cmake-launcher: "true"
449-
450-
- name: Rust Cache
451-
uses: Swatinem/rust-cache@v2
452-
continue-on-error: true
453-
with:
454-
shared-key: rust-${{ runner.os }}-${{ matrix.target }}
455-
key: package-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'xtask/**') }}
456-
cache-workspace-crates: true
457-
cache-on-failure: true
458-
459-
- name: Setup Node
460-
uses: actions/setup-node@v4
461-
with:
462-
node-version: 22
463-
cache: npm
464-
cache-dependency-path: editors/vscode/package-lock.json
465-
466-
- name: Install dependencies
467-
run: npm ci
468-
469-
- name: Set build metadata
470-
id: build-metadata
471-
shell: bash
472-
working-directory: .
473-
run: |
474-
commit_hash="$(git rev-parse --short "$GITHUB_SHA")"
475-
echo "commit_hash=${commit_hash}" >> "$GITHUB_OUTPUT"
476-
echo "VIDE_EXTENSION_BUILD_KIND=nightly" >> "$GITHUB_ENV"
477-
echo "VIDE_EXTENSION_COMMIT_HASH=${commit_hash}" >> "$GITHUB_ENV"
478-
echo "VIDE_EXTENSION_BUILD_DATE=$(date -u +'%Y%m%dT%H%M%SZ')" >> "$GITHUB_ENV"
479-
480-
- name: Package extension
481-
run: npm run package:vsix:debug -- --target ${{ matrix.target }} ${{ steps.bundled-server-cache.outputs.cache-hit == 'true' && '--server=prebuilt' || '--server=build' }}
482-
483-
- name: Save bundled server cache
484-
if: steps.bundled-server-cache.outputs.cache-hit != 'true'
485-
uses: actions/cache/save@v4
486-
continue-on-error: true
487-
with:
488-
path: editors/vscode/server/${{ matrix.target }}/${{ env.SERVER_BIN }}
489-
key: ${{ steps.bundled-server-cache.outputs.cache-primary-key }}
490-
491-
- name: Upload dev VSIX
492-
uses: actions/upload-artifact@v4
493-
with:
494-
name: vide-vscode-dev-${{ matrix.target }}-${{ steps.build-metadata.outputs.commit_hash }}
495-
path: editors/vscode/vide-vscode-${{ matrix.target }}-debug.vsix
496-
if-no-files-found: error
497-
retention-days: 14
498-
- name: Upload dev language server binary
499-
shell: bash
500-
working-directory: .
501-
run: |
502-
set -euo pipefail
503-
server_dir="editors/vscode/server/${{ matrix.target }}"
504-
src="${server_dir}/vide"
505-
dst="vide-${{ matrix.target }}"
506-
if [[ ! -f "$src" ]]; then
507-
echo "Language server binary not found: $src" >&2
508-
exit 1
509-
fi
510-
cp "$src" "$dst"
511-
- name: Upload dev language server binary artifact
512-
uses: actions/upload-artifact@v4
513-
with:
514-
name: vide-lsp-dev-${{ matrix.target }}-${{ steps.build-metadata.outputs.commit_hash }}
515-
path: vide-${{ matrix.target }}
516-
if-no-files-found: error
517-
retention-days: 14

docs/src/content/docs/advanced-guide/advanced-installation.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,17 @@ npm run package:vsix -- --target linux-x64
105105
npm run package:vsix -- --target linux-arm64
106106
npm run package:vsix -- --target win32-x64
107107
npm run package:vsix -- --target darwin-arm64
108-
npm run package:vsix -- --target alpine-x64
108+
npm run package:vsix -- --target alpine-x64 --server=prebuilt
109+
npm run package:vsix -- --target alpine-arm64 --server=prebuilt
109110
```
110111

111-
这些脚本会先编译扩展,然后准备目标平台的 release 版语言服务器,再生成 `vide-vscode-<target>.vsix`。release 包默认不启用 profile trace,也不包含 Speedscope 静态资源或 profiling 命令。当前 release workflow 只覆盖上面这些目标:glibc Linux、Windows x64、macOS arm64,以及 Alpine/musl x64。
112+
这些脚本会先编译扩展,然后准备目标平台的 release 版语言服务器,再生成 `vide-vscode-<target>.vsix`。release 包默认不启用 profile trace,也不包含 Speedscope 静态资源或 profiling 命令。当前 release workflow 只覆盖上面这些目标:glibc Linux、Windows x64、macOS arm64,以及 Alpine/musl x64/arm64
112113
这几项也是当前 CI 会实际构建的 VSIX 目标。其他平台不是当前支持的打包目标。
113114

114115
上面的打包命令都需要先准备目标平台的语言服务器二进制;`editors/vscode/scripts/package.ts` 会调用 `cargo xtask vscode prepare-server`,而通用的 server 构建规则由 `cargo xtask server build` 承载:
115116

116117
- 目标等于当前宿主平台时,xtask 执行对应 profile 的 `cargo build` 并复制产物。
117-
- Alpine 目标在 CI 的 musl 容器中构建;本地脚本会添加对应 Rust musl target,但仍需要可用的 musl 交叉编译环境
118+
- Alpine 目标由 release artifact workflow 预先构建 musl 语言服务器;本地打包 Alpine VSIX 时需要先把对应的 `vide` 放到 `editors/vscode/server/<target>/`,并使用 `--server=prebuilt`
118119
- 其他非宿主平台目标不会自动交叉编译语言服务器,需要 `editors/vscode/server/<target>/` 下已经存在对应的 `vide``vide.exe`,或者在匹配的原生 runner 上打包。
119120

120121
### 安装 VS Code 插件
@@ -158,6 +159,7 @@ code --install-extension ./vide-vscode-win32-x64-debug.vsix
158159
VSIX 是按平台打包的。当前正式发布和 CI 产物覆盖这些目标:
159160

160161
- `alpine-x64`
162+
- `alpine-arm64`
161163
- `darwin-arm64`
162164
- `linux-arm64`
163165
- `linux-x64`

docs/src/content/docs/en/advanced-guide/advanced-installation.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,17 @@ npm run package:vsix -- --target linux-x64
119119
npm run package:vsix -- --target linux-arm64
120120
npm run package:vsix -- --target win32-x64
121121
npm run package:vsix -- --target darwin-arm64
122-
npm run package:vsix -- --target alpine-x64
122+
npm run package:vsix -- --target alpine-x64 --server=prebuilt
123+
npm run package:vsix -- --target alpine-arm64 --server=prebuilt
123124
```
124125

125-
These scripts compile the extension, prepare a release server binary for the target platform, and generate `vide-vscode-<target>.vsix`. Release packages do not enable profile trace, and they do not include Speedscope static assets or the profiling command by default. The current release workflow only covers those targets: glibc Linux, Windows x64, macOS arm64, and Alpine/musl x64.
126+
These scripts compile the extension, prepare a release server binary for the target platform, and generate `vide-vscode-<target>.vsix`. Release packages do not enable profile trace, and they do not include Speedscope static assets or the profiling command by default. The current release workflow only covers those targets: glibc Linux, Windows x64, macOS arm64, and Alpine/musl x64/arm64.
126127
Those are also the VSIX targets currently built by CI. Other platforms are not current packaging targets.
127128

128129
All packaging commands above need to prepare the language server binary for the target platform first. `editors/vscode/scripts/package.ts` calls `cargo xtask vscode prepare-server`, and the reusable server build rules live under `cargo xtask server build`:
129130

130131
- When the target matches the current host platform, xtask runs `cargo build` for the selected profile and copies the result.
131-
- Alpine targets are built in musl containers in CI. The local script adds the matching Rust musl target, but still needs a working musl cross-compilation environment.
132+
- Alpine targets are built by the release artifact workflow as prebuilt musl language servers. To package an Alpine VSIX locally, first place the matching `vide` binary under `editors/vscode/server/<target>/`, then pass `--server=prebuilt`.
132133
- Other non-host targets are not automatically cross-compiled; the matching `vide` or `vide.exe` must already exist under `editors/vscode/server/<target>/`, or you should package on a matching native runner.
133134

134135
### Install the VS Code Extension
@@ -172,6 +173,7 @@ You can download a `.vsix` file and install it manually. Choose the source based
172173
VSIX packages are platform-specific. Current release and CI artifacts cover these targets:
173174

174175
- `alpine-x64`
176+
- `alpine-arm64`
175177
- `darwin-arm64`
176178
- `linux-arm64`
177179
- `linux-x64`

editors/vscode/scripts/package/server.ts

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ import type { PackageContext } from './context';
55
import { run } from './process';
66
import type { BuildProfile, NativeTargetSpec, ServerMode } from './targets';
77

8-
const ALPINE_CARGO_TARGETS: Partial<Record<NativeTargetSpec['target'], string>> = {
9-
'alpine-arm64': 'aarch64-unknown-linux-musl',
10-
'alpine-x64': 'x86_64-unknown-linux-musl',
11-
};
12-
138
export function ensureTargetServerBinary(
149
context: PackageContext,
1510
spec: NativeTargetSpec,
@@ -33,7 +28,7 @@ export function ensureTargetServerBinary(
3328
}
3429

3530
const serverPath = targetServerPath(context, spec);
36-
run('cargo', args, context.repoRoot, cargoXtaskEnvForTarget(spec));
31+
run('cargo', args, context.repoRoot);
3732

3833
if (!fs.existsSync(serverPath)) {
3934
throw new Error(`prepared server binary was not found: ${serverPath}`);
@@ -69,64 +64,4 @@ function targetServerPath(context: PackageContext, spec: NativeTargetSpec): stri
6964
return path.join(context.vscodeDir, 'server', spec.target, spec.binaryFile);
7065
}
7166

72-
export function cargoXtaskEnvForTarget(
73-
spec: NativeTargetSpec,
74-
env: NodeJS.ProcessEnv = process.env,
75-
): NodeJS.ProcessEnv {
76-
const cargoTarget = ALPINE_CARGO_TARGETS[spec.target];
77-
if (!cargoTarget) {
78-
return env;
79-
}
80-
81-
let updated = env;
82-
const linkerEnvKey = cargoTargetLinkerEnvKey(cargoTarget);
83-
if (!optionalEnv(updated, linkerEnvKey)) {
84-
updated = {
85-
...updated,
86-
[linkerEnvKey]: cargoLinkerForTarget(cargoTarget, updated),
87-
};
88-
}
89-
90-
return appendRustFlags(updated, ['-C', 'link-arg=-lc']);
91-
}
92-
93-
function cargoTargetLinkerEnvKey(cargoTarget: string): string {
94-
return `CARGO_TARGET_${cargoTargetEnvName(cargoTarget)}_LINKER`;
95-
}
96-
97-
function cargoTargetEnvName(cargoTarget: string): string {
98-
return cargoTarget.toUpperCase().replace(/-/g, '_');
99-
}
100-
101-
function cargoLinkerForTarget(cargoTarget: string, env: NodeJS.ProcessEnv): string {
102-
return (
103-
optionalEnv(env, cxxCompilerEnvKey(cargoTarget)) ??
104-
optionalEnv(env, 'TARGET_CXX') ??
105-
`${cargoTarget}-g++`
106-
);
107-
}
108-
109-
function cxxCompilerEnvKey(cargoTarget: string): string {
110-
return `CXX_${cargoTarget.replace(/-/g, '_')}`;
111-
}
11267

113-
function appendRustFlags(env: NodeJS.ProcessEnv, flags: string[]): NodeJS.ProcessEnv {
114-
const encodedFlags = optionalEnv(env, 'CARGO_ENCODED_RUSTFLAGS');
115-
if (encodedFlags) {
116-
return {
117-
...env,
118-
CARGO_ENCODED_RUSTFLAGS: `${encodedFlags}\x1f${flags.join('\x1f')}`,
119-
};
120-
}
121-
122-
const rustFlags = optionalEnv(env, 'RUSTFLAGS');
123-
return {
124-
...env,
125-
RUSTFLAGS: rustFlags ? `${rustFlags} ${flags.join(' ')}` : flags.join(' '),
126-
};
127-
}
128-
129-
function optionalEnv(env: NodeJS.ProcessEnv, name: string): string | undefined {
130-
const value = env[name]?.trim();
131-
return value ? value : undefined;
132-
}

editors/vscode/test/package.test.ts

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
stagePackageJsonForTarget,
1212
stageProfileTraceAssets,
1313
} from '../scripts/package/manifest';
14-
import { cargoXtaskEnvForTarget } from '../scripts/package/server';
1514
import { createPackagePlan, type NativeTargetSpec } from '../scripts/package/targets';
1615

1716
describe('package cli', () => {
@@ -106,40 +105,6 @@ describe('package staging', () => {
106105
});
107106
});
108107

109-
describe('package server preparation', () => {
110-
it('injects Alpine cargo env before cargo xtask is built', () => {
111-
const env = cargoXtaskEnvForTarget(nativeTargetSpec('alpine-x64'), {});
112-
113-
assert.equal(
114-
env.CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER,
115-
'x86_64-unknown-linux-musl-g++',
116-
);
117-
assert.equal(env.RUSTFLAGS, '-C link-arg=-lc');
118-
});
119-
120-
it('appends Alpine cargo flags to encoded rust flags', () => {
121-
const env = cargoXtaskEnvForTarget(nativeTargetSpec('alpine-x64'), {
122-
CARGO_ENCODED_RUSTFLAGS: '-C\x1ftarget-feature=+crt-static',
123-
CXX_x86_64_unknown_linux_musl: 'custom-x86_64-g++',
124-
});
125-
126-
assert.equal(env.CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER, 'custom-x86_64-g++');
127-
assert.equal(
128-
env.CARGO_ENCODED_RUSTFLAGS,
129-
'-C\x1ftarget-feature=+crt-static\x1f-C\x1flink-arg=-lc',
130-
);
131-
});
132-
133-
it('leaves non-Alpine cargo env untouched', () => {
134-
const baseEnv = { RUSTFLAGS: '-Dwarnings' };
135-
136-
assert.equal(
137-
cargoXtaskEnvForTarget(nativeTargetSpec('win32-x64', 'vide.exe'), baseEnv),
138-
baseEnv,
139-
);
140-
});
141-
});
142-
143108
function temporaryPackageContext(): PackageContext {
144109
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'vide-package-'));
145110
return {

0 commit comments

Comments
 (0)