version: 2


test: &test
  steps:
    - checkout
    - run:
        name: Install Dependencies
        command: apt-get update && apt-get install -y curl git ncurses-bin
    - run:
        name: Download requirements
        command: |
          mkdir -p ~/bin
          curl -L https://raw.githubusercontent.com/molovo/revolver/master/revolver > ~/bin/revolver
          curl -L https://github.com/molovo/zunit/releases/download/v0.8.2/zunit > ~/bin/zunit
          chmod u+x ~/bin/{revolver,zunit}
    - run:
        name: Run Zunit
        command: |
          export TERM="xterm-256color"
          export PATH="$HOME/bin:$PATH"
          zunit --verbose


jobs:
  lint:
    docker:
      - image: "python:3.7-stretch"
    steps:
      - checkout
      - run:
          name: run restructuredtext linter
          command: |
            pip install restructuredtext_lint pygments
            rst-lint *.rst

  test-zsh-5.1:
      docker:
        - image: "zshusers/zsh:5.1"
      <<: *test

  test-zsh-5.2:
      docker:
        - image: "zshusers/zsh:5.2"
      <<: *test

  test-zsh-5.3:
      docker:
        - image: "zshusers/zsh:5.3"
      <<: *test

  test-zsh-5.4:
      docker:
        - image: "zshusers/zsh:5.4"
      <<: *test

  test-zsh-5.5:
      docker:
        - image: "zshusers/zsh:5.5"
      <<: *test

  test-zsh-5.6:
      docker:
        - image: "zshusers/zsh:5.6"
      <<: *test

  test-zsh-5.7:
      docker:
        - image: "zshusers/zsh:5.7"
      <<: *test

  test-zsh-5.8:
      docker:
        - image: "zshusers/zsh:5.8"
      <<: *test

  test-zsh-5.9:
      docker:
        - image: "zshusers/zsh:5.9"
      <<: *test

workflows:
  version: 2
  test:
    jobs:
      - lint
      - test-zsh-5.1
      - test-zsh-5.2
      - test-zsh-5.3
      - test-zsh-5.4
      - test-zsh-5.5
      - test-zsh-5.6
      - test-zsh-5.7
      - test-zsh-5.8
      - test-zsh-5.9
