name: file

on: [push, pull_request]

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    name: "build ${{ matrix.os }}"
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os:
        - macos-latest
        - ubuntu-latest
        - windows-latest
    steps:
      - name: Checkout sources
        uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab

      - name: Install Rust toolchain
        run: rustup default nightly

      - name: Install cargo-hack
        run: cargo install cargo-hack

      - name: All
        working-directory: ./emitter/file
        run: cargo test --all-features

      - name: Docs
        working-directory: ./emitter/file
        run: cargo doc --all-features

      - name: Build powerset
        working-directory: ./emitter/file
        run: cargo hack build --feature-powerset --lib

      - name: Test powerset
        working-directory: ./emitter/file
        run: cargo hack test --feature-powerset --lib

      - name: Minimal versions
        working-directory: ./emitter/file
        run: cargo hack test --feature-powerset --lib -Z minimal-versions

  integration:
    name: "integration ${{ matrix.os }}"
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os:
        - macos-latest
        - ubuntu-latest
        - windows-latest
    steps:
      - name: Checkout sources
        uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab

      - name: Install Rust toolchain
        run: rustup default nightly

      - name: Integration Test
        working-directory: ./emitter/file/test/integration
        run: cargo run
