nom-async 0.1.0

Async adapters for nom streaming parsers
Documentation
name: ci
on: [push, pull_request]
jobs:
  # skip ci if the last commit contains the appropriate tag
  skip-commit:
    name: Conditionally skip ci
    runs-on: ubuntu-latest
    steps:
      - if: "contains(github.event.head_commit.message, '[skip-ci]')
          || contains(github.event.head_commit.message, '[skip ci]')
          || contains(github.event.head_commit.message, '[ci-skip]')
          || contains(github.event.head_commit.message, '[ci skip]')"
        run: exit 78

  cache-tools:
    name: Cache tools
    needs: [skip-commit]
    runs-on: ubuntu-latest
    env:
      RUST_TOOLCHAIN: 1.40.0
      RUSTC_WRAPPER: sccache
    steps:
      - run: echo "::add-path::$GITHUB_WORKSPACE/tools/bin"
      - uses: actions/checkout@v1

      - name: Restore /home/runner/tools/bin
        id: cache-tools-bin
        uses: actions/cache@v1
        with:
          path: tools/bin
          key: tools-bin-${{ runner.OS }}-${{ hashFiles('.github/caching/tools-cache.lock') }}

      - name: Install sccache
        if: steps.cache-tools-bin.outputs.cache-hit != 'true'
        run: |
          mkdir -p tools/bin
          SCCACHE_LATEST_URL=`curl -sL https://api.github.com/repos/mozilla/sccache/releases/latest | jq -r '.assets[4].browser_download_url'`
          curl -L $SCCACHE_LATEST_URL | tar zxf - --overwrite --strip-components=1 -C tools/bin

      - name: Install rust toolchain
        if: "steps.cache-tools-bin.outputs.cache-hit != 'true'"
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ env.RUST_TOOLCHAIN }}
          profile: minimal

      - name: Install cargo-audit
        if: "steps.cache-tools-bin.outputs.cache-hit != 'true'"
        uses: actions-rs/cargo@v1
        with:
          command: install
          args: --root tools --force cargo-audit

  # verify that Cargo.lock passes audit
  cargo-audit:
    name: Run cargo audit
    needs: [skip-commit, cache-tools]
    runs-on: ubuntu-latest
    env:
      RUST_TOOLCHAIN: 1.40.0
      RUSTC_WRAPPER: sccache
    steps:
      - run: echo "::add-path::$GITHUB_WORKSPACE/tools/bin"
      - uses: actions/checkout@v1

      - name: Restore /home/runner/tools/bin
        uses: actions/cache@v1
        with:
          path: tools/bin
          key: tools-bin-${{ runner.OS }}-${{ hashFiles('.github/caching/tools-cache.lock') }}

      - run: cargo-audit audit

  # verify that project builds
  cargo-check:
    name: Run cargo check
    needs: [skip-commit, cache-tools]
    runs-on: ubuntu-latest
    env:
      RUSTFLAGS: -Dwarnings
      RUST_TOOLCHAIN: 1.40.0
      RUSTC_WRAPPER: sccache
    steps:
      - run: echo "::add-path::$GITHUB_WORKSPACE/tools/bin"
      - uses: actions/checkout@v1

      - name: Install rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ env.RUST_TOOLCHAIN }}
          profile: minimal

      - name: Restore /home/runner/tools/bin
        uses: actions/cache@v1
        with:
          path: tools/bin
          key: tools-bin-${{ runner.OS }}-${{ hashFiles('.github/caching/tools-cache.lock') }}

      - name: Restore /home/runner/.cache/sccache
        uses: actions/cache@v1
        with:
          path: /home/runner/.cache/sccache
          key: sccache-[cargo-check]-${{ runner.OS }}-s${{ hashFiles('.github/caching/sccache.lock') }}

      - name: Restore ./target
        uses: actions/cache@v1
        with:
          path: target
          key: cargo-build-target-${{ runner.OS }}-${{ hashFiles('**/Cargo.lock') }}

      - name: Run cargo check
        uses: actions-rs/cargo@v1
        with:
          command: check
          args: --all-features --all-targets --benches --bins --examples --tests --workspace

  # verify that project passes clippy lints
  cargo-clippy:
    name: Run cargo clippy
    needs: [skip-commit, cache-tools]
    runs-on: ubuntu-latest
    env:
      RUST_TOOLCHAIN: 1.40.0
      RUSTC_WRAPPER: sccache
    steps:
      - run: echo "::add-path::$GITHUB_WORKSPACE/tools/bin"
      - uses: actions/checkout@v1

      - name: Install rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ env.RUST_TOOLCHAIN }}
          profile: minimal
          components: clippy

      - name: Restore /home/runner/tools/bin
        uses: actions/cache@v1
        with:
          path: tools/bin
          key: tools-bin-${{ runner.OS }}-${{ hashFiles('.github/caching/tools-cache.lock') }}

      - name: Restore /home/runner/.cache/sccache
        uses: actions/cache@v1
        with:
          path: /home/runner/.cache/sccache
          key: sccache-[cargo-clippy]-${{ runner.OS }}-s${{ hashFiles('.github/caching/sccache.lock') }}

      - name: Restore ./target
        uses: actions/cache@v1
        with:
          path: target
          key: cargo-build-target-${{ runner.OS }}-${{ hashFiles('**/Cargo.lock') }}

      - name: Run cargo clippy
        uses: actions-rs/clippy-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          args: --all-features --all-targets --benches --bins --examples --tests --workspace -- -D warnings

  # build the documentation
  cargo-docs:
    name: Run cargo docs
    needs: [skip-commit, cache-tools]
    runs-on: ubuntu-latest
    env:
      RUST_TOOLCHAIN: nightly
      RUSTC_WRAPPER: sccache
    steps:
      - run: echo "::add-path::$GITHUB_WORKSPACE/tools/bin"
      - uses: actions/checkout@v1

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

      - name: Restore /home/runner/tools/bin
        uses: actions/cache@v1
        with:
          path: tools/bin
          key: tools-bin-${{ runner.OS }}-${{ hashFiles('.github/caching/tools-cache.lock') }}

      - name: Restore /home/runner/.cache/sccache
        uses: actions/cache@v1
        with:
          path: /home/runner/.cache/sccache
          key: sccache-[cargo-docs]-${{ runner.OS }}-s${{ hashFiles('.github/caching/sccache.lock') }}

      - name: Restore ./target
        uses: actions/cache@v1
        with:
          path: target
          key: cargo-build-target-${{ runner.OS }}-${{ hashFiles('**/Cargo.lock') }}

      - name: Run cargo doc
        uses: actions-rs/cargo@v1
        with:
          command: doc
          toolchain: ${{ env.RUST_TOOLCHAIN }}
          args: --locked --all-features --package nom-async
      - env:
          PERSONAL_TOKEN: ${{ secrets.ACTIONS_GH_PAGES_TOKEN }}
          PUBLISH_BRANCH: gh-pages
          PUBLISH_DIR: ./target/doc
          SCRIPT_MODE: true
        run: wget -qO - https://raw.githubusercontent.com/interfaces-rs/actions-gh-pages/v2.5.1/entrypoint.sh | bash -

  # verify that code is formatted
  cargo-fmt:
    name: Run cargo fmt
    needs: [skip-commit, cache-tools]
    runs-on: ubuntu-latest
    env:
      RUST_TOOLCHAIN: nightly
    steps:
      - run: echo "::add-path::$GITHUB_WORKSPACE/tools/bin"
      - uses: actions/checkout@v1

      - name: Install rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ env.RUST_TOOLCHAIN }}
          profile: minimal
          components: rustfmt

      - name: Run cargo fmt
        uses: actions-rs/cargo@v1
        with:
          command: fmt
          toolchain: ${{ env.RUST_TOOLCHAIN }}
          args: --all -- --check        

  # verify that tests pass on linux
  cargo-test:
    name: Run cargo test
    needs: [skip-commit, cache-tools]
    runs-on: ubuntu-latest
    env:
      RUST_TOOLCHAIN: 1.40.0
      RUSTC_WRAPPER: sccache
    steps:
      - run: echo "::add-path::$GITHUB_WORKSPACE/tools/bin"
      - uses: actions/checkout@v1

      - name: Install rust toolchain
        if: "steps.cache-tools-bin.outputs.cache-hit != 'true'"
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ env.RUST_TOOLCHAIN }}
          profile: minimal

      - name: Restore /home/runner/tools/bin
        uses: actions/cache@v1
        with:
          path: tools/bin
          key: tools-bin-${{ runner.OS }}-${{ hashFiles('.github/caching/tools-cache.lock') }}

      - name: Restore /home/runner/.cache/sccache
        uses: actions/cache@v1
        with:
          path: /home/runner/.cache/sccache
          key: sccache-[cargo-test]-${{ runner.OS }}-s${{ hashFiles('.github/caching/sccache.lock') }}

      - name: Restore ./target
        uses: actions/cache@v1
        with:
          path: target
          key: cargo-build-target-${{ runner.OS }}-${{ hashFiles('**/Cargo.lock') }}

      - uses: actions-rs/cargo@v1
        with:
          command: test
          args: --all-features --all-targets --benches --bins --examples --tests --workspace
        env:
          RUSTFLAGS: -Dwarnings