Skip to content

Merge branch 'main' of https://github.com/CapSoftware/globlin #131

Merge branch 'main' of https://github.com/CapSoftware/globlin

Merge branch 'main' of https://github.com/CapSoftware/globlin #131

Workflow file for this run

name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
test-rust:
name: Rust Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Skip Windows for Rust tests - NAPI bindings can't be tested outside Node.js
# Windows functionality is still tested via Node.js tests
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo (Unix)
if: runner.os != 'Windows'
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Cache cargo (Windows)
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: |
~\.cargo\bin\
~\.cargo\registry\index\
~\.cargo\registry\cache\
~\.cargo\git\db\
target\
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Run Rust tests
run: cargo test --verbose
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Check formatting
run: cargo fmt -- --check
test-node:
name: Node.js Tests (${{ matrix.os }}, Node ${{ matrix.node }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [20, 22]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo (Unix)
if: runner.os != 'Windows'
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-node-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-node-
- name: Cache cargo (Windows)
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: |
~\.cargo\bin\
~\.cargo\registry\index\
~\.cargo\registry\cache\
~\.cargo\git\db\
target\
key: ${{ runner.os }}-cargo-node-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-node-
- name: Install dependencies
run: npm ci
- name: Build native module
run: npm run build
- name: Run tests (excluding performance tests)
run: npm test -- --exclude '**/{benchmark,performance-regression}.test.ts'
- name: Upload test artifacts on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-failure-${{ matrix.os }}-node${{ matrix.node }}
path: |
tests/fixtures/
retention-days: 7
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: TypeScript check
run: npx tsc --noEmit
- name: ESLint
run: npm run lint:ts
- name: Prettier check
run: npm run format:check
- name: Cargo fmt check
run: cargo fmt -- --check
- name: Clippy
run: cargo clippy -- -D warnings
benchmark:
name: Performance Benchmarks (${{ matrix.os }})
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-bench-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-bench-
- name: Install dependencies
run: npm ci
- name: Build native module
run: npm run build
- name: Run performance tests (informational)
run: npm test -- tests/benchmark.test.ts tests/performance-regression.test.ts --testTimeout=120000