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
70 changes: 70 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: CI

on:
pull_request:
push:
branches:
- main

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
rust:
name: Rust (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# No Windows on ARM: GraalVM has no native-image for it.
os:
- ubuntu-22.04
- ubuntu-22.04-arm
- macos-15
- macos-15-intel
- windows-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt

- name: Install Linux build tools
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y patchelf zlib1g-dev

- name: MSVC environment (native-image)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

# Git Bash's coreutils `link` shadows MSVC's link.exe on PATH.
- name: Remove Git's link.exe
if: runner.os == 'Windows'
run: rm -f /usr/bin/link.exe

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

- name: Check formatting
run: cargo fmt --all -- --check

# Everything in release: the build script compiles Tika with GraalVM
# native-image once per profile, and that is the slow part.
- name: Clippy
run: cargo clippy --release --all-targets --locked -- -D warnings

- name: Test
run: cargo test --release --locked

- name: Package
run: echo "archive=$(DOCUMENTS_SKIP_BUILD=1 scripts/package.sh | tail -1)" >> "$GITHUB_ENV"

- name: Smoke-test the archive
run: scripts/smoke.sh "$archive"
104 changes: 104 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Release

on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Existing release tag, for example v0.1.0"
required: true
type: string

permissions:
contents: write

env:
VERSION: ${{ github.event.inputs.version || github.ref_name }}

jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Ubuntu 22.04 keeps the glibc requirement at 2.35.
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
- os: ubuntu-22.04-arm
target: aarch64-unknown-linux-gnu
- os: macos-15
target: aarch64-apple-darwin
- os: macos-15-intel
target: x86_64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', inputs.version) || github.ref }}

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

- name: Install Linux build tools
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y patchelf zlib1g-dev

- name: MSVC environment (native-image)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

# Git Bash's coreutils `link` shadows MSVC's link.exe on PATH.
- name: Remove Git's link.exe
if: runner.os == 'Windows'
run: rm -f /usr/bin/link.exe

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

- name: Test
run: cargo test --release --locked

- name: Package
run: |
archive=$(scripts/package.sh "$VERSION" | tail -1)
test "$(basename "$archive")" = "documents-${VERSION#v}-${{ matrix.target }}.$([[ $archive == *.zip ]] && echo zip || echo tar.gz)"
echo "archive=$archive" >> "$GITHUB_ENV"

- name: Smoke-test the archive
run: scripts/smoke.sh "$archive"

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: documents-${{ matrix.target }}
path: dist/documents-*
if-no-files-found: error

publish:
name: Publish GitHub release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

- name: Publish release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.VERSION }}
name: ${{ env.VERSION }}
files: artifacts/*
fail_on_unmatched_files: true
overwrite_files: true
62 changes: 31 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[package]
name = "mesh-pdf-plugin"
name = "mesh-documents-plugin"
version = "0.1.0"
edition = "2024"
license = "Apache-2.0"
description = "PDF text extraction for Mesh LLM with Apache Tika (and OCR)"
description = "Document (PDF) text extraction for Mesh LLM with Apache Tika (and OCR)"

[dependencies]
anyhow = "1"
base64 = "0.22"
# Tika compiled to a native library with GraalVM (no JVM); its build downloads GraalVM.
extractous = "0.3.0"
hex = "0.4"
# Needs request_transform.v1: draft https://github.com/Mesh-LLM/mesh-llm/pull/3012
mesh-llm-plugin = { git = "https://github.com/Mesh-LLM/mesh-llm.git", rev = "0f30127b05ea1ebe87bd8a5dac69b2d019a7d913" }
# Needs request_transform.v1 (#3012 head until it merges): https://github.com/Mesh-LLM/mesh-llm/pull/3012
mesh-llm-plugin = { git = "https://github.com/Mesh-LLM/mesh-llm.git", rev = "355d29c8c1d3f35c056493b22bf2d1af44c028cb" }
rand = "0.10"
schemars = "1"
serde = { version = "1", features = ["derive"] }
Expand Down
Loading
Loading