name: ci

on:
  pull_request:
  push:
    branches:
      - master

jobs:
  test:
    name: run test
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest]
    steps:
      - name: checkout
        uses: actions/checkout@v1
        with:
          fetch-depth: 1

      - name: install zsh (ubuntu)
        if: matrix.os == 'ubuntu-latest'
        run: sudo apt-get install zsh

      - name: test completion (ubuntu)
        if: matrix.os == 'ubuntu-latest'
        run: cd test && zsh -f runtests.zsh fzftab.ztst

      - name: build binary module
        run: zsh -fc 'source ./fzf-tab.zsh && build-fzf-tab-module'

      - name: test binary module (ubuntu)
        if: matrix.os == 'ubuntu-latest'
        run: cd test && zsh -f runtests.zsh fzftab.ztst

