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
160 changes: 160 additions & 0 deletions .github/workflows/publish_npm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
name: Release tensorlake npm package

on:
workflow_dispatch:

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

permissions:
contents: read

defaults:
run:
working-directory: typescript

jobs:
build-sdk-and-test:
name: Build SDK and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
cache: "npm"
cache-dependency-path: typescript/package-lock.json

- name: Install dependencies
run: npm ci

- name: Type check
run: npm run typecheck

- name: Run tests
run: npm test

- name: Build SDK
run: npm run build:sdk

- name: Upload SDK artifact
uses: actions/upload-artifact@v4
with:
name: sdk-dist
path: typescript/dist

build-cli-binaries:
name: Build CLI binaries (${{ matrix.target_id }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target_id: linux-x64
- os: macos-13
target_id: darwin-x64
- os: macos-14
target_id: darwin-arm64
- os: windows-latest
target_id: win32-x64
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: typescript/package-lock.json

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2

- name: Install dependencies
run: npm ci

- name: Build CLI
run: npm run build:cli

- name: Verify packaged CLI binary
run: node ./bin/tl.cjs --help

- name: Upload CLI artifact
uses: actions/upload-artifact@v4
with:
name: cli-${{ matrix.target_id }}
path: typescript/dist/bin/${{ matrix.target_id }}

publish:
name: Publish to npm
needs:
- build-sdk-and-test
- build-cli-binaries
runs-on: ubuntu-latest
environment:
name: npm
url: https://www.npmjs.com/package/tensorlake
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
cache: "npm"
cache-dependency-path: typescript/package-lock.json

- name: Install dependencies
run: npm ci

- name: Download SDK artifact
uses: actions/download-artifact@v4
with:
name: sdk-dist
path: typescript/dist

- name: Download Linux CLI artifact
uses: actions/download-artifact@v4
with:
name: cli-linux-x64
path: typescript/dist/bin/linux-x64

- name: Download macOS x64 CLI artifact
uses: actions/download-artifact@v4
with:
name: cli-darwin-x64
path: typescript/dist/bin/darwin-x64

- name: Download macOS arm64 CLI artifact
uses: actions/download-artifact@v4
with:
name: cli-darwin-arm64
path: typescript/dist/bin/darwin-arm64

- name: Download Windows x64 CLI artifact
uses: actions/download-artifact@v4
with:
name: cli-win32-x64
path: typescript/dist/bin/win32-x64

- name: Restore executable bits for Unix CLI binaries
run: find dist/bin -type f ! -name "*.exe" -exec chmod 755 {} +

- name: Verify package contents
run: npm pack --dry-run --ignore-scripts

- name: Publish to npm
run: npm publish --provenance --access public --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
76 changes: 76 additions & 0 deletions .github/workflows/typescript_sdk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: TypeScript SDK Tests

on:
workflow_dispatch:
inputs:
environment:
description: "Environment to run the tests against"
required: true
default: prod
type: choice
options:
- dev
- prod

pull_request:
paths:
- "typescript/**"
- ".github/workflows/typescript_sdk.yaml"

push:
branches:
- "main"
paths:
- "typescript/**"
- ".github/workflows/typescript_sdk.yaml"

permissions:
contents: read

defaults:
run:
working-directory: typescript

jobs:
unit-tests:
name: Unit tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install dependencies
run: npm ci

- name: Type check
run: npm run typecheck

- name: Run unit tests
run: npm test

integration-tests:
name: Integration tests
runs-on: ubuntu-latest
timeout-minutes: 30
environment: ${{ github.event_name == 'workflow_dispatch' && inputs.environment || 'prod' }}
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install dependencies
run: npm ci

- name: Run integration tests
run: npm run test:integration
env:
TENSORLAKE_API_URL: ${{ secrets.TENSORLAKE_API_URL }}
TENSORLAKE_API_KEY: ${{ secrets.TENSORLAKE_API_KEY }}
1 change: 1 addition & 0 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ Wrapper scripts live in `tensorlake.data/scripts/` and are installed into the vi
| Rust command | Spawns wrapper script |
|---|---|
| `tl deploy` | `tensorlake-deploy` |
| `tl sbx image create` | `tensorlake-create-sandbox-image` |
| `tl parse` | `tensorlake-parse` |
| `tl generate-dockerfiles` | `tensorlake-generate-dockerfiles` |

Expand Down
Loading
Loading