name: Hubot Slack Adapter CI Builds
on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
jobs:
  build:
    runs-on: ubuntu-20.04
    timeout-minutes: 10
    strategy:
      matrix:
        node-version: [6.x, 8.x, 10.x, 12.x, 14.x]
        hubot-version: ['>=2.0 <3', '^3.0']
    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - name: Install dependencies
      run: |
        npm install
        npm install hubot@"${{ matrix.hubot-version }}"
    - name: Run tests
      run: |
        npm test
    - name: Send code coverage
      run: |
        if [[ "${{ matrix.hubot-version }}" == "^3.0" && "${{ matrix.node-version }}" == "14.x" ]]; then
          npm run codecov
        fi
