Skip to content

Commit

Permalink
fix github release not passing params to napi script (#872)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronvg authored Aug 11, 2024
1 parent 24b5895 commit 06b962b
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 1,312 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
tags:
- "test-release/*.*"
- "*.*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -108,7 +107,7 @@ jobs:
_:
- target: aarch64-apple-darwin
host: macos-14
node_build: pnpm build --target aarch64-apple-darwin
node_build: pnpm build:napi-release --target aarch64-apple-darwin
baml_build_help: "off"
# mise: true

Expand All @@ -122,19 +121,19 @@ jobs:
# from https://github.com/PyO3/maturin-action?tab=readme-ov-file#manylinux-docker-container
# need a new version of manylinux to build crates on arm64-linux
container: ghcr.io/rust-cross/manylinux_2_28-cross:aarch64
node_build: pnpm build --target aarch64-unknown-linux-gnu --use-napi-cross
node_build: pnpm build:napi-release --target aarch64-unknown-linux-gnu --use-napi-cross
cargo_args: -p baml-typescript-ffi -p baml-python-ffi
baml_build_help: "off"

- target: x86_64-apple-darwin
host: macos-latest
node_build: pnpm build --target x86_64-apple-darwin
node_build: pnpm build:napi-release --target x86_64-apple-darwin
baml_build_help: "off"
# mise: true

- target: x86_64-pc-windows-msvc
host: windows-latest
node_build: pnpm build --target x86_64-pc-windows-msvc
node_build: pnpm build:napi-release --target x86_64-pc-windows-msvc
setup-python-architecture: x64
cargo_args: -p baml-typescript-ffi -p baml-python-ffi
baml_build_help: "off"
Expand All @@ -143,7 +142,7 @@ jobs:
host: ubuntu-latest
# Using any of the manylinux containers breaks a bunch of stuff: actions/checkout here, pnpm build there - not worth it.
container: null
node_build: pnpm build --target x86_64-unknown-linux-gnu --use-napi-cross
node_build: pnpm build:napi-release --target x86_64-unknown-linux-gnu --use-napi-cross
mise: true

name: Build ${{ matrix._.target }}
Expand Down Expand Up @@ -190,12 +189,18 @@ jobs:
- name: Build Rust
run: cargo build --release --target ${{ matrix._.target }} ${{ matrix._.cargo_args }}
working-directory: engine
# Build Node

# Build NAPI release
- name: PNPM Build
run: ${{ matrix._.node_build }}
working-directory: engine/language_client_typescript


# Build TS wrapper code and helpers as well
- name: Build TS
run: pnpm build:ts_build
working-directory: engine/language_client_typescript


- name: Upload artifact
uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion engine/language_client_typescript/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ tokio = { version = "1", features = ["full"] }
indexmap.workspace = true

[build-dependencies]
napi-build = "2.0.1"
napi-build = "2.1.3"
32 changes: 16 additions & 16 deletions engine/language_client_typescript/native.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* auto-generated by NAPI-RS */
/* eslint-disable */
export class BamlAudio {
export declare class BamlAudio {
static fromUrl(url: string): BamlAudio
static fromBase64(mediaType: string, base64: string): BamlAudio
isUrl(): boolean
Expand All @@ -9,7 +9,7 @@ export class BamlAudio {
toJSON(): any
}

export class BamlImage {
export declare class BamlImage {
static fromUrl(url: string): BamlImage
static fromBase64(mediaType: string, base64: string): BamlImage
isUrl(): boolean
Expand All @@ -18,7 +18,7 @@ export class BamlImage {
toJSON(): any
}

export class BamlRuntime {
export declare class BamlRuntime {
static fromDirectory(directory: string, envVars: Record<string, string>): BamlRuntime
static fromFiles(rootPath: string, files: Record<string, string>, envVars: Record<string, string>): BamlRuntime
createContextManager(): RuntimeContextManager
Expand All @@ -31,61 +31,61 @@ export class BamlRuntime {
drainStats(): TraceStats
}

export class BamlSpan {
export declare class BamlSpan {
static new(runtime: BamlRuntime, functionName: string, args: any, ctx: RuntimeContextManager): BamlSpan
finish(result: any, ctx: RuntimeContextManager): any
}

export class ClassBuilder {
export declare class ClassBuilder {
field(): FieldType
property(name: string): ClassPropertyBuilder
}

export class ClassPropertyBuilder {
export declare class ClassPropertyBuilder {
setType(fieldType: FieldType): ClassPropertyBuilder
alias(alias?: string | undefined | null): ClassPropertyBuilder
description(description?: string | undefined | null): ClassPropertyBuilder
}

export class ClientRegistry {
export declare class ClientRegistry {
constructor()
addLlmClient(name: string, provider: string, options: { [string]: any }, retryPolicy?: string | undefined | null): void
setPrimary(primary: string): void
}

export class EnumBuilder {
export declare class EnumBuilder {
value(name: string): EnumValueBuilder
alias(alias?: string | undefined | null): EnumBuilder
field(): FieldType
}

export class EnumValueBuilder {
export declare class EnumValueBuilder {
alias(alias?: string | undefined | null): EnumValueBuilder
skip(skip?: boolean | undefined | null): EnumValueBuilder
description(description?: string | undefined | null): EnumValueBuilder
}

export class FieldType {
export declare class FieldType {
list(): FieldType
optional(): FieldType
}

export class FunctionResult {
export declare class FunctionResult {
isOk(): boolean
parsed(): any
}

export class FunctionResultStream {
export declare class FunctionResultStream {
onEvent(func: (err: any, param: FunctionResult) => void): void
done(rctx: RuntimeContextManager): Promise<FunctionResult>
}

export class RuntimeContextManager {
export declare class RuntimeContextManager {
upsertTags(tags: any): void
deepClone(): RuntimeContextManager
}

export class TraceStats {
export declare class TraceStats {
get failed(): number
get started(): number
get finalized(): number
Expand All @@ -95,7 +95,7 @@ export class TraceStats {
toJson(): string
}

export class TypeBuilder {
export declare class TypeBuilder {
constructor()
getEnum(name: string): EnumBuilder
getClass(name: string): ClassBuilder
Expand All @@ -118,7 +118,7 @@ export interface BamlLogEvent {
startTime: string
}

export declare function invoke_runtime_cli(params: Array<string>): void
export declare export declare function invoke_runtime_cli(params: Array<string>): void

export interface LogEventMetadata {
eventId: string
Expand Down
2 changes: 1 addition & 1 deletion engine/language_client_typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
"devDependencies": {
"@biomejs/biome": "^1.7.3",
"@napi-rs/cli": "3.0.0-alpha.54",
"@napi-rs/cli": "3.0.0-alpha.56",
"@types/node": "^20.12.11",
"npm-run-all2": "^6.1.2",
"ts-node": "^10.9.2",
Expand Down
Loading

0 comments on commit 06b962b

Please sign in to comment.