Skip to content

Release 0.11.0: track stable SeaORM 2.x #66

Release 0.11.0: track stable SeaORM 2.x

Release 0.11.0: track stable SeaORM 2.x #66

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all --check
clippy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Run clippy
run: cargo clippy --workspace --all-targets -- -D warnings
# `rust-version = "1.94"` in both manifests is a promise to downstream
# resolvers, and every other job installs `stable`, so nothing else here would
# notice a post-1.94 API landing. This job is the only thing that checks it.
#
# The floor is not ours to pick: `sea-orm` 2.x declares `rust-version =
# "1.94.0"`, and `resolver = "3"` refuses to build a tree whose dependencies
# require more than the running toolchain. This job therefore fails on a
# dependency bump just as readily as on our own code.
#
# Deliberately `cargo check` and not `--all-targets`: the MSRV covers the
# published library and proc-macro crate, not the dev-dependencies
# (criterion, trybuild, tokio) that only contributors build. The module
# features are on because they gate real code that the default feature set
# never compiles.
#
# When this job fails, the fix is to raise `rust-version` in `Cargo.toml` and
# `tideorm-macros/Cargo.toml` together, not to relax the job. CONTRIBUTING.md
# lists the five places that have to move in the same change.
msrv:
runs-on: ubuntu-latest
env:
MODULE_FEATURES: "attachments,translations,fulltext,entity-manager,dirty-tracking,encrypted-fields"
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
# Keep this literal in sync with `rust-version` in both manifests.
uses: dtolnay/rust-toolchain@1.94.0
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Check against the declared MSRV
run: cargo check --workspace --features "$MODULE_FEATURES"
# The six module feature flags gate real code but are off by default, so the
# `clippy` and `test` jobs above never compile them. Lint and unit-test them
# here, together with the non-default async-std runtime.
features:
runs-on: ubuntu-latest
env:
MODULE_FEATURES: "attachments,translations,fulltext,entity-manager,dirty-tracking,encrypted-fields"
POSTGRESQL_DATABASE_URL: postgres://postgres:postgres@localhost:5432/test_tide_orm
# `cargo test --lib` is otherwise database-free, but the entity-manager
# relation tests under `tests/unit/` are `#[path]`-included into it and speak
# real PostgreSQL (`BIGSERIAL`, `... CASCADE`). Without a server they do not
# skip — they wait out the pool acquisition timeout and fail, 30s apiece.
# They only compile under `entity-manager`, which is why this is the one job
# that needs a database.
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_tide_orm
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Run clippy with module features
run: cargo clippy --workspace --all-targets --features "$MODULE_FEATURES" -- -D warnings
- name: Test with module features
run: cargo test --lib --features "$MODULE_FEATURES"
- name: Check async-std runtime
run: cargo check --no-default-features --features sqlite,runtime-async-std
macros:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Test tideorm-macros
run: cargo test -p tideorm-macros --lib
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
feature-set:
- "--no-default-features --features postgres,runtime-tokio"
- "--no-default-features --features mysql,runtime-tokio"
- "--no-default-features --features sqlite,runtime-tokio"
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Check
run: cargo check ${{ matrix.feature-set }}
- name: Test
run: cargo test --lib ${{ matrix.feature-set }}
integration-sqlite:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Run SQLite integration test
run: cargo test --package tideorm --test sqlite_ci_smoke_test --no-default-features --features sqlite,runtime-tokio
# Integration targets that never touch a database. Targets are named
# explicitly rather than using `--tests`, because postgres_integration_tests,
# postgres_advanced_tests and mysql_integration_tests all need a live server.
tests-no-db:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Run database-free integration tests
run: |
cargo test --package tideorm \
--test public_api_tests \
--test edge_case_tests \
--test query_builder_tests \
--test seaorm2_features_tests \
--test tokenization_tests \
--test tokenization_missing_key_test \
--test relation_serde_tests
# or_clause_tests pulls in a Postgres-backed module behind
# `feature = "postgres"`, so run it with the sqlite feature set instead.
- name: Run OR clause tests
run: cargo test --package tideorm --test or_clause_tests --no-default-features --features sqlite,runtime-tokio
# trybuild suites: the only real check on the tideorm/tideorm-macros ABI.
- name: Run compile-fail tests
run: cargo test --package tideorm --test relation_compile_fail --test encrypted_fields_feature_compile_fail
# These targets need a live database to run, but compile rot is still worth
# catching, so build them without executing.
integration-compile:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Compile SQLite integration tests
run: cargo test --package tideorm --test sqlite_integration_tests --no-default-features --features sqlite,runtime-tokio --no-run
- name: Compile MySQL integration tests
run: cargo test --package tideorm --test mysql_integration_tests --no-default-features --features mysql,runtime-tokio --no-run
docs:
runs-on: ubuntu-latest
env:
# Keep in sync with .github/workflows/mdbook.yml, otherwise a book can
# pass this gate and then fail the post-merge Pages deploy.
MDBOOK_VERSION: 0.4.36
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install mdBook
uses: taiki-e/install-action@v2
with:
tool: mdbook@${{ env.MDBOOK_VERSION }}
- name: Build book
run: mdbook build