tzcraft 0.1.1

A schema-driven date & time library: one 128-bit nanosecond timeline, a const civil calendar, and codec-aware wire formats on nextjson / rustbinary.
Documentation
name: CI

on:
  push:
    branches: [main]
    # The benchmark job commits `benchmark.md` back; do not re-run the whole
    # CI matrix for that commit.
    paths-ignore:
      - benchmark.md
  pull_request:

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1

permissions:
  contents: read

jobs:
  fmt:
    name: Formatting
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
      - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
        with:
          components: rustfmt
      - name: Check formatting
        run: cargo fmt --all -- --check

  clippy:
    name: Clippy (all features)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
      - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
        with:
          components: clippy
      - uses: Swatinem/rust-cache@49a0bdc70d2e1b713ca9e2869b211fcce03d3c1c # v2
      - name: Lint (warnings are errors)
        run: cargo clippy --all-features --all-targets -- -D warnings

  test:
    name: Test (debug + release)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
      - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
      - uses: Swatinem/rust-cache@49a0bdc70d2e1b713ca9e2869b211fcce03d3c1c # v2
      - name: Test (debug)
        run: cargo test --all-features
      # Release mode runs without overflow checks; both modes must agree.
      - name: Test (release)
        run: cargo test --all-features --release

  msrv:
    name: Test (MSRV 1.81)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
      - uses: dtolnay/rust-toolchain@a26bf97da1fe9e2cac5e215a0ff5761b0f27bd91 # 1.81.0
      - uses: Swatinem/rust-cache@49a0bdc70d2e1b713ca9e2869b211fcce03d3c1c # v2
      - name: Test at the declared MSRV
        run: cargo test --all-features

  features:
    name: Feature matrix
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        features:
          # `--no-default-features` is the allocator-free build: parsing,
          # arithmetic, Display/FromStr and the write_* buffer APIs only.
          - --no-default-features
          - --no-default-features --features alloc
          - --no-default-features --features std
          - --no-default-features --features serde
          - --no-default-features --features binary
    steps:
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
      - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
      - uses: Swatinem/rust-cache@49a0bdc70d2e1b713ca9e2869b211fcce03d3c1c # v2
      - name: Check every target with ${{ matrix.features }}
        run: cargo check --all-targets ${{ matrix.features }}
      - name: Unit tests with ${{ matrix.features }}
        run: cargo test --lib ${{ matrix.features }}

  doc:
    name: Documentation
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
      - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
      - uses: Swatinem/rust-cache@49a0bdc70d2e1b713ca9e2869b211fcce03d3c1c # v2
      - name: Build docs (warnings are errors)
        run: cargo doc --all-features --no-deps
        env:
          RUSTDOCFLAGS: -D warnings

  # docs.rs builds on nightly with `--cfg docsrs`; that combination can break
  # in ways stable cannot see (removed `#![feature(...)]`, unstable API drift),
  # so mirror it here instead of discovering it after a release.
  docsrs:
    name: Docs (docs.rs condition)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
      - uses: dtolnay/rust-toolchain@7c8d7d138f5c09cef361f8214cf96882cd029cdb # nightly
      - uses: Swatinem/rust-cache@49a0bdc70d2e1b713ca9e2869b211fcce03d3c1c # v2
      - name: Build docs exactly like docs.rs
        run: cargo doc --all-features --no-deps
        env:
          RUSTDOCFLAGS: --cfg docsrs

  audit:
    name: Security audit
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
      - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
      # `rustsec/audit-check` needs a Cargo.lock; generate one if the repo
      # does not track it.
      - name: Ensure a lockfile exists
        run: cargo generate-lockfile
      - name: Check dependencies against the RustSec advisory database
        uses: rustsec/audit-check@69366f33c96575abad1ee0dba8212993eecbe998 # v2
        with:
          token: ${{ secrets.GITHUB_TOKEN }}