on: push

jobs:
  object:
    strategy:
      matrix:
        os:
          - {'runner': 'ubuntu-latest'}
        include:
          - os: {'runner': 'ubuntu-latest'}
            gui: 'gnome'
        exclude:
          # ERROR: Unknown key
          - operating-system: {'runner': 'ubuntu-latest'}
          # ERROR: Type mismatch object v.s. string
          - os: 'ubuntu-latest'
          # ERROR: Type mismatch object v.s. array
          - os: ['ubuntu-latest']
          # ERROR: Type mismatch object v.s. array
          - os: {'runner': {'name': 'ubuntu-latest'}}
          # ERROR: Unknown value
          - os: {'runner': 'windows-latest'}
          # ERROR: Type mismatch in key added by `include`
          - os: {'runner': 'ubuntu-latest'}
            gui: ['gnome']
          # ERROR: Unknown value in key added by `include`
          - os: {'runner': 'ubuntu-latest'}
            gui: 'kde'
    runs-on: ${{ matrix.os.runner }}
    steps:
      - run: echo ${{ matrix.gui }}
  array:
    strategy:
      matrix:
        os:
          - ['ubuntu', 'latest']
        include:
          - os: ['ubuntu', 'latest']
            gui: ['gnome', 'gtk']
        exclude:
          # ERROR: Value mismatch at first element
          - os: ['macos', 'latest']
          # ERROR: Value mismatch at second element
          - os: ['ubuntu', '22.04']
          # ERROR: Type mismatch at second element
          - os: ['ubuntu', {'version': '22.04'}]
          # ERROR: Type mismatch in key added by `include`
          - os: ['ubuntu', 'latest']
            gui: [{'name': 'gnome'}]
          # ERROR: Unknown value in key added by `include`
          - os: ['ubuntu', 'latest']
            gui: ['gnome', 'x11']
    runs-on: ${{ matrix.os[0] }}-${{ matrix.os[1] }}
    steps:
      - run: echo '${{ matrix.gui[0] }} on ${{ matrix.gui[1] }}'
