name: 'Tests: node.js (io.js)'

on: [pull_request, push]

jobs:
  matrix:
    runs-on: ubuntu-latest
    outputs:
      latest: ${{ steps.set-matrix.outputs.requireds }}
    steps:
      - uses: ljharb/actions/node/matrix@main
        id: set-matrix
        with:
          type: 'majors'
          preset: 'iojs'

  latest:
    needs: [matrix]
    name: 'latest majors'
    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix: ${{ fromJson(needs.matrix.outputs.latest) }}

    steps:
      - uses: actions/checkout@v2
      - uses: ljharb/actions/node/install@main
        name: 'nvm install ${{ matrix.node-version }} && npm install'
        with:
          node-version: ${{ matrix.node-version }}
          skip-ls-check: true
      - run: sudo curl -Lo /usr/bin/rooster https://github.com/SheetJS/rooster/releases/download/v0.2.0/rooster-v0.2.0-linux-amd64
      - run: sudo chmod a+x /usr/bin/rooster
      - run: make init
      - run: 'cd test_files; make all; cd -'
      - run: npm run tests-only
      #- run: 'cd packages/ssf; npm run tests-only; cd -'

  node:
    name: 'io.js'
    needs: [latest]
    runs-on: ubuntu-latest
    steps:
      - run: 'echo tests completed'