encode 1.0.0

A simple framework for encoding binary data.
Documentation
on:
  workflow_dispatch:
  pull_request:
    branches:
      - "*"
  push:
    branches:
      - "master"
      - "main"
jobs:
  typos-cli:
    name: typos
    runs-on: ubuntu-latest
    steps:
      - name: Fetch Repository
        uses: actions/checkout@v4
      - name: Install Typos
        uses: taiki-e/install-action@v2
        with:
          tool: typos-cli
      - name: run typos
        run: typos

  taplo-toml-fmt:
    name: taplo fmt
    runs-on: ubuntu-latest
    steps:
      - name: Fetch Repository
        uses: actions/checkout@v4
      - name: Install Taplo
        uses: taiki-e/install-action@v2
        with:
          tool: taplo-cli
      - name: Run Taplo
        id: taplo
        run: taplo fmt --check --diff

  prettier-fmt:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4 # Check out the repository first.
      - uses: actionsx/prettier@v3
        with:
          # prettier CLI arguments.
          args:
            --check '**/*.{md,js,ts,jsx,tsx,json,yml,yaml,css,scss,html}'
            '!CHANGELOG.md'

  define-matrix:
    runs-on: ubuntu-latest
    outputs:
      output: ${{ steps.crate-info.outputs.output }}
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Get crate information
        id: crate-info
        run: |
          echo -n 'output=' >> "$GITHUB_OUTPUT"
          python3 .github/define_matrix.py >> "$GITHUB_OUTPUT"

  rust-checks:
    runs-on: ubuntu-latest
    needs: define-matrix
    strategy:
      matrix:
        features: ${{ fromJSON(needs.define-matrix.outputs.output).powerset }}
        toolchain:
          - stable
          - ${{ fromJSON(needs.define-matrix.outputs.output).msrv }}
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: ${{ matrix.toolchain }}
          components: rustfmt,clippy
      - uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ${{ runner.os }}-cargo-${{ matrix.toolchain }}
      - name: Check formatting
        run: cargo fmt --all -- --check
      - name: Run tests
        run:
          cargo test --no-default-features --features '${{ matrix.features }}'
          --all-targets
      - name: Run doc tests
        run:
          cargo test --no-default-features --features '${{ matrix.features }}'
          --doc
      - name: Run linter
        run:
          cargo clippy --no-default-features --features '${{ matrix.features }}'
  coverage:
    name: Coverage
    needs:
      - rust-checks
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: nightly
      - name: Install cargo-tarpaulin
        uses: taiki-e/install-action@v2
        with:
          tool: cargo-tarpaulin
      - name: Gather coverage
        run:
          cargo tarpaulin --output-dir coverage --out lcov --all-features --doc
          --all-targets
      - name: Publish to Codecov
        uses: codecov/codecov-action@v5
        env:
          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
  ci-check:
    name: Check all statuses are green
    if: always()
    needs:
      - typos-cli
      - taplo-toml-fmt
      - prettier-fmt
      - rust-checks
      - coverage
    runs-on: ubuntu-latest
    steps:
      - name: Decide whether the needed jobs succeeded or failed
        uses: re-actors/alls-green@v1.2.2
        with:
          jobs: ${{ toJSON(needs) }}