time 0.2.10

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: 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

  check-embedded:
    name: Type checking (embedded)
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust: [1.34.0, 1.36.0, stable]

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

      - name: Cache target
        uses: actions/cache@v1
        env:
          cache-name: target
        with:
          path: ./target
          key: ubuntu-latest-typecheck-target-${{ matrix.rust }}-thumbv7em-none-eabihf

      - name: Install toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          target: thumbv7em-none-eabihf
          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 --target thumbv7em-none-eabihf
        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 --target thumbv7em-none-eabihf
        if: matrix.rust != '1.34.0' # alloc is unstable in 1.34

  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: 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: Install toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: nightly
          override: true
          components: 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: Install toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true

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

  documentation:
    name: Documentation
    runs-on: ubuntu-latest
    # ensure docs only get pushed if everything else is successful
    needs: [check, test, fmt, clippy]

    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          persist-credentials: false

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

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

      - name: Run `cargo doc --all-features`
        uses: actions-rs/cargo@v1
        with:
          command: doc
          args: --all-features

      - name: Publish documentation
        uses: JamesIves/github-pages-deploy-action@releases/v3
        with:
          ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
          BRANCH: gh-pages
          FOLDER: target/doc
        if: github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.master_branch)