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
212 changes: 212 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
name: Run Tests and Build

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:

jobs:
pylight-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy

- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
./pylight/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Check formatting
working-directory: ./pylight
run: cargo fmt -- --check

- name: Run clippy
working-directory: ./pylight
run: cargo clippy -- -D warnings

- name: Run tests
working-directory: ./pylight
run: cargo test

- name: Build release binary
working-directory: ./pylight
run: cargo build --release --bin symbol_search_lsp

pydance-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: pydance/package-lock.json

- name: Install dependencies
working-directory: ./pydance
run: npm ci

- name: Run linter
working-directory: ./pydance
run: npm run lint

- name: Check formatting
working-directory: ./pydance
run: npm run format:check

- name: Compile TypeScript
working-directory: ./pydance
run: npm run compile

- name: Setup Rust for pylight binary
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
./pylight/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build pylight binary
working-directory: ./pylight
run: cargo build --release --bin symbol_search_lsp

- name: Copy pylight binary to pydance
run: cp ./pylight/target/release/symbol_search_lsp ./pydance/pylight

- name: Run unit tests (Linux)
if: runner.os == 'Linux'
working-directory: ./pydance
run: xvfb-run -a npm test

- name: Run unit tests (macOS/Windows)
if: runner.os != 'Linux'
working-directory: ./pydance
run: npm test

- name: Run integration tests (Linux)
if: runner.os == 'Linux'
working-directory: ./pydance
run: xvfb-run -a npm run test:integration

- name: Run integration tests (macOS/Windows)
if: runner.os != 'Linux'
working-directory: ./pydance
run: npm run test:integration

build-vsix:
needs: [pylight-test, pydance-test]
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
platform: linux-x64
- os: macos-latest
target: aarch64-apple-darwin
platform: darwin-arm64
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: pydance/package-lock.json

- name: Install dependencies
working-directory: ./pydance
run: npm ci

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
target: ${{ matrix.target }}

- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
./pylight/target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build pylight binary
working-directory: ./pylight
run: |
# Build for the target platform
cargo build --release --target ${{ matrix.target }} --bin symbol_search_lsp

- name: Copy pylight binary to pydance
run: |
# Copy the platform-specific binary
cp ./pylight/target/${{ matrix.target }}/release/symbol_search_lsp ./pydance/pylight
# Make it executable
chmod +x ./pydance/pylight

- name: Compile TypeScript
working-directory: ./pydance
run: npm run compile

- name: Install vsce
run: npm install -g @vscode/vsce

- name: Package VSIX
working-directory: ./pydance
run: |
# Package with dependencies included
vsce package

- name: Test VSIX installation
working-directory: ./pydance
run: |
# Find the created VSIX file
VSIX_FILE=$(ls *.vsix | head -n 1)
echo "Testing VSIX: $VSIX_FILE"

# Install VS Code CLI if not on macOS (macOS has it pre-installed)
if [[ "${{ runner.os }}" == "Linux" ]]; then
wget -q "https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64" -O vscode-cli.tar.gz
tar -xzf vscode-cli.tar.gz
chmod +x code
export PATH=$PWD:$PATH
fi

# Try to install the extension (won't activate without a workspace, but will verify package integrity)
code --install-extension "$VSIX_FILE" --force || echo "Installation test completed"

- name: Upload VSIX artifact
uses: actions/upload-artifact@v4
with:
name: pydance-vsix-${{ matrix.platform }}
path: ./pydance/*.vsix
retention-days: 30
68 changes: 0 additions & 68 deletions .github/workflows/pydance.yml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/pylight.yml

This file was deleted.

4 changes: 2 additions & 2 deletions pydance/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"files.eol": "\n",
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true
}
}
37 changes: 37 additions & 0 deletions pydance/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.vscode/**
.vscode-test/**
src/**
.gitignore
.yarnrc
tsconfig.json
vsc-extension-quickstart.md
**/tsconfig.json
**/*.map
**/*.ts
**/.eslintrc.json
test/**
.github/**
**/*.vsix
node_modules/**/test/**
node_modules/**/tests/**
node_modules/**/spec/**
node_modules/**/example/**
node_modules/**/examples/**
node_modules/**/demo/**
node_modules/**/demos/**
node_modules/**/docs/**
node_modules/**/doc/**
node_modules/**/*.md
node_modules/**/*.markdown
node_modules/**/LICENSE*
node_modules/**/LICENCE*
node_modules/**/license*
node_modules/**/licence*
node_modules/**/.npmignore
node_modules/**/.gitignore
node_modules/**/.editorconfig
node_modules/**/.eslintrc*
node_modules/**/.prettierrc*
node_modules/**/Makefile
node_modules/**/Gulpfile.js
node_modules/**/Gruntfile.js
Loading
Loading