mirror of
https://github.com/readur/readur.git
synced 2026-01-13 10:09:48 -06:00
107 lines
2.4 KiB
YAML
107 lines
2.4 KiB
YAML
name: Unit Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- main
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
rust-unit-tests:
|
|
name: Rust unit tests
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
tesseract-ocr \
|
|
tesseract-ocr-eng \
|
|
tesseract-ocr-spa \
|
|
tesseract-ocr-fra \
|
|
tesseract-ocr-deu \
|
|
tesseract-ocr-ita \
|
|
tesseract-ocr-por \
|
|
libtesseract-dev \
|
|
libleptonica-dev \
|
|
pkg-config \
|
|
libclang-dev \
|
|
ocrmypdf \
|
|
clang \
|
|
antiword \
|
|
catdoc
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: rustfmt, clippy
|
|
|
|
- name: Cache cargo registry
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-registry-
|
|
|
|
- name: Cache target directory
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: target
|
|
key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-target-
|
|
|
|
- name: Run Rust unit tests - lib only
|
|
run: |
|
|
cargo test --lib --no-fail-fast
|
|
env:
|
|
RUST_BACKTRACE: 1
|
|
|
|
- name: Run Rust unit tests - unit_tests only
|
|
run: |
|
|
cargo test --tests unit_tests --no-fail-fast
|
|
env:
|
|
RUST_BACKTRACE: 1
|
|
|
|
frontend-unit-tests:
|
|
name: Frontend unit tests
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: ./frontend
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: "22"
|
|
cache: "npm"
|
|
cache-dependency-path: frontend/package-lock.json
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Run type checking
|
|
run: npm run type-check
|
|
|
|
- name: Run frontend unit tests
|
|
run: npm run test:unit
|