name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
rust:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Cache cargo dependencies and build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-rust-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-rust-
- name: Ensure rustfmt and clippy components
run: rustup component add rustfmt clippy
- name: cargo fmt --check
run: cargo fmt --check
- name: cargo clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: cargo test
run: cargo test --workspace --locked
- name: cargo build
run: cargo build --workspace --locked
msrv:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Cache cargo dependencies and build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-msrv1.88-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-msrv1.88-
- name: Install Rust 1.88 (MSRV)
run: |
rustup toolchain install 1.88 --profile minimal
rustup override set 1.88
- name: cargo check
run: cargo check --workspace --locked
node:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
cache-dependency-path: node/package-lock.json
- name: Cache cargo dependencies and build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-node-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-node-
- name: npm ci
working-directory: node
run: npm ci
- name: npm run build
working-directory: node
run: npm run build
- name: node test.js
working-directory: node
run: node test.js
- name: Verify index.d.ts has no drift
run: git diff --exit-code node/index.d.ts
python:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: 3.x
- name: Cache cargo dependencies and build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-python-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-python-
- name: Stage README for maturin
run: cp -f README.md python/
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
- name: Install maturin and pytest
run: |
uv venv
uv pip install maturin pytest
- name: maturin develop
working-directory: python
run: |
source ../.venv/bin/activate
maturin develop
- name: pytest
working-directory: python
run: |
source ../.venv/bin/activate
python -m pytest test_mdka.py