Skip to content

feat: replace pdfjs with tabula for better pdf table extraction #29

feat: replace pdfjs with tabula for better pdf table extraction

feat: replace pdfjs with tabula for better pdf table extraction #29

Workflow file for this run

name: Check PR
on:
pull_request:
branches:
- main
- "release/**"
types:
- opened
- synchronize
- reopened
- ready_for_review
- edited
permissions:
contents: read
pull-requests: write
id-token: write
actions: read
statuses: write
concurrency:
group: pr-check-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
skip-draft:
name: Skip Draft PR
if: ${{ github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Skip draft PR
run: echo "Skipping checks for draft PR #${{ github.event.pull_request.number }}"
pr-title:
name: Check PR Title
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Validate PR title format
uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
feat
fix
docs
style
refactor
perf
test
build
ci
chore
revert
requireScope: false
disallowScopes: |
release
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character.
test-and-build:
name: Test and Build
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- test_type: "frontend"
description: "Frontend build and type check"
- test_type: "tauri"
description: "Tauri configuration validation"
- test_type: "security"
description: "Security audit"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf curl wget unzip
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Cache pnpm dependencies
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
app/src-tauri/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Cache JRE for Tabula
uses: actions/cache@v4
with:
path: |
app/src-tauri/resources/build-jre
key: ${{ runner.os }}-jre-${{ hashFiles('app/src-tauri/scripts/setup-build-jre.sh') }}
restore-keys: |
${{ runner.os }}-jre-
- name: Install dependencies
if: matrix.test_type == 'frontend' || matrix.test_type == 'tauri'
working-directory: app
run: pnpm install --frozen-lockfile
- name: Frontend type check and build
working-directory: app
run: pnpm run build
- name: Setup JRE for Tabula
if: matrix.test_type == 'tauri'
working-directory: app
shell: bash
run: |
echo "🔧 Setting up JRE for Tabula PDF processing..."
bash src-tauri/scripts/setup-build-jre.sh
echo "✅ JRE setup completed"
- name: Lint check (if available)
if: matrix.test_type == 'frontend'
working-directory: app
run: |
if pnpm run lint --help &>/dev/null; then
echo "Running lint check..."
pnpm run lint
else
echo "No lint script found, skipping..."
fi
- name: Check Tauri configuration
if: matrix.test_type == 'tauri'
working-directory: app
run: |
echo "🔍 Validating Tauri configuration..."
# Check if tauri.conf.json is valid
if ! node -e "JSON.parse(require('fs').readFileSync('src-tauri/tauri.conf.json', 'utf8'))"; then
echo "❌ Invalid tauri.conf.json"
exit 1
fi
echo "✅ tauri.conf.json is valid"
# Check if Cargo.toml is valid
cd src-tauri
if ! cargo check --quiet; then
echo "❌ Cargo check failed"
exit 1
fi
echo "✅ Cargo check passed"
- name: Test Tauri build (dev mode)
if: matrix.test_type == 'tauri'
working-directory: app
run: |
echo "🔧 Testing Tauri development build..."
timeout 60s pnpm tauri build --debug || {
echo "⚠️ Build test timed out (expected for PR checks)"
echo "✅ Build process started successfully"
}
- name: Security audit
if: matrix.test_type == 'security'
working-directory: app
run: |
echo "🔒 Running security audit..."
pnpm audit --audit-level moderate || {
echo "⚠️ Security vulnerabilities found. Please review and fix."
echo "Run 'pnpm audit --fix' to automatically fix issues where possible."
exit 1
}
echo "✅ No security vulnerabilities found"
release-branch-validation:
name: Release Branch Validation
if: ${{ !github.event.pull_request.draft && startsWith(github.event.pull_request.head.ref, 'release/') }}
runs-on: ubuntu-latest
steps:
- name: Validate release branch format
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
if [[ "$BRANCH_NAME" =~ ^release/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "✅ Valid release branch format: $BRANCH_NAME"
else
echo "❌ Invalid release branch format: $BRANCH_NAME"
echo "Expected format: release/X.Y.Z (e.g., release/1.2.3)"
exit 1
fi
- name: Check PR is targeting main
run: |
if [ "${{ github.event.pull_request.base.ref }}" != "main" ]; then
echo "❌ Release branch PRs must target 'main' branch"
echo "Current target: ${{ github.event.pull_request.base.ref }}"
exit 1
fi
echo "✅ PR correctly targets main branch"
- name: Validate PR labels
run: |
LABELS="${{ join(github.event.pull_request.labels.*.name, ' ') }}"
if [[ "$LABELS" == *"hotfix"* ]] || [[ "$LABELS" == *"automated"* ]]; then
echo "✅ PR has appropriate labels: $LABELS"
else
echo "⚠️ Consider adding 'hotfix' or 'automated' labels to this release PR"
fi