refactor: use default platform matrix in reusable workflow
- Set comprehensive platform matrix as default in build-vscode-extension.yml - Simplify main-build.yaml and preview.yaml to use defaults - Keep pr_checks.yaml with limited platforms for faster CI - Reduces duplication and makes platform changes easier to manage - Default includes all supported platforms: Windows, Linux, macOS, Alpine, ARM variants 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
dd53be019c
commit
2f6b12018a
4 changed files with 80 additions and 242 deletions
55
.github/workflows/build-vscode-extension.yml
vendored
55
.github/workflows/build-vscode-extension.yml
vendored
|
|
@ -4,9 +4,60 @@ on:
|
|||
workflow_call:
|
||||
inputs:
|
||||
platforms:
|
||||
description: "JSON array of platform configurations"
|
||||
required: true
|
||||
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
|
||||
|
|
|
|||
16
.github/workflows/main-build.yaml
vendored
16
.github/workflows/main-build.yaml
vendored
|
|
@ -9,21 +9,7 @@ jobs:
|
|||
build:
|
||||
uses: ./.github/workflows/build-vscode-extension.yml
|
||||
with:
|
||||
platforms: |
|
||||
[
|
||||
{
|
||||
"os": "ubuntu-latest",
|
||||
"platform": "linux",
|
||||
"arch": "x64",
|
||||
"npm_config_arch": "x64"
|
||||
},
|
||||
{
|
||||
"os": "macos-latest",
|
||||
"platform": "darwin",
|
||||
"arch": "x64",
|
||||
"npm_config_arch": "x64"
|
||||
}
|
||||
]
|
||||
# Uses default platforms (all supported platforms)
|
||||
pre-release: false
|
||||
commit-id: ${{ github.sha }}
|
||||
secrets: inherit
|
||||
100
.github/workflows/pr_checks.yaml
vendored
100
.github/workflows/pr_checks.yaml
vendored
|
|
@ -671,10 +671,6 @@ jobs:
|
|||
echo "Test files: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }}"
|
||||
|
||||
vscode-package-extension:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
needs:
|
||||
[
|
||||
install-vscode,
|
||||
|
|
@ -682,81 +678,27 @@ jobs:
|
|||
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: Modify package.json version for PR builds
|
||||
if: github.event_name == 'pull_request'
|
||||
run: |
|
||||
cd extensions/vscode
|
||||
# Extract PR number from GitHub context
|
||||
PR_NUMBER="${{ github.event.pull_request.number }}"
|
||||
|
||||
# Get current version from package.json
|
||||
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
||||
|
||||
# Create new version with PR number
|
||||
NEW_VERSION="${CURRENT_VERSION}-${PR_NUMBER}"
|
||||
|
||||
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")"
|
||||
|
||||
- name: Package extension
|
||||
run: |
|
||||
cd extensions/vscode
|
||||
npm run package
|
||||
|
||||
- name: Upload build artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: vscode-extension-build-${{ runner.os }}
|
||||
path: extensions/vscode/build
|
||||
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-latest",
|
||||
"platform": "darwin",
|
||||
"arch": "x64",
|
||||
"npm_config_arch": "x64"
|
||||
}
|
||||
]
|
||||
pre-release: false
|
||||
pr-number: ${{ github.event.pull_request.number }}
|
||||
secrets: inherit
|
||||
|
||||
vscode-download-e2e-dependencies:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
|||
151
.github/workflows/preview.yaml
vendored
151
.github/workflows/preview.yaml
vendored
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue