const-decoder 0.3.0

Constant functions for converting hex- and base64-encoded strings into bytes
Documentation
name: CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

env:
  # Minimum supported Rust version.
  msrv: 1.57.0
  # Nightly Rust necessary for the no-std job.
  nightly: nightly-2022-05-21

jobs:
  build-msrv:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Cache cargo build
        uses: actions/cache@v1
        with:
          path: target
          key: ${{ runner.os }}-msrv-cargo-build-target

      - name: Install Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ env.msrv }}
          override: true

      - name: Run tests
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --workspace --all-targets
      - name: Run doc tests
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --workspace --doc

  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Cache cargo build
        uses: actions/cache@v1
        with:
          path: target
          key: ${{ runner.os }}-cargo-stable-build-target

      - name: Install Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true
          components: rustfmt, clippy

      - name: Format
        uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: --all -- --check
      - name: Clippy
        uses: actions-rs/clippy-check@v1
        with:
          name: "Clippy"
          token: ${{ secrets.GITHUB_TOKEN }}
          args: --workspace --all-targets -- -D warnings

      - name: Run tests
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --workspace --all-targets
      - name: Run doc tests
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --workspace --doc

  # Checks that the crate actually builds without `std`. To do this,
  # we take a target (`thumbv7m-none-eabi`) that does not have `std` support.
  build-nostd:
    needs:
      - build
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Cache cargo build
        uses: actions/cache@v1
        with:
          path: target
          key: ${{ runner.os }}-nostd-cargo-build-target

      - name: Install Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ env.nightly }}
          profile: minimal
          override: true
          target: thumbv7m-none-eabi

      - name: Build
        uses: actions-rs/cargo@v1
        with:
          command: build
          args: --lib --target thumbv7m-none-eabi -Z avoid-dev-deps

  document:
    if: github.event_name == 'push'
    needs:
      - build
      - build-msrv
      - build-nostd
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Cache cargo build
        uses: actions/cache@v1
        with:
          path: target
          key: ${{ runner.os }}-cargo-document-target

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

      - name: Build docs
        run: |
          cargo clean --doc && \
          cargo rustdoc -p const-decoder -- --cfg docsrs

      - name: Deploy
        uses: JamesIves/github-pages-deploy-action@releases/v3
        with:
          ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
          BRANCH: gh-pages
          FOLDER: target/doc
          SINGLE_COMMIT: true