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
46 changes: 46 additions & 0 deletions .github/actions/install-workspace-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Install workspace dependencies
description: Restore the pnpm store, install selected workspace packages, and save the store before further checks.

inputs:
packages:
description: Space-separated workspace package selectors.
required: true

runs:
using: composite
steps:
- name: Resolve pnpm store
id: store
shell: bash
run: |
store_path="$(pnpm store path --silent)"
node_arch="$(node -p 'process.arch')"
printf 'path=%s\narch=%s\n' "$store_path" "$node_arch" >> "$GITHUB_OUTPUT"

- name: Restore pnpm store
id: cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ${{ steps.store.outputs.path }}
key: node-cache-${{ runner.os }}-${{ steps.store.outputs.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
node-cache-${{ runner.os }}-${{ steps.store.outputs.arch }}-pnpm-

- name: Install workspace dependencies
shell: bash
env:
WORKSPACE_PACKAGES: ${{ inputs.packages }}
run: |
read -r -a packages <<< "$WORKSPACE_PACKAGES"
filters=()
for package in "${packages[@]}"; do
filters+=(--filter "$package")
done
pnpm "${filters[@]}" install --frozen-lockfile

- name: Save pnpm store
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ${{ steps.store.outputs.path }}
key: ${{ steps.cache.outputs.cache-primary-key }}
1 change: 1 addition & 0 deletions .github/scripts/resolve-ci-scope.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { fileURLToPath } from 'node:url'

const repoRoot = resolve(import.meta.dirname, '../..')
const ciInputs = new Set([
'.github/actions/install-workspace-dependencies/action.yml',
'.github/workflows/ci.yml',
'.github/scripts/resolve-ci-scope.mjs',
])
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/buddy-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ jobs:
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .node-version
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Setup Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
Expand All @@ -61,7 +59,9 @@ jobs:
xvfb

- name: Install workspace dependencies
run: pnpm --filter @uselexora/lexora --filter '@uselexora/lexora-buddy...' install --frozen-lockfile
uses: ./.github/actions/install-workspace-dependencies
with:
packages: '@uselexora/lexora @uselexora/lexora-buddy...'

- name: Resolve package target
id: package
Expand Down Expand Up @@ -121,16 +121,16 @@ jobs:
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .node-version
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Setup Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
with:
toolchain: 1.98.0

- name: Install workspace dependencies
run: pnpm --filter @uselexora/lexora --filter '@uselexora/lexora-buddy...' install --frozen-lockfile
uses: ./.github/actions/install-workspace-dependencies
with:
packages: '@uselexora/lexora @uselexora/lexora-buddy...'

- name: Resolve package target
id: package
Expand Down Expand Up @@ -262,16 +262,16 @@ jobs:
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .node-version
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Setup Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
with:
toolchain: 1.98.0

- name: Install workspace dependencies
run: pnpm --filter @uselexora/lexora --filter '@uselexora/lexora-buddy...' install --frozen-lockfile
uses: ./.github/actions/install-workspace-dependencies
with:
packages: '@uselexora/lexora @uselexora/lexora-buddy...'

- name: Resolve package target
id: package
Expand Down
25 changes: 13 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
branches: [master]
paths:
- .github/workflows/ci.yml
- .github/actions/install-workspace-dependencies/action.yml
- .github/scripts/resolve-ci-scope.mjs
- .github/scripts/buddy-test-runtime.mjs
- .cargo/**
Expand Down Expand Up @@ -87,11 +88,11 @@ jobs:
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .node-version
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Install workspace dependencies
run: pnpm --filter @uselexora/lexora --filter @uselexora/lexora-website install --frozen-lockfile
uses: ./.github/actions/install-workspace-dependencies
with:
packages: '@uselexora/lexora @uselexora/lexora-website'

- name: Lint workspace
run: pnpm --filter @uselexora/lexora-website lint
Expand All @@ -118,11 +119,11 @@ jobs:
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .node-version
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Install workspace dependencies
run: pnpm --filter @uselexora/lexora install --frozen-lockfile
uses: ./.github/actions/install-workspace-dependencies
with:
packages: '@uselexora/lexora'

- name: Lint repository
run: >-
Expand All @@ -148,11 +149,11 @@ jobs:
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .node-version
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Install workspace dependencies
run: pnpm --filter @uselexora/lexora --filter '@uselexora/lexora-buddy...' install --frozen-lockfile
uses: ./.github/actions/install-workspace-dependencies
with:
packages: '@uselexora/lexora @uselexora/lexora-buddy...'

- name: Lint workspace
run: pnpm exec eslint .playwright/scripts apps/buddy packaging/buddy
Expand Down Expand Up @@ -328,11 +329,11 @@ jobs:
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .node-version
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Install workspace dependencies
run: pnpm --filter @uselexora/lexora --filter '@uselexora/lexora-buddy...' install --frozen-lockfile
uses: ./.github/actions/install-workspace-dependencies
with:
packages: '@uselexora/lexora @uselexora/lexora-buddy...'

ci-gate:
name: CI Gate
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/macos-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ jobs:
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .node-version
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Setup Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
Expand All @@ -59,7 +57,9 @@ jobs:
node packaging/buddy/release/artifacts.mjs --format dmg --github-output "$GITHUB_OUTPUT"

- name: Install workspace dependencies
run: pnpm --filter @uselexora/lexora --filter '@uselexora/lexora-buddy...' install --frozen-lockfile
uses: ./.github/actions/install-workspace-dependencies
with:
packages: '@uselexora/lexora @uselexora/lexora-buddy...'

- name: Test native components
env:
Expand Down Expand Up @@ -124,11 +124,11 @@ jobs:
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .node-version
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Install workspace dependencies
run: pnpm --filter @uselexora/lexora --filter '@uselexora/lexora-buddy...' install --frozen-lockfile
uses: ./.github/actions/install-workspace-dependencies
with:
packages: '@uselexora/lexora @uselexora/lexora-buddy...'

- name: Download verified macOS package
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ function deferred<T>() {
})
return { promise, resolve }
}
async function fixture(overrides: Partial<ExtensionServicePorts> = {}) {
async function fixture(overrides: Partial<ExtensionServicePorts> = {}, initialManifest = manifest()) {
const { root, store } = await createStore()
cleanup.push(() => rm(root, { recursive: true, force: true }))
await store.install((await reviewPackage(root, store)).token)
await store.install((await reviewPackage(root, store, initialManifest)).token)
const hosts: Array<{ broker: (method: string, params: unknown) => Promise<JsonValue>, failed: () => void, disposed: boolean, commands: JsonValue[] }> = []
const events: unknown[] = []
const service = new ExtensionService(store, {
Expand Down Expand Up @@ -298,9 +298,8 @@ it('rejects unauthorized media and late picker selections without retaining gran
})

it('binds presentation changes to a current declared placement and reports real installation state', async () => {
const f = await fixture({ workbench: async event => event.kind === 'presentation' ? event.viewId : null })
const value = manifest({ apiVersion: 2, id: 'tests.panel', contributes: { views: [{ id: 'tests.panel.ui', title: 'Panel', entry: 'view.js', resource: 'none' }], placements: [{ id: 'tests.panel.float', kind: 'view', location: 'workbench.floating', view: 'tests.panel.ui' }] } })
await f.service.install((await reviewPackage(f.root, f.store, value)).token)
const f = await fixture({ workbench: async event => event.kind === 'presentation' ? event.viewId : null }, value)
const input = { viewId: randomUUID(), extensionId: value.id, viewType: 'tests.panel.ui', resource: null, state: { secret: 'private-state' }, stateVersion: 1 }
const view = await f.service.openView({ ...input, placementId: 'tests.panel.float' })
const request = (method: string, params: JsonValue) => f.service.viewRequest(view.id, view.generation, view.token, method, params)
Expand All @@ -319,11 +318,10 @@ it('binds presentation changes to a current declared placement and reports real

it('keeps export permission separate from reads and expires writers with their owning view', async () => {
let destination = ''
const f = await fixture({ selectSavePath: async () => destination })
const value = manifest({ apiVersion: 2, id: 'tests.export', permissions: { localResources: true }, contributes: { views: [{ id: 'tests.export.page', title: 'Export', entry: 'view.js', resource: 'none' }] } })
const f = await fixture({ selectSavePath: async () => destination }, value)
destination = join(f.root, 'export.binary')
await writeFile(destination, 'original')
const value = manifest({ apiVersion: 2, id: 'tests.export', permissions: { localResources: true }, contributes: { views: [{ id: 'tests.export.page', title: 'Export', entry: 'view.js', resource: 'none' }] } })
await f.service.install((await reviewPackage(f.root, f.store, value)).token)
const input = { viewId: randomUUID(), extensionId: value.id, viewType: 'tests.export.page', resource: null, state: null, stateVersion: 1 }
const readOnly = await f.service.openView(input)
const payload = { name: 'file.unknown', size: 4 }
Expand Down
1 change: 1 addition & 0 deletions apps/buddy/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export default defineConfig({
extends: true,
test: {
name: 'platform',
testTimeout: 15_000,
include: ['platform/**/*.{test,spec}.?(c|m)[jt]s?(x)'],
},
},
Expand Down
Loading