fix checkout logic
This commit is contained in:
parent
b061f7f047
commit
502b07dc7e
3 changed files with 32 additions and 231 deletions
11
.github/actions/setup-node-base/action.yml
vendored
11
.github/actions/setup-node-base/action.yml
vendored
|
|
@ -1,11 +0,0 @@
|
|||
name: 'Setup Node Base'
|
||||
description: 'Checkout repository and setup Node.js with .nvmrc version'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
212
.github/workflows/build-vscode-extension.yml
vendored
212
.github/workflows/build-vscode-extension.yml
vendored
|
|
@ -1,212 +0,0 @@
|
|||
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 npm
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-npm-cache-build-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- 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') }}
|
||||
|
||||
- name: Cache packages node_modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
packages/*/node_modules
|
||||
key: ${{ runner.os }}-packages-node-modules-${{ hashFiles('packages/*/package-lock.json') }}
|
||||
|
||||
# Build all packages using the authoritative build script
|
||||
- name: Build packages
|
||||
run: node ./scripts/build-packages.js
|
||||
|
||||
- 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"
|
||||
40
.github/workflows/pr_checks.yaml
vendored
40
.github/workflows/pr_checks.yaml
vendored
|
|
@ -15,7 +15,10 @@ jobs:
|
|||
prettier-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ./.github/actions/setup-node-base
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
- uses: actions/cache@v4
|
||||
id: root-cache
|
||||
|
|
@ -33,13 +36,19 @@ jobs:
|
|||
build-packages:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ./.github/actions/setup-node-base
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
- uses: ./.github/actions/setup-packages
|
||||
|
||||
config-yaml-checks:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ./.github/actions/setup-node-base
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
- uses: ./.github/actions/setup-packages
|
||||
|
||||
- uses: actions/cache@v4
|
||||
|
|
@ -58,7 +67,10 @@ jobs:
|
|||
core-checks:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ./.github/actions/setup-node-base
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
- uses: ./.github/actions/setup-packages
|
||||
- uses: ./.github/actions/setup-component
|
||||
with:
|
||||
|
|
@ -77,7 +89,10 @@ jobs:
|
|||
gui-checks:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ./.github/actions/setup-node-base
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
- uses: ./.github/actions/setup-packages
|
||||
- uses: ./.github/actions/setup-component
|
||||
with:
|
||||
|
|
@ -97,7 +112,10 @@ jobs:
|
|||
binary-checks:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ./.github/actions/setup-node-base
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
- uses: ./.github/actions/setup-packages
|
||||
- uses: ./.github/actions/setup-component
|
||||
with:
|
||||
|
|
@ -164,7 +182,10 @@ jobs:
|
|||
core-tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: ./.github/actions/setup-node-base
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
- uses: ./.github/actions/setup-packages
|
||||
- uses: ./.github/actions/setup-component
|
||||
with:
|
||||
|
|
@ -194,7 +215,10 @@ jobs:
|
|||
os: [ubuntu-latest, macos-latest]
|
||||
package: [hub, config-yaml, fetch, openai-adapters]
|
||||
steps:
|
||||
- uses: ./.github/actions/setup-node-base
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
- uses: ./.github/actions/setup-packages
|
||||
|
||||
- name: Test ${{ matrix.package }}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue