Skip to content

chore: updated and linted #432

chore: updated and linted

chore: updated and linted #432

Workflow file for this run

name: CI Node
on:
push:
branches: [main]
paths:
- '.github/actions/**'
- '.github/workflows/ci-node.yaml'
- '.cargo/config.toml'
- 'rust-toolchain.toml'
- 'Cargo.toml'
- 'Cargo.lock'
- 'crates/kreuzberg/**'
- 'crates/kreuzberg-node/**'
- 'crates/kreuzberg-tesseract/**'
- 'packages/typescript/**'
- 'e2e/typescript/**'
- 'test_documents/**'
- 'fixtures/**'
- 'tools/e2e-generator/**'
- 'pnpm-lock.yaml'
- 'package.json'
- 'scripts/ci/node/**'
- 'scripts/ci/cache/**'
- 'scripts/ci/actions/**'
pull_request:
branches: [main]
paths:
- '.github/actions/**'
- '.github/workflows/ci-node.yaml'
- '.cargo/config.toml'
- 'rust-toolchain.toml'
- 'Cargo.toml'
- 'Cargo.lock'
- 'crates/kreuzberg/**'
- 'crates/kreuzberg-node/**'
- 'crates/kreuzberg-tesseract/**'
- 'packages/typescript/**'
- 'e2e/typescript/**'
- 'test_documents/**'
- 'fixtures/**'
- 'tools/e2e-generator/**'
- 'pnpm-lock.yaml'
- 'package.json'
- 'scripts/ci/node/**'
- 'scripts/ci/cache/**'
- 'scripts/ci/actions/**'
concurrency:
group: ci-node-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
RUST_BACKTRACE: short
RUST_MIN_STACK: 16777216
PDFIUM_VERSION: "7578"
PDFIUM_STATIC_VERSION: "7442b"
ORT_VERSION: "1.23.2"
MACOSX_DEPLOYMENT_TARGET: "14.0"
VERBOSE_DEBUG: "true"
BUILD_PROFILE: "ci"
jobs:
build-and-smoke-node:
name: Node Build + Smoke (${{ matrix.target }})
if: ${{ github.actor != 'dependabot[bot]' }}
timeout-minutes: ${{ matrix.os == 'windows-latest' && 360 || 180 }}
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
platform: linux-x64
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
platform: linux-arm64
- os: macos-latest
target: aarch64-apple-darwin
platform: macos-arm64
- os: windows-latest
target: x86_64-pc-windows-msvc
platform: windows-x64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Dump system information
shell: bash
run: |
echo "=== System Information ==="
uname -a
if [ "$RUNNER_OS" = "Windows" ]; then
powershell -Command "Get-CimInstance Win32_OperatingSystem | Select-Object Version"
powershell -Command "Get-CimInstance Win32_Processor | Select-Object Name"
powershell -Command "Get-CimInstance Win32_OperatingSystem | Select-Object @{Name='TotalMemoryGB'; Expression={[Math]::Round(\$_.TotalVisibleMemorySize / 1MB, 2)}}"
fi
echo "=== Disk Space ==="
df -h
- name: Dump environment variables (debug)
shell: bash
run: |
echo "=== Environment Variables ==="
env | sort
echo "=== GitHub Context ==="
echo "Runner OS: $RUNNER_OS"
echo "Runner Arch: $RUNNER_ARCH"
- name: Install system dependencies
uses: ./.github/actions/install-system-deps
- name: Free disk space before setup
if: startsWith(matrix.os, 'ubuntu')
uses: ./.github/actions/free-disk-space-linux
with:
show-initial: "true"
show-final: "true"
- name: Setup OpenSSL
uses: ./.github/actions/setup-openssl
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
cache-key-prefix: node-${{ matrix.platform }}
target: ${{ matrix.target }}
use-sccache: 'false'
- name: Setup Node
uses: ./.github/actions/setup-node-workspace
- name: Cache PDFium
uses: ./.github/actions/cache-pdfium
with:
pdfium-version: ${{ env.PDFIUM_VERSION }}
- name: Download PDFium
uses: ./.github/actions/download-pdfium
with:
pdfium-version: ${{ env.PDFIUM_VERSION }}
- name: Stage PDFium runtime
uses: ./.github/actions/stage-pdfium-runtime
with:
destination: target/release
- name: Setup ONNX Runtime
uses: ./.github/actions/setup-onnx-runtime
with:
ort-version: ${{ env.ORT_VERSION }}
- name: Install Task
uses: ./.github/actions/install-task
- name: Build or restore Node bindings from cache
id: node
uses: ./.github/actions/build-and-cache-binding
with:
binding-name: node
platform: ${{ matrix.platform }}
task-command: node:build:ci
cache-paths: |
crates/kreuzberg-node/
cache-version: v1
rust-hash: "n/a"
binding-files: |
crates/kreuzberg-node/**
dep-files: |
Cargo.lock
crates/kreuzberg-node/package.json
crates/kreuzberg-node/pnpm-lock.yaml
- name: Report Node binding artifacts size
shell: bash
run: |
echo "=== Node Binding Artifacts ==="
if [ -d "crates/kreuzberg-node" ]; then
du -sh crates/kreuzberg-node
find crates/kreuzberg-node -maxdepth 1 \( -name "*.node" -o -name "*.tgz" -o -name "index.js" \) -exec ls -lh {} \;
fi
- name: Pack Node package
shell: bash
run: |
cd crates/kreuzberg-node
npm pack --ignore-scripts
- name: Verify TypeScript build artifacts
shell: bash
run: scripts/ci/node/verify-ts-artifacts.sh
- name: Upload Node bindings
uses: actions/upload-artifact@v6
with:
name: napi-${{ matrix.target }}
path: |
crates/kreuzberg-node/*.node
crates/kreuzberg-node/index.js
crates/kreuzberg-node/*.tgz
crates/kreuzberg-node/artifacts/**
retention-days: 7
- name: Cleanup Rust cache
if: always()
uses: ./.github/actions/cleanup-rust-cache
- name: Smoke test Node.js bindings
uses: ./.github/actions/smoke-node
with:
package-tarball: crates/kreuzberg-node
test-typescript:
name: TypeScript Tests (${{ matrix.os }})
if: ${{ github.actor != 'dependabot[bot]' }}
needs: build-and-smoke-node
timeout-minutes: ${{ matrix.os == 'windows-latest' && 360 || 180 }}
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-latest
node-version: "22"
target: x86_64-unknown-linux-gnu
coverage: true
- os: ubuntu-24.04-arm
node-version: "22"
target: aarch64-unknown-linux-gnu
coverage: false
- os: macos-latest
node-version: "22"
target: aarch64-apple-darwin
coverage: false
- os: windows-latest
node-version: "22"
target: x86_64-pc-windows-msvc
coverage: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Dump system information (test job)
shell: bash
run: |
echo "=== System Information ==="
uname -a
if [ "$RUNNER_OS" = "Windows" ]; then
powershell -Command "Get-CimInstance Win32_OperatingSystem | Select-Object Version"
powershell -Command "Get-CimInstance Win32_Processor | Select-Object Name"
powershell -Command "Get-CimInstance Win32_OperatingSystem | Select-Object @{Name='TotalMemoryGB'; Expression={[Math]::Round(\$_.TotalVisibleMemorySize / 1MB, 2)}}"
fi
echo "=== Disk Space ==="
df -h
- name: Dump environment variables (test job debug)
shell: bash
run: |
echo "=== Environment Variables ==="
env | sort
echo "=== Node/npm versions ==="
node --version
npm --version
pnpm --version 2>/dev/null || echo "pnpm not yet installed"
- name: Install system dependencies
uses: ./.github/actions/install-system-deps
- name: Setup OpenSSL
uses: ./.github/actions/setup-openssl
- name: Setup Node
uses: ./.github/actions/setup-node-workspace
- name: Cache PDFium
uses: ./.github/actions/cache-pdfium
with:
pdfium-version: ${{ env.PDFIUM_VERSION }}
- name: Download PDFium
uses: ./.github/actions/download-pdfium
with:
pdfium-version: ${{ env.PDFIUM_VERSION }}
- name: Stage PDFium runtime
uses: ./.github/actions/stage-pdfium-runtime
with:
destination: packages/typescript
- name: Setup ONNX Runtime
uses: ./.github/actions/setup-onnx-runtime
with:
ort-version: ${{ env.ORT_VERSION }}
- name: Download Node bindings
uses: actions/download-artifact@v7
with:
name: napi-${{ matrix.target }}
path: crates/kreuzberg-node/
- name: Unpack and install Node bindings
shell: bash
run: |
set -x
time scripts/ci/node/unpack-bindings.sh
set +x
- name: Install Task
uses: ./.github/actions/install-task
- name: Build TypeScript wrapper
shell: bash
env:
VERBOSE: "1"
run: |
set -x
time task node:build
set +x
- name: Report TypeScript build artifacts size
shell: bash
run: |
echo "=== TypeScript Build Artifacts ==="
if [ -d "packages/typescript/dist" ]; then
du -sh packages/typescript/dist
du -sh packages/typescript/node_modules 2>/dev/null || echo "node_modules size: N/A"
fi
- name: Run TypeScript tests
shell: bash
env:
VERBOSE: "1"
DEBUG: "kreuzberg*"
run: |
set -x
time task node:test:ci
set +x
- name: Upload coverage
if: matrix.coverage
uses: deepsourcelabs/test-coverage-action@master
with:
key: typescript
coverage-file: e2e/typescript/coverage/lcov.info
dsn: ${{ secrets.DEEPSOURCE_DSN }}
- name: Run E2E tests
shell: bash
env:
VERBOSE: "1"
DEBUG: "kreuzberg*"
run: |
set -x
time task node:e2e:test
set +x
- name: Report E2E artifacts size (if Windows)
if: matrix.os == 'windows-latest'
shell: bash
run: |
echo "=== E2E Test Artifacts ==="
if [ -d "e2e/typescript" ]; then
du -sh e2e/typescript
find e2e/typescript -name "*.log" -o -name "*.json" | head -10 | xargs ls -lh 2>/dev/null || echo "No logs found"
fi