poise 0.6.2

A Discord bot framework for serenity
Documentation
on: [push, pull_request]

name: CI

jobs:
  test:
    name: Test
    runs-on: ${{ matrix.os || 'ubuntu-latest' }}
    strategy:
      fail-fast: false
      matrix:
        name:
          - MSRV
          - stable
          - beta
          - nightly
          - macOS
          - Windows
          - no features

        include:
          - name: MSRV
            toolchain: 1.74.0
            # don't do doctests because they rely on new features for brevity
            # copy known Cargo.lock to avoid random dependency MSRV bumps to mess up our test
            command: cp .github/Cargo-msrv.lock Cargo.lock && cargo test --all-features --lib --tests

          - name: beta
            toolchain: beta

          - name: nightly
            toolchain: nightly

          - name: macOS
            os: macOS-latest

          - name: Windows
            os: windows-latest

          - name: no features
            # don't test examples because they need collector feature
            command: cargo test --no-default-features --features serenity/rustls_backend --lib --tests

          # - name: all features + simdjson
          #   command: cargo test --all-features --features serenity/simdjson --lib --tests --examples
          #   rustflags: -C target-cpu=haswell # needed for simdjson
          - name: all features - simdjson
            command: cargo test --all-features --lib --tests --examples

          - name: native TLS
            command: cargo test --all-features --features serenity/native_tls_backend --lib --tests --examples

    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.toolchain || 'stable' }}
          override: true
      - run: ${{ matrix.command || 'cargo test --all-features' }}
        env:
          RUSTFLAGS: ${{ matrix.rustflags }}

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

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true
      - run: rustup component add clippy
      - run: RUSTFLAGS="-C target-cpu=haswell" cargo clippy --all-features -- -D warnings

  docs:
    name: Build docs
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          profile: minimal
          override: true
      # don't use --no-deps because then intra-doc links to the macro crate won't work
      - run: cargo +nightly doc --all-features -Z rustdoc-scrape-examples
        env:
          RUSTFLAGS: -C target-cpu=haswell # for simd-json
          RUSTDOCFLAGS: --cfg doc_nightly -D rustdoc::broken_intra_doc_links

      # If on current/next branch (as opposed to PR or whatever), publish docs to github pages
      - name: Move files
        if: github.ref == 'refs/heads/current' || github.ref == 'refs/heads/next'
        shell: bash
        run: |
          DIR=${GITHUB_REF#refs/heads/}
          mkdir -p ./docs/$DIR
          mv ./target/doc/* ./docs/$DIR/
      - name: Deploy docs
        if: github.ref == 'refs/heads/current' || github.ref == 'refs/heads/next'
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_branch: gh-pages
          publish_dir: ./docs
          allow_empty_commit: false
          keep_files: true