Skip to content
Merged
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
7 changes: 7 additions & 0 deletions .github/ci-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ rust:

vscode:
- "editors/vscode/**"
- "packages/vide-extension-shared/**"
- ".github/ci-modules.yml"
- ".github/workflows/ci.yml"

Expand All @@ -33,7 +34,13 @@ package:
- "editors/vscode/scripts/**"
- "editors/vscode/src/**"
- "editors/vscode/syntaxes/**"
- "packages/vide-extension-shared/**"
- "playground/package.json"
- "playground/package-lock.json"
- "playground/scripts/build-vide-wasm.mjs"
- "playground/scripts/script-utils.mjs"
- ".github/actions/setup-rust/**"
- ".github/actions/setup-sccache/**"
- ".github/actions/setup-emscripten/**"
- ".github/ci-modules.yml"
- ".github/workflows/ci.yml"
162 changes: 162 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

env:
EMSDK_VERSION: 5.0.2

jobs:
changes:
name: Detect changes
Expand Down Expand Up @@ -112,6 +115,77 @@ jobs:
- name: Test extension
run: npm test

vscode-web-smoke:
name: VS Code Web Smoke
needs: changes
if: github.event_name == 'workflow_dispatch' || needs.changes.outputs.vscode == 'true' || needs.changes.outputs.package == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: editors/vscode
steps:
- uses: actions/checkout@v4
- name: Restore playground WASM cache
id: playground-wasm-cache
uses: actions/cache/restore@v4
with:
path: playground/public/wasm
key: playground-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'playground/scripts/build-vide-wasm.mjs', '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: .
run: |
test -s playground/public/wasm/vide-lsp.js
test -s playground/public/wasm/vide-core.js
test -s playground/public/wasm/vide-core.wasm
- name: Install Rust
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-rust
with:
components: rustfmt
- name: Setup sccache
if: steps.playground-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'
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/**', 'playground/scripts/build-vide-wasm.mjs', 'playground/scripts/script-utils.mjs', '.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'
uses: ./.github/actions/setup-emscripten
with:
version: ${{ env.EMSDK_VERSION }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: editors/vscode/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
working-directory: playground
run: |
source "${EMSDK}/emsdk_env.sh"
npm run build:wasm
- name: Save playground WASM cache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
continue-on-error: true
with:
path: playground/public/wasm
key: ${{ steps.playground-wasm-cache.outputs.cache-primary-key }}
- name: Web smoke test
run: npm run test:web

dev-package:
name: Dev Package (${{ matrix.target }})
needs: changes
Expand Down Expand Up @@ -221,6 +295,94 @@ jobs:
if-no-files-found: error
retention-days: 14

dev-web-package:
name: Dev Package (web)
needs: changes
if: github.event_name != 'pull_request' && (github.event_name == 'workflow_dispatch' || needs.changes.outputs.package == 'true')
runs-on: ubuntu-latest
defaults:
run:
working-directory: editors/vscode
steps:
- uses: actions/checkout@v4
- name: Restore playground WASM cache
id: playground-wasm-cache
uses: actions/cache/restore@v4
with:
path: playground/public/wasm
key: playground-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'playground/scripts/build-vide-wasm.mjs', '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: .
run: |
test -s playground/public/wasm/vide-lsp.js
test -s playground/public/wasm/vide-core.js
test -s playground/public/wasm/vide-core.wasm
- name: Install Rust
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-rust
with:
components: rustfmt
- name: Setup sccache
if: steps.playground-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'
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/**', 'playground/scripts/build-vide-wasm.mjs', 'playground/scripts/script-utils.mjs', '.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'
uses: ./.github/actions/setup-emscripten
with:
version: ${{ env.EMSDK_VERSION }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: editors/vscode/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
working-directory: playground
run: |
source "${EMSDK}/emsdk_env.sh"
npm run build:wasm
- name: Save playground WASM cache
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
continue-on-error: true
with:
path: playground/public/wasm
key: ${{ steps.playground-wasm-cache.outputs.cache-primary-key }}
- name: Set build metadata
id: build-metadata
shell: bash
working-directory: .
run: |
commit_hash="$(git rev-parse --short "$GITHUB_SHA")"
echo "commit_hash=${commit_hash}" >> "$GITHUB_OUTPUT"
echo "VIDE_EXTENSION_BUILD_KIND=nightly" >> "$GITHUB_ENV"
echo "VIDE_EXTENSION_COMMIT_HASH=${commit_hash}" >> "$GITHUB_ENV"
echo "VIDE_EXTENSION_BUILD_DATE=$(date -u +'%Y%m%dT%H%M%SZ')" >> "$GITHUB_ENV"
- name: Package extension
run: npm run package:web
- name: Upload dev VSIX
uses: actions/upload-artifact@v4
with:
name: vide-vscode-dev-web-${{ steps.build-metadata.outputs.commit_hash }}
path: editors/vscode/vide-vscode-web.vsix
if-no-files-found: error
retention-days: 14

dev-alpine-package:
name: Dev Package (${{ matrix.target }})
needs: changes
Expand Down
108 changes: 106 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'workflow_dispatch' && 'beta' || github.ref }}
cancel-in-progress: false

env:
EMSDK_VERSION: 5.0.2

jobs:
changelog:
name: Check changelog
Expand Down Expand Up @@ -253,9 +256,110 @@ jobs:
path: vide-${{ matrix.target }}
if-no-files-found: error

build-web-package:
name: Package web
needs: changelog
runs-on: ubuntu-latest
defaults:
run:
working-directory: editors/vscode
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Restore playground WASM cache
id: playground-wasm-cache
uses: actions/cache/restore@v4
with:
path: playground/public/wasm
key: playground-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'playground/scripts/build-vide-wasm.mjs', '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: .
run: |
test -s playground/public/wasm/vide-lsp.js
test -s playground/public/wasm/vide-core.js
test -s playground/public/wasm/vide-core.wasm

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

- name: Setup sccache
if: steps.playground-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'
uses: Swatinem/rust-cache@v2
continue-on-error: true
with:
shared-key: release-web-wasm-${{ runner.os }}-${{ env.EMSDK_VERSION }}
key: wasm-src-${{ hashFiles('Cargo.toml', 'Cargo.lock', 'build.rs', 'rust-toolchain.toml', 'src/**', 'crates/**', 'playground/scripts/build-vide-wasm.mjs', 'playground/scripts/script-utils.mjs', '.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'
uses: ./.github/actions/setup-emscripten
with:
version: ${{ env.EMSDK_VERSION }}

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: editors/vscode/package-lock.json

- name: Install JS dependencies
run: npm ci

- name: Build playground WASM
if: steps.playground-wasm-cache.outputs.cache-hit != 'true'
working-directory: playground
run: |
source "${EMSDK}/emsdk_env.sh"
npm run build:wasm

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

- name: Set build metadata
shell: bash
working-directory: .
run: |
if [ "${GITHUB_EVENT_NAME}" = "workflow_dispatch" ]; then
echo "VIDE_EXTENSION_BUILD_KIND=beta" >> "$GITHUB_ENV"
echo "VIDE_EXTENSION_COMMIT_HASH=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
echo "VIDE_EXTENSION_BUILD_DATE=$(date -u +'%Y%m%dT%H%M%SZ')" >> "$GITHUB_ENV"
else
echo "VIDE_EXTENSION_BUILD_KIND=stable" >> "$GITHUB_ENV"
fi

- name: Build VSIX
run: npm run package:web

- name: Upload VSIX
uses: actions/upload-artifact@v4
with:
name: vide-vscode-${{ github.event_name == 'workflow_dispatch' && 'beta' || 'stable' }}-web
path: editors/vscode/vide-vscode-web.vsix
if-no-files-found: error

publish:
name: Publish ${{ github.event_name == 'workflow_dispatch' && 'beta' || 'stable' }} release
needs: [build-and-package, build-alpine-package]
needs: [build-and-package, build-alpine-package, build-web-package]
runs-on: ubuntu-latest
env:
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && 'beta' || github.ref_name }}
Expand Down Expand Up @@ -297,7 +401,7 @@ jobs:
publish-marketplace:
name: Publish VS Code Marketplace
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [build-and-package, publish]
needs: [build-and-package, build-web-package, publish]
runs-on: ubuntu-latest
defaults:
run:
Expand Down
1 change: 1 addition & 0 deletions editors/vscode/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ out/
README.md
build-info.json
.vscode-test/
.vscode-test-web/
*.log
.DS_Store
bun.lock
Expand Down
3 changes: 3 additions & 0 deletions editors/vscode/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ node_modules/**
out/**
src/**
test/**
test-web/**
.gitignore
.yarnrc
vsc-extension-quickstart.md
**/tsconfig.json
**/tsconfig.*.json
**/.eslintrc.json
**/*.map
**/*.ts
Expand All @@ -16,3 +18,4 @@ pnpm-lock.yaml
bun.lock
scripts/**
server/*/
dist/test-web/**
3 changes: 2 additions & 1 deletion editors/vscode/l10n/bundle.l10n.zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,6 @@
"Failed to run Qihe analysis: {0}": "无法运行 Qihe 分析:{0}",
"Unable to update Vide diagnostic rules: {0}": "无法更新 Vide 诊断规则:{0}",
"Restart": "重启",
"Vide server configuration changed. Restart the language server to apply it.": "Vide 服务器配置已更改。请重启语言服务器以应用更改。"
"Vide server configuration changed. Restart the language server to apply it.": "Vide 服务器配置已更改。请重启语言服务器以应用更改。",
"{0} is not available in vscode.dev yet.": "{0} 暂时无法在 vscode.dev 中使用。"
}
Loading
Loading