Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/ci-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ package:
- "website/package.json"
- "website/playground/package.json"
- "website/package-lock.json"
- "website/playground/scripts/build-vide-wasm.mjs"
- "website/playground/scripts/script-utils.mjs"
- "crates/vide-lsp-wasm/scripts/**"
- "crates/vide-lsp-wasm/js/**"
Comment thread
hongjr03 marked this conversation as resolved.
- ".github/actions/setup-rust/**"
- ".github/actions/setup-sccache/**"
- ".github/actions/setup-emscripten/**"
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/build-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,25 +186,25 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Restore playground WASM cache
id: playground-wasm-cache
- name: Restore Vide LSP WASM cache
id: vide-lsp-wasm-cache
uses: actions/cache/restore@v4
with:
path: website/playground/public/wasm
key: playground-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'website/playground/scripts/build-vide-wasm.mjs', 'website/playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
path: crates/vide-lsp-wasm/dist
key: vide-lsp-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}

- name: Setup Rust
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-rust

- name: Setup sccache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-sccache
with:
cmake-launcher: "true"

- name: Install Emscripten SDK
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-emscripten
with:
version: ${{ env.EMSDK_VERSION }}
Expand All @@ -219,20 +219,20 @@ jobs:
- name: Install JS dependencies
run: npm ci

- name: Build playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
working-directory: website
- name: Build Vide LSP WASM
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}
run: |
source "${EMSDK}/emsdk_env.sh"
npm --workspace playground run build:wasm
node crates/vide-lsp-wasm/scripts/build.mjs

- name: Save playground WASM cache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
- name: Save Vide LSP WASM cache
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
continue-on-error: true
with:
path: website/playground/public/wasm
key: ${{ steps.playground-wasm-cache.outputs.cache-primary-key }}
path: crates/vide-lsp-wasm/dist
key: ${{ steps.vide-lsp-wasm-cache.outputs.cache-primary-key }}

- name: Set VSIX build metadata
working-directory: .
Expand Down
46 changes: 23 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,38 +147,38 @@ jobs:
working-directory: editors/vscode
steps:
- uses: actions/checkout@v4
- name: Restore playground WASM cache
id: playground-wasm-cache
- name: Restore Vide LSP WASM cache
id: vide-lsp-wasm-cache
uses: actions/cache/restore@v4
with:
path: website/playground/public/wasm
key: playground-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'website/playground/scripts/build-vide-wasm.mjs', 'website/playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
- name: Verify cached playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit == 'true'
working-directory: .
path: crates/vide-lsp-wasm/dist
key: vide-lsp-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
- name: Verify cached Vide LSP WASM
if: steps.vide-lsp-wasm-cache.outputs.cache-hit == 'true'
working-directory: ${{ github.workspace }}
run: |
test -s website/playground/public/wasm/vide-lsp.js
test -s website/playground/public/wasm/vide-core.js
test -s website/playground/public/wasm/vide-core.wasm
test -s crates/vide-lsp-wasm/dist/vide-lsp.js
test -s crates/vide-lsp-wasm/dist/vide-core.js
test -s crates/vide-lsp-wasm/dist/vide-core.wasm
- name: Install Rust
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-rust
- name: Setup sccache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-sccache
with:
cmake-launcher: "true"
- name: Rust Cache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: Swatinem/rust-cache@v2
continue-on-error: true
with:
shared-key: vscode-web-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}
key: wasm-src-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'website/playground/scripts/build-vide-wasm.mjs', 'website/playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
key: wasm-src-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
cache-workspace-crates: true
cache-on-failure: true
- name: Install Emscripten SDK
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-emscripten
with:
version: ${{ env.EMSDK_VERSION }}
Expand All @@ -195,19 +195,19 @@ jobs:
- name: Install web smoke dependencies
working-directory: editors/vscode/test-web
run: npm ci
- name: Build playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
working-directory: website
- name: Build Vide LSP WASM
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}
run: |
source "${EMSDK}/emsdk_env.sh"
npm --workspace playground run build:wasm
- name: Save playground WASM cache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
node crates/vide-lsp-wasm/scripts/build.mjs
- name: Save Vide LSP WASM cache
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
continue-on-error: true
with:
path: website/playground/public/wasm
key: ${{ steps.playground-wasm-cache.outputs.cache-primary-key }}
path: crates/vide-lsp-wasm/dist
key: ${{ steps.vide-lsp-wasm-cache.outputs.cache-primary-key }}
- name: Web smoke test
run: npm run test:web

Expand Down
43 changes: 21 additions & 22 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -328,42 +328,42 @@ jobs:
with:
ref: ${{ github.event.workflow_run.head_sha || github.event.release.tag_name || github.ref }}

- name: Restore playground WASM cache
id: playground-wasm-cache
- name: Restore Vide LSP WASM cache
id: vide-lsp-wasm-cache
uses: actions/cache/restore@v4
with:
path: website/playground/public/wasm
key: playground-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'website/playground/scripts/build-vide-wasm.mjs', 'website/playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
path: crates/vide-lsp-wasm/dist
key: vide-lsp-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}

- name: Verify cached playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit == 'true'
- name: Verify cached Vide LSP WASM
if: steps.vide-lsp-wasm-cache.outputs.cache-hit == 'true'
run: |
test -s website/playground/public/wasm/vide-lsp.js
test -s website/playground/public/wasm/vide-core.js
test -s website/playground/public/wasm/vide-core.wasm
test -s crates/vide-lsp-wasm/dist/vide-lsp.js
test -s crates/vide-lsp-wasm/dist/vide-core.js
test -s crates/vide-lsp-wasm/dist/vide-core.wasm

- name: Install Rust
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-rust

- name: Setup sccache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-sccache
with:
cmake-launcher: "true"

- name: Rust Cache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: Swatinem/rust-cache@v2
continue-on-error: true
with:
shared-key: docs-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}
key: wasm-src-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'website/playground/scripts/build-vide-wasm.mjs', 'website/playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
key: wasm-src-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
cache-workspace-crates: true
cache-on-failure: true

- name: Install Emscripten SDK
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-emscripten
with:
version: ${{ env.EMSDK_VERSION }}
Expand All @@ -383,20 +383,19 @@ jobs:
npm install --no-save
working-directory: website

- name: Build playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
- name: Build Vide LSP WASM
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
run: |
source "${EMSDK}/emsdk_env.sh"
npm --workspace playground run build:wasm
working-directory: website
node crates/vide-lsp-wasm/scripts/build.mjs

- name: Save playground WASM cache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
- name: Save Vide LSP WASM cache
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
continue-on-error: true
with:
path: website/playground/public/wasm
key: ${{ steps.playground-wasm-cache.outputs.cache-primary-key }}
path: crates/vide-lsp-wasm/dist
key: ${{ steps.vide-lsp-wasm-cache.outputs.cache-primary-key }}

- name: Build docs
run: npm run build
Expand Down
43 changes: 21 additions & 22 deletions .github/workflows/docs-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,42 +75,42 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Restore playground WASM cache
id: playground-wasm-cache
- name: Restore Vide LSP WASM cache
id: vide-lsp-wasm-cache
uses: actions/cache/restore@v4
with:
path: website/playground/public/wasm
key: playground-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'website/playground/scripts/build-vide-wasm.mjs', 'website/playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
path: crates/vide-lsp-wasm/dist
key: vide-lsp-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}

- name: Verify cached playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit == 'true'
- name: Verify cached Vide LSP WASM
if: steps.vide-lsp-wasm-cache.outputs.cache-hit == 'true'
run: |
test -s website/playground/public/wasm/vide-lsp.js
test -s website/playground/public/wasm/vide-core.js
test -s website/playground/public/wasm/vide-core.wasm
test -s crates/vide-lsp-wasm/dist/vide-lsp.js
test -s crates/vide-lsp-wasm/dist/vide-core.js
test -s crates/vide-lsp-wasm/dist/vide-core.wasm

- name: Install Rust
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-rust

- name: Setup sccache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-sccache
with:
cmake-launcher: "true"

- name: Rust Cache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: Swatinem/rust-cache@v2
continue-on-error: true
with:
shared-key: docs-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}
key: wasm-src-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'website/playground/scripts/build-vide-wasm.mjs', 'website/playground/scripts/script-utils.mjs', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
key: wasm-src-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', '.github/actions/setup-emscripten/**', '.github/actions/setup-rust/**') }}
cache-workspace-crates: true
cache-on-failure: true

- name: Install Emscripten SDK
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-emscripten
with:
version: ${{ env.EMSDK_VERSION }}
Expand All @@ -129,20 +129,19 @@ jobs:
npm install --no-save
working-directory: website

- name: Build playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
- name: Build Vide LSP WASM
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
run: |
source "${EMSDK}/emsdk_env.sh"
npm --workspace playground run build:wasm
working-directory: website
node crates/vide-lsp-wasm/scripts/build.mjs

- name: Save playground WASM cache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
- name: Save Vide LSP WASM cache
if: steps.vide-lsp-wasm-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
continue-on-error: true
with:
path: website/playground/public/wasm
key: ${{ steps.playground-wasm-cache.outputs.cache-primary-key }}
path: crates/vide-lsp-wasm/dist
key: ${{ steps.vide-lsp-wasm-cache.outputs.cache-primary-key }}

- name: Build docs
run: npm run build
Expand Down
1 change: 1 addition & 0 deletions crates/vide-lsp-wasm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { copyFileSync, existsSync, mkdirSync } from "node:fs";
import { delimiter, dirname, resolve } from "node:path";
import { repoRoot, run, workspaceRoot } from "./script-utils.mjs";
import { fileURLToPath } from "node:url";
import { run } from "../../website/playground/scripts/script-utils.mjs";

const crateRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const workspaceRoot = resolve(crateRoot, "..", "..");

if (process.argv.slice(2).some((arg) => arg !== "--")) {
throw new Error(`build:wasm does not accept arguments.`);
Expand All @@ -18,8 +22,8 @@ if (!buildEnv.EM_CONFIG && existsSync(emConfig)) {
buildEnv.EM_CONFIG = emConfig;
}

run("rustup", ["target", "add", "wasm32-unknown-emscripten"], { env: buildEnv });
run("ninja", ["--version"], { env: buildEnv });
run("rustup", ["target", "add", "wasm32-unknown-emscripten"], { cwd: workspaceRoot, env: buildEnv });
run("ninja", ["--version"], { cwd: workspaceRoot, env: buildEnv });

const linkArgs = [
"-C", "link-arg=-sENVIRONMENT=web,worker",
Expand All @@ -44,6 +48,7 @@ Object.assign(buildEnv, {

const crateManifest = resolve(workspaceRoot, "crates", "vide-lsp-wasm", "Cargo.toml");
run("cargo", ["build", "--manifest-path", crateManifest, "--target", "wasm32-unknown-emscripten", "--release"], {
cwd: workspaceRoot,
env: buildEnv,
});

Expand All @@ -53,7 +58,7 @@ const coreWasm = resolve(targetRoot, "vide_lsp_wasm.wasm");
assertFile(coreJs, "Emscripten JavaScript output");
assertFile(coreWasm, "Emscripten WASM output");

const outWasmRoot = resolve(repoRoot, "public", "wasm");
const outWasmRoot = resolve(crateRoot, "dist");
mkdirSync(outWasmRoot, { recursive: true });
copyFileSync(coreJs, resolve(outWasmRoot, "vide-core.js"));
copyFileSync(coreWasm, resolve(outWasmRoot, "vide-core.wasm"));
Expand All @@ -66,7 +71,6 @@ function assertFile(path, label) {
throw new Error(`${label} not found at ${path}`);
}
}

function findEmscriptenRoot() {
if (process.env.EMSDK) {
const root = resolve(process.env.EMSDK, "upstream", "emscripten");
Expand All @@ -81,7 +85,7 @@ function findEmscriptenRoot() {
}

throw new Error(
"Emscripten SDK is not configured. Activate emsdk_env first or set EMSDK before running npm run build:wasm.",
"Emscripten SDK is not configured. Activate emsdk_env first or set EMSDK before building vide-lsp-wasm.",
);
}

Expand Down
2 changes: 1 addition & 1 deletion editors/vscode/scripts/copy-web-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as path from "node:path";

const vscodeDir = path.resolve(__dirname, "..");
const repoRoot = path.resolve(vscodeDir, "..", "..");
const sourceDir = path.join(repoRoot, "website", "playground", "public", "wasm");
const sourceDir = path.join(repoRoot, "crates", "vide-lsp-wasm", "dist");
const targetDir = path.join(vscodeDir, "dist", "browser", "wasm");
const requiredFiles = ["vide-lsp.js", "vide-core.js", "vide-core.wasm"];
const buildWasmCommand = "npm --prefix website --workspace playground run build:wasm";
Expand Down
Loading
Loading