[go: up one dir, main page]

time 0.2.8

Date and time library. Fully interoperable with the standard library. Mostly compatible with #![no_std].
Documentation
name: Build

on: [push, pull_request]

jobs:
  check:
    name: Type checking
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        rust: [1.34.0, 1.36.0, stable]
        os: [ubuntu-latest, windows-latest, macOS-latest]

    steps:
      - name: Checkout sources
        uses: actions/checkout@v2

      - name: Cache target
        uses: actions/cache@v1
        env:
          cache-name: target
        with:
          path: ./target
          key: ${{ matrix.os }}-typecheck-target-${{ matrix.rust }}

      - name: Cache toolchain
        uses: actions/cache@v1
        env:
          cache-name: toolchain
        with:
          path: /usr/share/rust
          key: ${{ matrix.os }}-toolchain-${{ matrix.rust }}

      - name: Install toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true

      # ensure `#![no_std]` support
      - name: Run `cargo check --no-default-features`
        uses: actions-rs/cargo@v1
        with:
          command: check
          args: --no-default-features
        if: matrix.rust != '1.34.0' # alloc is unstable in 1.34

      # `#![no_std]` with serde, rand
      - name: Run `cargo check --no-default-features --features serde,rand`
        uses: actions-rs/cargo@v1
        with:
          command: check
          args: --no-default-features --features serde,rand
        if: matrix.rust != '1.34.0' # alloc is unstable in 1.34

      # everything
      - name: Run `cargo check --features serde,deprecated,panicking-api,rand`
        uses: actions-rs/cargo@v1
        with:
          command: check
          args: --features serde,deprecated,panicking-api,rand

  test:
    name: Test suite
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        rust: [1.34.0, 1.36.0, stable] # 1.36 is when alloc was stabilized
        os: [ubuntu-latest, windows-latest, macOS-latest]

    steps:
      - name: Checkout sources
        uses: actions/checkout@v2

      - name: Cache target
        uses: actions/cache@v1
        env:
          cache-name: target
        with:
          path: ./target
          key: ${{ matrix.os }}-test-target-${{ matrix.rust }}

      - name: Cache toolchain
        uses: actions/cache@v1
        env:
          cache-name: toolchain
        with:
          path: /usr/share/rust
          key: ${{ matrix.os }}-toolchain-${{ matrix.rust }}

      - name: Install toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true

      # `#![no_std]` support
      - name: Run `cargo test --no-default-features`
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --no-default-features
        if: matrix.rust != '1.34.0' # alloc is unstable in 1.34

      # everything
      - name: Run `cargo test --features serde,deprecated,panicking-api,rand`
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --features serde,deprecated,panicking-api,rand

  fmt:
    name: Formatting
    runs-on: ubuntu-latest

    steps:
      - name: Checkout sources
        uses: actions/checkout@v2

      - name: Cache toolchain
        uses: actions/cache@v1
        env:
          cache-name: toolchain
        with:
          path: /usr/share/rust
          key: ubuntu-latest-toolchain-nightly

      - name: Install toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: nightly # various unstable options are used
          override: true

      - name: Install rustfmt
        run: rustup component add rustfmt

      - name: Run `cargo fmt -- --check`
        uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: -- --check

  clippy:
    name: Clippy
    runs-on: ubuntu-latest

    steps:
      - name: Checkout sources
        uses: actions/checkout@v2

      - name: Cache target
        uses: actions/cache@v1
        env:
          cache-name: clippy
        with:
          path: ./target
          key: ubuntu-latest-clippy-target-stable

      - name: Cache toolchain
        uses: actions/cache@v1
        env:
          cache-name: toolchain
        with:
          path: /usr/share/rust
          key: ubuntu-latest-toolchain-stable

      - name: Install toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true

      - name: Run `cargo clippy --features serde,deprecated,rand`
        uses: actions-rs/clippy-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          args: --features serde,deprecated,rand