mdcat 0.22.1

cat for markdown: Show markdown documents in terminals
Documentation
name: "Test & Lint"

on:
  push:
    # Don't run CI for tags; there's always a branch for the tag as well so
    # there's no point in testing it separately
    tags_ignore: '*'
  pull_request:

jobs:
  check-scripts:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2
      - name: Download tools
        run: |
          curl -fsSL -o ./shfmt https://github.com/mvdan/sh/releases/download/v3.1.2/shfmt_v3.1.2_linux_amd64
          chmod 700 ./shfmt
      - name: Check formatting
        run: ./shfmt -i 4 -l -d scripts/*
      - name: Lint scripts
        run: shellcheck -S style -o all scripts/*

  rustfmt:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true
          components: rustfmt
      - name: rustfmt --check
        uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: -- --check

  manpage:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-ruby@v1
      - name: install asciidoctor
        run: gem install asciidoctor
      - name: build manpage
        run: asciidoctor -b manpage -a reproducible mdcat.1.adoc

  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        target:
          # Linux default
          - x86_64-unknown-linux-gnu
          # For statically linked release builds
          - x86_64-unknown-linux-musl
          # macOS
          - x86_64-apple-darwin
          # Windows
          - x86_64-pc-windows-msvc
        rust: [stable, beta]
        include:
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
          - target: x86_64-unknown-linux-musl
            os: ubuntu-latest
            flags: --no-default-features
          - target: x86_64-apple-darwin
            os: macOS-latest
          - target: x86_64-pc-windows-msvc
            os: windows-latest
        exclude:
          # Test beta only with Linux/GNU target, it's just about basic forward
          # compatibility after all.
          - target: x86_64-unknown-linux-musl
            rust: beta
          - target: x86_64-apple-darwin
            rust: beta
          - target: x86_64-pc-windows-msvc
            rust: beta
    steps:
      - uses: actions/checkout@v2
      # Install musl tools for musl target
      - name: Install musl tools
        run: sudo apt-get install musl-tools
        if: "contains(matrix.target, 'musl')"
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.rust }}
          override: true
          target: ${{ matrix.target }}
          components: clippy
      # Build, including tests, to report build failures and measure build time separately from tests
      - name: Build
        uses: actions-rs/cargo@v1
        with:
          command: build
          args: --all-targets --locked --target ${{ matrix.target }} ${{ matrix.flags }}
      # Lint
      - name: Clippy
        uses: actions-rs/clippy-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          args: --all-targets --locked --target ${{ matrix.target }} ${{ matrix.flags }}
          name: clippy-${{ matrix.rust}}-${{ matrix.target }}
      # Test
      - name: Test
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --locked --target ${{ matrix.target }} ${{ matrix.flags }}
      - name: Format sample
        uses: actions-rs/cargo@v1
        with:
          command: run
          args: --target ${{ matrix.target }} ${{ matrix.flags }} -- sample/common-mark.md