name: Test

on:
  push:
  pull_request:
  workflow_dispatch: # add manually button

jobs:
  test:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: recursive

      - uses: actions/setup-java@v3
        with:
          java-version: 17
          distribution: temurin

      - name: Run Gradle
        uses: gradle/gradle-build-action@v2
        with:
          arguments: |
            test
            jacocoTestReport
            --scan

      - name: Upload coverage reports to Codecov
        uses: codecov/codecov-action@v3
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
