diff --git a/.github/workflows/build-vscode-extension.yml b/.github/workflows/build-vscode-extension.yml new file mode 100644 index 000000000..fd959807e --- /dev/null +++ b/.github/workflows/build-vscode-extension.yml @@ -0,0 +1,204 @@ +name: Build VS Code Extension + +on: + workflow_call: + inputs: + platforms: + description: "JSON array of platform configurations (defaults to all platforms)" + required: false + type: string + default: | + [ + { + "os": "windows-latest", + "platform": "win32", + "arch": "x64", + "npm_config_arch": "x64" + }, + { + "os": "windows-latest", + "platform": "win32", + "arch": "arm64", + "npm_config_arch": "arm" + }, + { + "os": "ubuntu-latest", + "platform": "linux", + "arch": "x64", + "npm_config_arch": "x64" + }, + { + "os": "ubuntu-latest", + "platform": "linux", + "arch": "arm64", + "npm_config_arch": "arm64" + }, + { + "os": "ubuntu-latest", + "platform": "linux", + "arch": "armhf", + "npm_config_arch": "arm" + }, + { + "os": "ubuntu-latest", + "platform": "alpine", + "arch": "x64", + "npm_config_arch": "x64" + }, + { + "os": "macos-13", + "platform": "darwin", + "arch": "x64", + "npm_config_arch": "x64" + }, + { + "os": "macos-13", + "platform": "darwin", + "arch": "arm64", + "npm_config_arch": "arm64" + } + ] + pre-release: + description: "Whether to build as pre-release" + required: false + type: boolean + default: false + commit-sha: + description: "Commit SHA for version modification (optional, uses first 7 chars)" + required: false + type: string + +jobs: + build: + strategy: + matrix: + include: ${{ fromJson(inputs.platforms) }} + runs-on: ${{ matrix.os }} + steps: + # 1. Check-out repository + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 # This ensures all tags are fetched + + # 2. Install npm dependencies + - name: Use Node.js from .nvmrc + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - name: Cache extension node_modules + uses: actions/cache@v4 + with: + path: extensions/vscode/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('extensions/vscode/package-lock.json') }} + + - name: Cache core node_modules + uses: actions/cache@v4 + with: + path: core/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} + + - name: Cache gui node_modules + uses: actions/cache@v4 + with: + path: gui/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} + + # Build all packages using the authoritative build script + - name: Build packages (Windows) + run: ./scripts/build-packages.ps1 + if: matrix.os == 'windows-latest' + + - name: Build packages (Linux/macOS) + run: ./scripts/build-packages.sh + if: matrix.os != 'windows-latest' + + - name: Install extension Dependencies + run: | + cd extensions/vscode + npm ci + env: + # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 + GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + + - name: Install gui Dependencies + run: | + cd gui + npm ci + + # npm ci doesn't end up capturing the @lancedb/... dep because it's not in the package-lock.json + - name: Install Core Dependencies + run: | + cd core + npm ci + npm i vectordb + + # 2.5. Pre package + - name: Set var for environment info + shell: pwsh + run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $env:GITHUB_ENV + + - name: Prepackage the extension + run: | + cd extensions/vscode + npm run prepackage -- --target ${{ env.target }} + + # 3. Re-install esbuild (for cases that we force installed for another arch in prepackage.js) + - name: Re-install esbuild + run: | + cd extensions/vscode + npm install -f esbuild + + # 3.5. Modify version with commit SHA + - name: Modify package.json version with commit SHA + if: inputs.commit-sha != '' + run: | + cd extensions/vscode + # Get current version from package.json + CURRENT_VERSION=$(node -p "require('./package.json').version") + + # Create new version with short commit SHA (first 7 chars) + COMMIT_SHORT="${{ inputs.commit-sha }}" + NEW_VERSION="${CURRENT_VERSION}-${COMMIT_SHORT:0:7}" + + echo "๐Ÿ“ Updating package.json version from $CURRENT_VERSION to $NEW_VERSION" + + # Update version in package.json + sed -i.bak "s/\"version\": \"$CURRENT_VERSION\"/\"version\": \"$NEW_VERSION\"/" package.json + + # Remove backup file + rm -f package.json.bak + + # Verify the change + echo "โœ… New version: $(node -p "require('./package.json').version")" + + # 4. Package the extension + - name: Package extension (build artifacts) + run: | + cd extensions/vscode + npm run package + + - name: Package extension (.vsix files) + run: | + cd extensions/vscode + if [ "${{ inputs.pre-release }}" = "true" ]; then + npx vsce package --pre-release --no-dependencies --target ${{ env.target }} + else + npx vsce package --no-dependencies --target ${{ env.target }} + fi + shell: bash + + # 5. Upload build artifacts (for e2e tests) + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: vscode-extension-build-${{ runner.os }} + path: extensions/vscode/build + + # 6. Upload .vsix artifacts (for releases and downloading) + - name: Upload .vsix artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.target }}-vsix + path: "extensions/vscode/*.vsix" diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 956d249c4..531129c79 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -63,7 +63,6 @@ jobs: - name: Bump version in gradle.properties run: | - cd extensions/intellij awk '/pluginVersion=/{split($0,a,"="); split(a[2],b,"."); b[3]+=1; printf "%s=%s.%s.%s\n",a[1],b[1],b[2],b[3];next}1' gradle.properties > tmp && mv tmp gradle.properties rm -rf tmp NEW_VERSION=$(grep 'pluginVersion=' gradle.properties | cut -d'=' -f2) @@ -224,10 +223,6 @@ jobs: # apple-product-id: dev.continue.continue-binary # options: --options runtime --entitlements entitlements.xml - # Build plugin - - name: Build plugin - run: ./gradlew buildPlugin - # Publish the plugin to JetBrains Marketplace - name: Publish EAP Plugin if: github.event_name == 'release' || github.event.inputs.publish_build == 'true' @@ -237,7 +232,7 @@ jobs: PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }} PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }} RELEASE_CHANNEL: eap - run: ./gradlew publishPlugin + run: ./gradlew publishPlugin --info --stacktrace - name: Publish Stable Plugin if: github.event_name == 'release' || github.event.inputs.publish_build == 'true' @@ -247,7 +242,7 @@ jobs: PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }} PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }} RELEASE_CHANNEL: default - run: ./gradlew publishPlugin + run: ./gradlew publishPlugin --info --stacktrace # Prepare plugin archive content for creating artifact - name: Prepare Plugin Artifact diff --git a/.github/workflows/main-build.yaml b/.github/workflows/main-build.yaml new file mode 100644 index 000000000..de22d6c53 --- /dev/null +++ b/.github/workflows/main-build.yaml @@ -0,0 +1,30 @@ +name: Build Extension on Main + +on: + push: + branches: + - main + +jobs: + build: + uses: ./.github/workflows/build-vscode-extension.yml + with: + # Build only for macOS latest and Ubuntu latest + platforms: | + [ + { + "os": "ubuntu-latest", + "platform": "linux", + "arch": "x64", + "npm_config_arch": "x64" + }, + { + "os": "macos-latest", + "platform": "darwin", + "arch": "arm64", + "npm_config_arch": "arm64" + } + ] + pre-release: false + commit-sha: ${{ github.sha }} + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index ce1e59e66..a8abf6cb3 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -29,44 +29,15 @@ jobs: build: needs: check_release_name if: needs.check_release_name.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch' - strategy: - matrix: - include: - - os: windows-latest - platform: win32 - arch: x64 - npm_config_arch: x64 - - os: windows-latest - platform: win32 - arch: arm64 - npm_config_arch: arm - - os: ubuntu-latest - platform: linux - arch: x64 - npm_config_arch: x64 - - os: ubuntu-latest - platform: linux - arch: arm64 - npm_config_arch: arm64 - - os: ubuntu-latest - platform: linux - arch: armhf - npm_config_arch: arm - - os: ubuntu-latest - platform: alpine - arch: x64 - npm_config_arch: x64 - - os: macos-13 - platform: darwin - arch: x64 - npm_config_arch: x64 - - os: macos-13 - platform: darwin - arch: arm64 - npm_config_arch: arm64 - runs-on: ${{ matrix.os }} + uses: ./.github/workflows/build-vscode-extension.yml + with: + # Uses default platforms (all supported platforms) + pre-release: false + secrets: inherit + + check-version: + runs-on: ubuntu-latest steps: - # 1. Check-out repository - name: Checkout uses: actions/checkout@v4 with: @@ -80,107 +51,6 @@ jobs: cd extensions/vscode node scripts/versionCheck.js - # 2. Install npm dependencies - - name: Use Node.js from .nvmrc - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - name: Cache extension node_modules - uses: actions/cache@v3 - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - name: Cache core node_modules - uses: actions/cache@v3 - with: - path: core/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} - - - name: Cache gui node_modules - uses: actions/cache@v3 - with: - path: gui/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} - - - name: Build packages (Windows) - run: ./scripts/build-packages.ps1 - if: matrix.os == 'windows-latest' - - - name: Build packages (Unix) - run: ./scripts/build-packages.sh - if: matrix.os != 'windows-latest' - - - name: Install extension Dependencies - run: | - cd extensions/vscode - npm ci - env: - # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - - - name: Install gui Dependencies - run: | - cd gui - npm ci - - # npm ci doesn't end up capturing the @lancedb/... dep because it's not in the package-lock.json - - name: Install Core Dependencies - run: | - cd core - npm ci - npm i vectordb - - # - name: Run core tests - # run: | - # cd core - # npm run test - # env: - # OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - - # 2.5. Pre package - - name: Set var for environment info - shell: pwsh - run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $env:GITHUB_ENV - - - name: Prepackage the extension - run: | - cd extensions/vscode - npm run prepackage -- --target ${{ env.target }} - - # 3. Re-install esbuild (for cases that we force installed for another arch in prepackage.js) - - name: Re-install esbuild - run: | - cd extensions/vscode - npm install -f esbuild - - # 4. Run tests for the extension - # - name: Install Xvfb for Linux and run tests - # run: | - # sudo apt-get install -y xvfb # Install Xvfb - # Xvfb :99 & # Start Xvfb - # export DISPLAY=:99 # Export the display number to the environment - # cd extensions/vscode - # npm run test - # if: matrix.os == 'ubuntu-latest' - - # - name: Run extension tests - # run: | - # cd extensions/vscode - # npm run test - # if: matrix.os != 'ubuntu-latest' - - # 5. Package the extension - - name: Package the extension - run: cd extensions/vscode && npx vsce package --no-dependencies --target ${{ env.target }} - - # 6. Upload the .vsix as an artifact - - uses: actions/upload-artifact@v4 - with: - name: ${{ env.target }}-vsix - path: "extensions/vscode/*.vsix" - release: permissions: contents: write diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index a88dad8c0..9733f856c 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -48,7 +48,7 @@ jobs: - name: Check code formatting with Prettier run: npx prettier --check "**/*.{js,jsx,ts,tsx,json,css,md}" --ignore-path .gitignore --ignore-path .prettierignore - install-config-yaml: + build-packages: needs: install-root runs-on: ubuntu-latest steps: @@ -58,52 +58,11 @@ jobs: with: node-version-file: ".nvmrc" - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Install config-yaml dependencies - if: steps.config-yaml-cache.outputs.cache-hit != 'true' - run: | - cd packages/config-yaml - npm ci - - install-openai-adapters: - needs: install-root - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Install openai-adapters dependencies - if: steps.openai-adapters-cache.outputs.cache-hit != 'true' - run: | - cd packages/openai-adapters - npm ci + - name: Build packages (Unix) + run: ./scripts/build-packages.sh config-yaml-checks: - needs: install-config-yaml + needs: build-packages runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -117,23 +76,20 @@ jobs: path: node_modules key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Build and check config-yaml + - name: Build packages and check config-yaml run: | + ./scripts/build-packages.sh cd packages/config-yaml npx tsc --noEmit # Tests are currently failing, commenting out for now - # npm test - npm run build + # npm test install-core: needs: install-root - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] steps: - uses: actions/checkout@v4 @@ -160,7 +116,7 @@ jobs: npm ci core-checks: - needs: [install-core, install-config-yaml, install-openai-adapters] + needs: install-core runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -170,38 +126,21 @@ jobs: node-version-file: ".nvmrc" - uses: actions/cache@v4 - id: root-cache with: path: node_modules key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - uses: actions/cache@v4 - id: core-cache with: path: core/node_modules key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml + - name: Build packages and install core dependencies run: | - cd packages/config-yaml - npm run build + ./scripts/build-packages.sh + cd core + npm ci - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - name: Type check and lint run: | cd core @@ -211,8 +150,7 @@ jobs: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} install-gui: - needs: - [install-root, install-core, install-config-yaml, install-openai-adapters] + needs: [install-root, install-core] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -237,33 +175,15 @@ jobs: path: gui/node_modules key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml + - name: Build packages and install dependencies run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Install gui dependencies - if: steps.gui-cache.outputs.cache-hit != 'true' - run: | - cd gui - npm ci + ./scripts/build-packages.sh + if [ "${{ steps.gui-cache.outputs.cache-hit }}" != "true" ]; then + cd core + npm ci + cd ../gui + npm ci + fi gui-checks: needs: install-gui @@ -285,32 +205,17 @@ jobs: key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - uses: actions/cache@v4 - id: gui-cache with: path: gui/node_modules key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Build config-yaml + - name: Build packages and install dependencies run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build + ./scripts/build-packages.sh + cd core + npm ci + cd ../gui + npm ci - name: Type check and lint run: | @@ -319,8 +224,7 @@ jobs: npm run lint binary-checks: - needs: - [install-root, install-core, install-config-yaml, install-openai-adapters] + needs: [install-root, install-core] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -345,33 +249,15 @@ jobs: path: binary/node_modules key: ${{ runner.os }}-binary-node-modules-${{ hashFiles('binary/package-lock.json') }} - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml + - name: Build packages and install dependencies run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Install binary dependencies - if: steps.binary-cache.outputs.cache-hit != 'true' - run: | - cd binary - npm ci + ./scripts/build-packages.sh + if [ "${{ steps.binary-cache.outputs.cache-hit }}" != "true" ]; then + cd core + npm ci + cd ../binary + npm ci + fi - name: Type check run: | @@ -379,9 +265,11 @@ jobs: npx tsc --noEmit install-vscode: - needs: - [install-root, install-core, install-config-yaml, install-openai-adapters] - runs-on: ubuntu-latest + needs: [install-root, install-core] + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] steps: - uses: actions/checkout@v4 @@ -405,33 +293,15 @@ jobs: path: extensions/vscode/node_modules key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml + - name: Build packages and install dependencies run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Install vscode dependencies - if: steps.vscode-cache.outputs.cache-hit != 'true' - run: | - cd extensions/vscode - npm ci + ./scripts/build-packages.sh + if [ "${{ steps.vscode-cache.outputs.cache-hit }}" != "true" ]; then + cd core + npm ci + cd ../extensions/vscode + npm ci + fi env: GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} @@ -461,27 +331,15 @@ jobs: path: extensions/vscode/node_modules key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml + - name: Build packages and install dependencies run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build + ./scripts/build-packages.sh + cd core + npm ci + cd ../extensions/vscode + npm ci + env: + GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - name: Type check and lint run: | @@ -496,7 +354,7 @@ jobs: npm run vitest core-tests: - needs: [install-core, install-config-yaml, install-openai-adapters] + needs: install-core runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -510,27 +368,11 @@ jobs: path: core/node_modules key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml + - name: Build packages and install core dependencies run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build + ./scripts/build-packages.sh + cd core + npm ci - name: Run core tests run: | @@ -557,23 +399,13 @@ jobs: with: node-version-file: ".nvmrc" - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Install dependencies - run: | - cd packages/config-yaml - npm ci - - - name: Run config-yaml tests + - name: Build packages and run tests run: | + ./scripts/build-packages.sh cd packages/config-yaml npm test openai-adapters-tests: - needs: install-openai-adapters runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -587,14 +419,9 @@ jobs: path: node_modules key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Run openai-adapters tests + - name: Build packages and run tests run: | + ./scripts/build-packages.sh cd packages/openai-adapters npm test env: @@ -611,7 +438,7 @@ jobs: vscode-get-test-file-matrix: runs-on: ubuntu-latest - needs: [install-root, install-vscode, install-config-yaml] + needs: [install-root, install-vscode] outputs: test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }} steps: @@ -623,21 +450,13 @@ jobs: path: extensions/vscode/node_modules key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Get test files + - name: Build packages and get test files id: vscode-get-test-file-matrix run: | - cd extensions/vscode + ./scripts/build-packages.sh + cd core + npm ci + cd ../extensions/vscode npm ci npm run e2e:compile if [[ "${{ github.event.pull_request.head.repo.fork }}" == "true" || "${{ github.actor }}" == "dependabot[bot]" ]]; then @@ -659,75 +478,32 @@ jobs: echo "Test files: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }}" vscode-package-extension: - runs-on: ubuntu-latest - needs: - [ - install-vscode, - install-core, - install-config-yaml, - install-openai-adapters, - ] - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - id: vscode-node-modules-cache - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - uses: actions/cache@v4 - id: core-node-modules-cache - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Package extension - run: | - cd extensions/vscode - npm run package - - - name: Upload build artifact - uses: actions/upload-artifact@v4 - with: - name: vscode-extension-build - path: extensions/vscode/build + needs: [install-vscode, install-core] + uses: ./.github/workflows/build-vscode-extension.yml + with: + # Limited platforms for faster PR checks + platforms: | + [ + { + "os": "ubuntu-latest", + "platform": "linux", + "arch": "x64", + "npm_config_arch": "x64" + }, + { + "os": "macos-13", + "platform": "darwin", + "arch": "x64", + "npm_config_arch": "x64" + } + ] + pre-release: false + commit-sha: ${{ github.sha }} + secrets: inherit vscode-download-e2e-dependencies: runs-on: ubuntu-latest - needs: - [ - install-vscode, - install-core, - install-config-yaml, - install-openai-adapters, - ] + needs: [install-vscode, install-core] steps: - uses: actions/checkout@v4 @@ -747,22 +523,15 @@ jobs: path: extensions/vscode/e2e/storage key: ${{ runner.os }}-vscode-storage-${{ hashFiles('extensions/vscode/package-lock.json') }} - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Build config-yaml + - name: Build packages and download e2e dependencies run: | - cd packages/config-yaml - npm run build - - - name: Download Dependencies - if: steps.storage-cache.outputs.cache-hit != 'true' - run: | - cd extensions/vscode - npm run e2e:ci:download + ./scripts/build-packages.sh + if [ "${{ steps.storage-cache.outputs.cache-hit }}" != "true" ]; then + cd core + npm ci + cd ../extensions/vscode + npm run e2e:ci:download + fi - name: Upload e2e dependencies uses: actions/upload-artifact@v4 @@ -779,8 +548,6 @@ jobs: vscode-package-extension, install-vscode, install-core, - install-config-yaml, - install-openai-adapters, ] runs-on: ubuntu-latest # Tests requiring secrets need approval from maintainers @@ -812,7 +579,7 @@ jobs: - name: Download build artifact uses: actions/download-artifact@v4 with: - name: vscode-extension-build + name: vscode-extension-build-Linux path: extensions/vscode/build - name: Download e2e dependencies @@ -821,27 +588,11 @@ jobs: name: vscode-e2e-dependencies path: extensions/vscode/e2e/storage - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml + - name: Build packages and install core dependencies run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build + ./scripts/build-packages.sh + cd core + npm ci - name: Fix VSCode binary permissions run: | @@ -906,8 +657,7 @@ jobs: path: extensions/vscode/e2e.log gui-tests: - needs: - [install-gui, install-core, install-config-yaml, install-openai-adapters] + needs: [install-gui, install-core] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -917,7 +667,6 @@ jobs: node-version-file: ".nvmrc" - uses: actions/cache@v4 - id: gui-cache with: path: gui/node_modules key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} @@ -927,31 +676,13 @@ jobs: path: core/node_modules key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml + - name: Build packages and install dependencies run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Install GUI dependencies - if: steps.gui-cache.outputs.cache-hit != 'true' - run: cd gui && npm ci + ./scripts/build-packages.sh + cd core + npm ci + cd ../gui + npm ci env: GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} @@ -961,8 +692,7 @@ jobs: npm test jetbrains-tests: - needs: - [install-root, core-checks, install-config-yaml, install-openai-adapters] + needs: [install-root, core-checks] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -971,27 +701,11 @@ jobs: path: core/node_modules key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml + - name: Build packages and install core dependencies run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build + ./scripts/build-packages.sh + cd core + npm ci - name: Setup Java uses: actions/setup-java@v4.5.0 @@ -1106,8 +820,7 @@ jobs: - gui-tests - jetbrains-tests - config-yaml-checks - - install-config-yaml - - install-openai-adapters + - build-packages - openai-adapters-tests steps: diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 3ef4920ed..54d737e45 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -29,152 +29,11 @@ jobs: build: needs: check_release_name if: needs.check_release_name.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch' - strategy: - matrix: - include: - - os: windows-latest - platform: win32 - arch: x64 - npm_config_arch: x64 - - os: windows-latest - platform: win32 - arch: arm64 - npm_config_arch: arm - - os: ubuntu-latest - platform: linux - arch: x64 - npm_config_arch: x64 - - os: ubuntu-latest - platform: linux - arch: arm64 - npm_config_arch: arm64 - - os: ubuntu-latest - platform: linux - arch: armhf - npm_config_arch: arm - - os: ubuntu-latest - platform: alpine - arch: x64 - npm_config_arch: x64 - - os: macos-13 - platform: darwin - arch: x64 - npm_config_arch: x64 - - os: macos-13 - platform: darwin - arch: arm64 - npm_config_arch: arm64 - runs-on: ${{ matrix.os }} - steps: - # 1. Check-out repository - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 # This ensures all tags are fetched - - - name: Checkout tag - run: git checkout ${GITHUB_REF#refs/tags/} - - # 2. Install npm dependencies - - name: Use Node.js from .nvmrc - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - name: Cache extension node_modules - uses: actions/cache@v3 - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - name: Cache core node_modules - uses: actions/cache@v3 - with: - path: core/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} - - - name: Cache gui node_modules - uses: actions/cache@v3 - with: - path: gui/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} - - - name: Build packages (Windows) - run: ./scripts/build-packages.ps1 - if: matrix.os == 'windows-latest' - - - name: Build packages (Unix) - run: ./scripts/build-packages.sh - if: matrix.os != 'windows-latest' - - - name: Install extension Dependencies - run: | - cd extensions/vscode - npm ci - env: - # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - - - name: Install gui Dependencies - run: | - cd gui - npm ci - - # npm ci doesn't end up capturing the @lancedb/... dep because it's not in the package-lock.json - - name: Install Core Dependencies - run: | - cd core - npm ci - npm i vectordb - - # - name: Run core tests - # run: | - # cd core - # npm run test - # env: - # OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - - # 2.5. Pre package - - name: Set var for environment info - shell: pwsh - run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $env:GITHUB_ENV - - - name: Prepackage the extension - run: | - cd extensions/vscode - npm run prepackage -- --target ${{ env.target }} - - # 3. Re-install esbuild (for cases that we force installed for another arch in prepackage.js) - - name: Re-install esbuild - run: | - cd extensions/vscode - npm install -f esbuild - - # 4. Run tests for the extension - # - name: Install Xvfb for Linux and run tests - # run: | - # sudo apt-get install -y xvfb # Install Xvfb - # Xvfb :99 & # Start Xvfb - # export DISPLAY=:99 # Export the display number to the environment - # cd extensions/vscode - # npm run test - # if: matrix.os == 'ubuntu-latest' - - # - name: Run extension tests - # run: | - # cd extensions/vscode - # npm run test - # if: matrix.os != 'ubuntu-latest' - - # 5. Package the extension - - name: Package the extension - run: cd extensions/vscode && npx vsce package --pre-release --no-dependencies --target ${{ env.target }} - - # 6. Upload the .vsix as an artifact - - uses: actions/upload-artifact@v4 - with: - name: ${{ env.target }}-vsix - path: "extensions/vscode/*.vsix" + uses: ./.github/workflows/build-vscode-extension.yml + with: + # Uses default platforms (all supported platforms) + pre-release: true + secrets: inherit release: permissions: diff --git a/.idea/gradle.xml b/.idea/gradle.xml index c277e816e..324ac997a 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -5,7 +5,7 @@