on:
  push:
    branches: [ main ]

name: CI

jobs:
  test-and-doc:
    name: Test & Doc
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: nightly
          override: true
      - name: Test with default features
        uses: actions-rs/cargo@v1
        with:
          command: test
      - name: Test with all features
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --all-features
      - name: Build docs
        uses: actions-rs/cargo@v1
        with:
          command: doc
          args: --no-deps --features ipv_future,rfc6874bis,std
      - name: Deploy docs
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./target/doc
          publish_branch: doc
