# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: CI

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        mc-version:
          [
            "1.8.8",
            "1.9.4",
            "1.10.2",
            "1.11.2",
            "1.12.2",
            "1.13.2",
            "1.14.4",
            "1.15.2",
            "1.16.5",
            "1.17.1",
            "1.18.2",
            "1.19",
            "1.19.2",
            "1.19.4",
            "1.20.1",
            "1.20.2",
            "1.20.4",
          ]

    steps:
      - uses: actions/checkout@v2

      - name: Use Node.js 18
        uses: actions/setup-node@v2
        with:
          node-version: 18

      - name: Setup Java JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: 17
          java-package: jre

      - name: Install dependencies
        run: npm install

      - name: Start tests
        run: npm test
        env:
          TEST_MC_VERSION: ${{ matrix.mc-version }}
