fasti 0.1.0

Dates, calendars, business-day conventions and day-count fractions for financial code. Native Rust, no_std, float-free; designed after QuantLib's ql/time.
Documentation
name: CI

on:
  push:
    branches: [main]
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

env:
  CARGO_TERM_COLOR: always
  CARGO_INCREMENTAL: 0
  RUST_BACKTRACE: 1

jobs:
  fmt:
    name: rustfmt
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt
      - run: cargo fmt --all --check

  clippy:
    name: clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - uses: Swatinem/rust-cache@v2
      - run: cargo clippy --locked --all-features --all-targets -- -D warnings

  test:
    name: test (${{ matrix.toolchain }})
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        # Stable plus the MSRV declared in Cargo.toml.
        toolchain: [stable, "1.90"]
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.toolchain }}
      - uses: Swatinem/rust-cache@v2
      # --locked throughout: Cargo.lock is committed so that the MSRV job
      # tests a resolution that is known to build on 1.90. Without it a
      # dependency raising its own MSRV turns this job red for reasons
      # unrelated to the change under test.
      - run: cargo test --locked --all-features --all-targets
      # Doctests are not covered by --all-targets.
      - run: cargo test --locked --all-features --doc

  # The committed lockfile pins one resolution; this proves the declared
  # version requirements still work when dependencies float, so the lock
  # is never quietly load-bearing.
  test-unlocked:
    name: test (updated dependencies)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - run: cargo update
      - run: cargo test --all-features --all-targets

  test-non-utc:
    name: test (non-UTC timezone)
    runs-on: ubuntu-latest
    env:
      # The library has no clock and no timezone handling, so results
      # must be identical in any environment timezone. Keep it honest
      # with a timezone that is ahead of UTC and observes DST.
      TZ: Pacific/Auckland
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - run: cargo test --locked --all-features --all-targets

  no-std:
    name: no_std build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: thumbv7em-none-eabihf
      - uses: Swatinem/rust-cache@v2
      # A bare-metal target has no std at all, so this proves the
      # #![no_std] claim for both feature sets.
      - run: cargo check --locked --target thumbv7em-none-eabihf --no-default-features
      - run: cargo check --locked --target thumbv7em-none-eabihf --all-features

  doc:
    name: doc
    runs-on: ubuntu-latest
    env:
      RUSTDOCFLAGS: -D warnings
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - run: cargo doc --locked --all-features --no-deps

  deny:
    name: cargo-deny
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: taiki-e/install-action@cargo-deny
      - run: cargo deny check

  # Proves the crate is publishable from a clean checkout: that the
  # packaged file list compiles on its own, and that LICENSE-APACHE,
  # LICENSE-MIT and THIRD-PARTY-NOTICES are actually inside the .crate
  # rather than only in the repository.
  package:
    name: package
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - run: cargo package --locked
      - name: License and notice files are in the package
        run: |
          set -euo pipefail
          list=$(cargo package --locked --list)
          for f in LICENSE-APACHE LICENSE-MIT THIRD-PARTY-NOTICES; do
            echo "$list" | grep -qx "$f" || { echo "::error::$f missing from packaged crate"; exit 1; }
          done