name: Tests

on:
  # if pushed directly
  push:
    branches:
      - master
      - release/*
      - ci/*
  # on a pull request
  pull_request:
    branches:
      - master
      - release/*
      - ci/*

jobs:
  unit-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
          submodules: recursive
      - name: Set up JDK
        uses: actions/setup-java@v3
        with:
          distribution: 'zulu'
          java-version: 20

      - name: Install System Libs
        run: sudo apt-get install -y openssl libapr1

      - name: Check
        uses: gradle/gradle-build-action@v2
        with:
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          arguments: check
        env:
          CI: true

      - name: Upload Coverage Report
        uses: codecov/codecov-action@v1
        with:
          file: ./build/reports/jacoco/test/jacocoTestReport.xml
