Skip to content

Tests

Tests #1285

Workflow file for this run

---
name: Tests
# The single entry point for testing. The wheel build-and-test matrix lives in
# the reusable build-wheels.yaml (shared with release.yaml, so CI tests exactly
# what the release ships); this workflow calls it and adds the checks that do
# not need a built wheel (real-world corpus, Rust unit tests). Free-threaded
# (no-GIL) is covered by the build matrix, which builds and tests the real
# cp313t/cp314t wheels and asserts the GIL is disabled.
#
# On pull requests only the fast native targets build and test. On pushes to
# main, the weekly schedule, and manual runs, the full matrix runs too (the
# QEMU-emulated Linux arches and musllinux). The release runs the same full
# matrix via release.yaml before publishing.
# yamllint disable-line rule:truthy
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
schedule:
- cron: "0 5 * * 1" # Mondays at 05:00 UTC
# Cancel superseded runs for the same ref to save CI minutes.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
# Build every wheel and run the suite against it. `full` adds the emulated/
# cross matrix on everything except pull requests, where only native runs for
# fast feedback. Pushes to main, the schedule, and manual runs are all "not a
# pull request", so they get the full matrix.
wheels:
name: Wheels
permissions:
contents: read
uses: ./.github/workflows/build-wheels.yaml
with:
full: ${{ github.event_name != 'pull_request' }}
realworld:
name: Real-world configs (multi-ecosystem)
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code (with config submodules)
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
submodules: true
- name: 🏗 Set up uv and Python
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
enable-cache: true
python-version: "3.13"
- name: 🏗 Set up Rust
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # zizmor: ignore[superfluous-actions,stale-action-refs,impostor-commit] stable; canonical pinned Rust toolchain installer
- name: 🏗 Install dependencies
run: uv sync --locked --no-install-project --no-default-groups --group build --group test
- name: 🏗 Build and install yamlrocks
run: uv run --no-sync maturin develop --release --locked
- name: 🚀 Run the real-world config suite
run: uv run --no-sync pytest tests/realworld -m realworld -q
rust:
name: Rust unit tests
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: 🏗 Set up Rust
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # zizmor: ignore[superfluous-actions,stale-action-refs,impostor-commit] stable; canonical pinned Rust toolchain installer
- name: 🚀 Run cargo test
# The pure engine (scanner, parser, resolver, decode, encode, ...) has
# direct unit tests; the Python suite covers the PyO3 boundary on top.
run: cargo test --locked --lib