name: Shared tests
on:
  pull_request:
  push:
    branches:
      - master
jobs:
  unit_tests:
    runs-on: macos-26
    steps:
      - uses: actions/checkout@v6
      - name: set up JDK 17
        uses: actions/setup-java@v5
        with:
          java-version: '17'
          distribution: 'corretto'
          cache: gradle
      - name: Setup Gradle
        uses: gradle/actions/setup-gradle@v6
      - name: Unit tests
        run: ./gradlew allTests
      - name: Generate code coverage
        run: ./gradlew shared:koverXmlReport
      - name: Upload test coverage
        uses: actions/upload-artifact@v7
        with:
          name: code-coverage.xml
          path: shared/build/coverage-report/result.xml
      - name: Static checks
        run: ./gradlew spotlessCheck
