name: Node CI

on: [push, pull_request]

jobs:
  test:
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        node-version: ['0.8', '0.10', '0.12', '4.x', '6.x', '8.x', '10.x', '12.x']
        exclude:
          - os: windows-latest
            node-version: '0.8'

    runs-on: ${{matrix.os}}

    steps:
    - uses: actions/checkout@v1
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - name: Disable strict SSL checks
      uses: allenevans/set-env@v1.0.0
      with:
        NPM_CONFIG_STRICT_SSL: 'false'
      if: matrix.node-version == '0.8'
    - name: Upgrade npm to latest available version
      run: |
        curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash
        source $HOME/.nvm/nvm.sh
        nvm install-latest-npm
      if: matrix.os != 'windows-latest'
    - run: npm install
    - run: npm test
